-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Theming Selected new Font is reverted whenever Color is removed #36119
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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, | ||
|
@@ -26,49 +27,19 @@ 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; | ||
}); | ||
agHelper.GetNClick($elem); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Refactor: Replace XPath with data- attributes for selectors.* The use of XPath selectors is discouraged due to their fragility and performance issues. It's better to use data-* attributes, which are more robust and maintainable. For instance: - cy.xpath("//p[text()='App font']/following-sibling::section//div//input")
+ cy.get('[data-cy="app-font-input"]') Please update all instances where XPath is used to use data-* attributes instead. Also applies to: 36-42, 55-55 |
||
|
||
cy.get(themelocator.fontsSelected) | ||
//.eq(10) | ||
agHelper | ||
.GetElement(themelocator.fontsSelected) | ||
.should("contain.text", "Nunito Sans"); | ||
|
||
cy.get(".rc-virtual-list .rc-select-item-option") | ||
.find(".leading-normal") | ||
agHelper | ||
.GetElement(themelocator.fontOption) | ||
.find(themelocator.fontsSelected) | ||
.eq(3) | ||
.then(($childElem) => { | ||
cy.get($childElem).click({ force: true }); | ||
|
@@ -80,60 +51,46 @@ describe( | |
themeFont = `Inter, sans-serif`; | ||
}); | ||
}); | ||
cy.contains("Font").click({ force: true }); | ||
|
||
//Color - Bug 23501 - hence skipping | ||
// cy.wait(1000); | ||
// theme.ChangeThemeColor("purple", "Primary"); | ||
// cy.get(themelocator.inputColor).should("have.value", "purple"); | ||
// cy.wait(1000); | ||
cy.contains("Font").click({ force: true }); | ||
|
||
// theme.ChangeThemeColor("brown", "Background"); | ||
// cy.get(themelocator.inputColor).should("have.value", "brown"); | ||
// cy.wait(1000); | ||
// cy.contains("Color").click({ force: true }); | ||
appSettings.ClosePane(); | ||
}); | ||
|
||
//Skipping due to mentioned bug | ||
it.skip("2. Publish the App and validate Font across the app + Bug 15007", function () { | ||
it("2. Publish the App and validate Font across the app", function () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Re-enable and update the skipped test case. The test case "2. Publish the App and validate Font across the app" is currently skipped. Given the PR's focus on ensuring font settings are retained correctly, this test case should be re-enabled and updated to reflect the new functionality. Ensure that the test case validates the font consistency across different app components after theme changes. Also applies to: 62-71 |
||
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(); | ||
}); | ||
|
||
it.skip("3. Validate current theme feature", function () { | ||
cy.get("#canvas-selection-0").click({ force: true }); | ||
it("3. Apply theme and validate the color", function () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Optimize theme application and color validation logic. The test case "3. Apply theme and validate the color" is well-structured to validate the color consistency after theme application. However, consider using more direct selectors and assertions to streamline the process and improve test performance. For example: - agHelper.GetNClick(`${themelocator.featuredThemeSection} [data-testid='t--theme-card-Sunrise']`)
+ cy.get('[data-cy="theme-card-Sunrise"]').click() This change not only simplifies the selector but also enhances the readability and maintainability of the test code. Also applies to: 80-93 |
||
appSettings.OpenAppSettings(); | ||
appSettings.GoToThemeSettings(); | ||
//Change the Theme | ||
cy.get(commonlocators.changeThemeBtn).click({ force: true }); | ||
cy.get(themelocator.currentTheme).click({ force: true }); | ||
cy.get(".t--theme-card main > main") | ||
.first() | ||
.invoke("css", "background-color") | ||
.then(() => { | ||
cy.get(".t--draggable-multiselectwidgetv2:contains('more')") | ||
.last() | ||
.invoke("css", "background-color") | ||
.then((selectedBackgroudColor) => { | ||
expect("rgba(0, 0, 0, 0)").to.equal(selectedBackgroudColor); | ||
appSettings.ClosePane(); | ||
}); | ||
}); | ||
agHelper.GetNClick(commonlocators.changeThemeBtn, 0, true); | ||
agHelper.GetNClick( | ||
`${themelocator.featuredThemeSection} [data-testid='t--theme-card-Sunrise']`, | ||
); | ||
|
||
//Publish the App and validate change of Theme across the app in publish mode | ||
deployMode.DeployApp(); | ||
cy.xpath("//div[@id='root']//section/parent::div").should( | ||
"have.css", | ||
"background-color", | ||
"rgb(165, 42, 42)", | ||
); | ||
|
||
agHelper.GetNClick(multiSelectWidgetLocators.multiSelectWidgetTrigger); | ||
agHelper | ||
.GetElement( | ||
multiSelectWidgetLocators.multiSelectWidgetDropdownOptionCheckbox, | ||
) | ||
.first() | ||
.should("have.css", "background-color", "rgb(239, 68, 68)"); | ||
}); | ||
}, | ||
); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,4 @@ | |
"postinstall": "yarn build", | ||
"test:unit": "yarn g:jest" | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactor: Consolidate imports for better maintainability.
It's commendable to keep all related imports together, but consider consolidating them into fewer lines to enhance readability and maintainability. For example: