Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MariiaNebesnova committed Jul 18, 2023
1 parent 14aac8b commit bb209f7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/__tests__/__mocks__/locator.mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const locator1 = {
xPath: "//*[@class='sidebar-menu left']",
output: "//*[@class='sidebar-menu left']",
taskStatus: "SUCCESS",
xPathStatus: "SUCCESS",
cssSelector: ".sidebar-menu.left",
},
name: "radiobuttonsUl",
Expand All @@ -28,7 +29,7 @@ export const locator2 = {
locator: {
xPath: "//*[@class='sidebar-menu left']",
cssSelector: "",
taskStatus: "SUCCESS",
xPathStatus: "SUCCESS",
},
name: "radiobuttonsUl",
predictedAttrId: "",
Expand All @@ -49,7 +50,7 @@ export const locator3 = {
locator: {
xPath: "//*[@class='sidebar-menu left']",
cssSelector: "",
taskStatus: "SUCCESS",
xPathStatus: "SUCCESS",
},
name: "radiobuttonsUl",
predictedAttrId: "",
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/locators/locatorsSlice.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe("changeLocatorAttributes reducer", () => {
expect(changeElementNameSpy).toHaveBeenCalledWith(locator);
});

test("edit type, custom name stays the same", () => {
test("edit type, custom name remains the same", () => {
store.dispatch(
changeLocatorAttributes({
element_id: "8736312404689610766421832473",
Expand Down Expand Up @@ -96,7 +96,7 @@ describe("changeLocatorAttributes reducer", () => {
expect(locator.isCustomLocator).toBeTruthy();
expect(locator.isCustomName).toBeTruthy();
expect(locator.locator.xPath).toBe("//*[@class='any-class']");
expect(locator.locator.taskStatus).toBe(LocatorTaskStatus.SUCCESS);
expect(locator.locator.xPathStatus).toBe(LocatorTaskStatus.SUCCESS);
});

test("warned validation", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ export const getRootState = (_pageObject: PageObject) => ({
locator: {
cssSelector: ".main-content",
output: ".main-content",
taskStatus: "SUCCESS",
xPathStatus: "SUCCESS",
cssSelectorStatus: "SUCCESS",
xPath: "//*[@class='main-content']",
},
locatorType: LocatorType.cssSelector,
Expand All @@ -88,7 +89,8 @@ export const getRootState = (_pageObject: PageObject) => ({
locator: {
cssSelector: ".uui-navigation.nav.navbar-nav.m-l8.any",
output: "//*[@class='uui-navigation nav navbar-nav m-l8 any']",
taskStatus: "SUCCESS",
xPathStatus: "SUCCESS",
cssSelectorStatus: "PENDING",
xPath: "//*[@class='uui-navigation nav navbar-nav m-l8 any']",
},
name: "homeContactFormServiceSupportDatesSearchComplexTableSimpleTa",
Expand All @@ -112,7 +114,8 @@ export const getRootState = (_pageObject: PageObject) => ({
elemAriaLabel: null,
locator: {
cssSelector: '[index="5"] > ul',
taskStatus: "SUCCESS",
xPathStatus: "SUCCESS",
cssSelectorStatus: "FAILURE",
xPath: "//*[@index='5']/ul",
output: "//*[@index='5']/ul",
},
Expand Down Expand Up @@ -141,6 +144,8 @@ export const selectMockedLocators = (pageObject: PageObject) => [
elemAriaLabel: null,
locator: {
taskStatus: "SUCCESS",
cssSelectorStatus: "SUCCESS",
xPathStatus: "SUCCESS",
xPath: "//*[@class='main-content']",
output: ".main-content",
cssSelector: ".main-content",
Expand All @@ -163,7 +168,9 @@ export const selectMockedLocators = (pageObject: PageObject) => [
elemAriaLabel: null,
...(pageObject.locatorType === LocatorType.cssSelector ? { locatorType: LocatorType.cssSelector } : null),
locator: {
taskStatus: "SUCCESS",
taskStatus: "PENDING",
xPathStatus: "SUCCESS",
cssSelectorStatus: "PENDING",
xPath: "//*[@class='uui-navigation nav navbar-nav m-l8 any']",
cssSelector: ".uui-navigation.nav.navbar-nav.m-l8.any",
output:
Expand Down Expand Up @@ -191,7 +198,9 @@ export const selectMockedLocators = (pageObject: PageObject) => [
elemText: "HTML 5",
elemAriaLabel: null,
locator: {
taskStatus: "SUCCESS",
taskStatus: "FAILURE",
xPathStatus: "SUCCESS",
cssSelectorStatus: "FAILURE",
xPath: "//*[@index='5']/ul",
output: "//*[@index='5']/ul",
cssSelector: '[index="5"] > ul',
Expand Down

0 comments on commit bb209f7

Please sign in to comment.