Skip to content

Commit

Permalink
update selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
Pawan Kumar authored and Pawan Kumar committed Sep 5, 2024
1 parent 3f7e7b6 commit 8337791
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 49 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const commonlocators = require("../../../../locators/commonlocators.json");
const themelocator = require("../../../../locators/ThemeLocators.json");

import { multiSelectWidgetLocators } from "../../../../locators/WidgetLocators";
import {
agHelper,
locators,
Expand All @@ -26,48 +27,16 @@ describe(
agHelper.GetNClick(locators._canvas);
appSettings.OpenAppSettings();
appSettings.GoToThemeSettings();
//Border validation
//cy.contains("Border").click({ force: true });
cy.get(themelocator.border).should("have.length", "3");
cy.borderMouseover(0, "none");
cy.borderMouseover(1, "M");
cy.borderMouseover(2, "L");
cy.get(themelocator.border).eq(1).click({ force: true });
cy.wait("@updateTheme").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
);
cy.wait(1000);
cy.contains("Border").click({ force: true });

//Shadow validation
//cy.contains("Shadow").click({ force: true });
cy.wait(2000);
cy.xpath(theme.locators._boxShadow("L")).click({ force: true });
cy.wait("@updateTheme").should(
"have.nested.property",
"response.body.responseMeta.status",
200,
);
cy.wait(1000);
cy.contains("Shadow").click({ force: true });

//Font

cy.xpath(
"//p[text()='App font']/following-sibling::section//div//input",
).then(($elem) => {
cy.get($elem).click({ force: true });
cy.wait(250);
cy.fixture("fontData").then(function (testdata) {
this.testdata = testdata;
});

cy.get(themelocator.fontsSelected)
//.eq(10)
agHelper.GetNClick($elem);

agHelper.GetElement(themelocator.fontsSelected)
.should("contain.text", "Nunito Sans");

cy.get(".rc-virtual-list .rc-select-item-option")
agHelper.GetElement(".rc-virtual-list .rc-select-item-option")
.find(".leading-normal")
.eq(3)
.then(($childElem) => {
Expand All @@ -80,18 +49,18 @@ describe(
themeFont = `Inter, sans-serif`;
});
});

cy.contains("Font").click({ force: true });

appSettings.ClosePane();
});

//Skipping due to mentioned bug
it("2. Publish the App and validate Font across the app", function () {
deployMode.DeployApp();
cy.get(".rc-select-selection-item > .rc-select-selection-item-content")
agHelper.GetElement(multiSelectWidgetLocators.multiSelectWidgetSelectedOptionContent)
.first()
.should("have.css", "font-family", themeFont);
cy.get(".rc-select-selection-item > .rc-select-selection-item-content")
agHelper.GetElement(multiSelectWidgetLocators.multiSelectWidgetSelectedOptionContent)
.last()
.should("have.css", "font-family", themeFont);
deployMode.NavigateBacktoEditor();
Expand All @@ -100,17 +69,15 @@ describe(
it("3. Apply theme and validate the color", function () {
appSettings.OpenAppSettings();
appSettings.GoToThemeSettings();
cy.get(commonlocators.changeThemeBtn).click({ force: true });
cy.get(
agHelper.GetNClick(commonlocators.changeThemeBtn, 0, true);
agHelper.GetNClick(
`${themelocator.featuredThemeSection} [data-testid='t--theme-card-Sunrise']`,
)
.click({ force: true })
.wait(1000);


deployMode.DeployApp();

cy.get(".rc-select-selector").click({ force: true });
cy.get(".rc-select-item-option-selected .bp3-control-indicator")
agHelper.GetNClick(multiSelectWidgetLocators.multiSelectWidgetTrigger);
agHelper.GetElement(multiSelectWidgetLocators.multiSelectWidgetDropdownOptionCheckbox)
.first()
.should("have.css", "background-color", "rgb(239, 68, 68)");
});
Expand Down
3 changes: 2 additions & 1 deletion app/client/cypress/locators/ThemeLocators.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"fontsSelected": ".leading-normal",
"currentTheme": ".cursor-pointer:contains('Applied theme')",
"purpleColor": "[style='background-color: rgb(107,114,128);']",
"featuredThemeSection": "[data-testid='t--featured-themes']"
"featuredThemeSection": "[data-testid='t--featured-themes']",
"fontOption": ".rc-virtual-list .rc-select-item-option"
}
6 changes: 6 additions & 0 deletions app/client/cypress/locators/WidgetLocators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,9 @@ export const buttongroupwidgetlocators = {
`//*[contains(@class,'bp3-menu-item')]//*[text()='${text}']`,
button: "//*[contains(@class,'t--widget-buttongroupwidget')]//button",
};

export const multiSelectWidgetLocators = {
multiSelectWidgetTrigger: ".t--widget-multiselectwidgetv2 .rc-select-selector",
multiSelectWidgetSelectedOptionContent: ".rc-select-selection-item > .rc-select-selection-item-content",
multiSelectWidgetDropdownOptionCheckbox: ".multi-select-dropdown .rc-select-item-option-selected .bp3-control-indicator"
};
2 changes: 1 addition & 1 deletion app/client/packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"postinstall": "yarn build",
"test:unit": "yarn g:jest"
}
}
}

0 comments on commit 8337791

Please sign in to comment.