test: Cypress | ThemingTests fixes (#24577)

## Description
- This PR fixes flaky ThemingTests
This commit is contained in:
Aishwarya-U-R 2023-06-17 20:16:39 +05:30 committed by GitHub
parent 0bf8e17e74
commit 93afc46380
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 26 deletions

View File

@ -248,6 +248,9 @@ jobs:
- run: |
echo "BROWSER_PATH=$(which chrome)" >> $GITHUB_ENV
- name: Set Pull Request Title
run: echo "PR_TITLE=${{ github.event.pull_request.title }}" >> $GITHUB_ENV
- name: Save Git values
# pass env variables from this step to other steps
# using GitHub Actions environment file
@ -255,13 +258,12 @@ jobs:
run: |
PR_NUMBER=${{ inputs.pr }}
echo COMMIT_INFO_BRANCH=$(git ls-remote origin "pull/$PR_NUMBER/head" | cut -d$'\t' -f2 | sed 's#refs/heads/##') >> $GITHUB_ENV
echo COMMIT_INFO_MESSAGE=Run from PR# ${{ inputs.pr }} on commit $(git show -s --pretty=%H | cut -c 1-7) >> $GITHUB_ENV
echo COMMIT_INFO_MESSAGE=Run from PR# ${{ inputs.pr }} on branch $(git ls-remote origin "pull/$PR_NUMBER/head" | cut -d$'\t' -f2 | sed 's#refs/heads/##') >> $GITHUB_ENV
echo COMMIT_INFO_EMAIL=$(git show -s --pretty=%ae) >> $GITHUB_ENV
echo COMMIT_INFO_AUTHOR=$(git show -s --pretty=%an) >> $GITHUB_ENV
echo COMMIT_INFO_SHA=$(git show -s --pretty=%H) >> $GITHUB_ENV
echo COMMIT_INFO_TIMESTAMP=$(git show -s --pretty=%ct) >> $GITHUB_ENV
echo COMMIT_INFO_REMOTE=$(git config --get remote.origin.url) >> $GITHUB_ENV
echo COMMIT_INFO_MESSAGE_FINAL=$(github.event.pull_request.title) >> $GITHUB_ENV
# delete the .git folder afterwords to use the environment values
rm -rf .git
@ -269,7 +271,6 @@ jobs:
run: |
echo Branch $COMMIT_INFO_BRANCH
echo Message $COMMIT_INFO_MESSAGE
echo FinalMsg $COMMIT_INFO_MESSAGE_FINAL
echo Email $COMMIT_INFO_EMAIL
echo Author $COMMIT_INFO_AUTHOR
echo SHA $COMMIT_INFO_SHA
@ -281,7 +282,7 @@ jobs:
if [[ ${{ inputs.pr }} -ne 0 ]]; then
echo "COMMIT_INFO_MESSAGE=${{ env.COMMIT_INFO_MESSAGE }}" >> $GITHUB_ENV
else
echo "COMMIT_INFO_MESSAGE=${{ github.event.pull_request.title }}" >> $GITHUB_ENV
echo "COMMIT_INFO_MESSAGE=${{ env.PR_TITLE }}" >> $GITHUB_ENV
fi
- name: Run the cypress test

View File

@ -19,7 +19,7 @@ let themeFont;
describe("Theme validation usecases", function () {
it("1. Drag and drop form widget and validate Default font and list of font validation", function () {
entityExplorer.DragDropWidgetNVerify(draggableWidgets.FORM, 300, 80);
entityExplorer.DragDropWidgetNVerify(draggableWidgets.FORM);
agHelper.GetNClick(locators._canvas);
appSettings.OpenAppSettings();
appSettings.GoToThemeSettings();
@ -92,7 +92,7 @@ describe("Theme validation usecases", function () {
cy.get(themelocator.inputColor).should("have.value", "#15803d");
cy.get(themelocator.inputColor).clear({ force: true });
cy.wait(2000);
theme.ChangeThemeColor(21, "Background");
theme.ChangeThemeColor(16, "Background");
cy.get(themelocator.inputColor).should("have.value", "#dc2626"); //Red
cy.wait(2000);
@ -106,7 +106,7 @@ describe("Theme validation usecases", function () {
cy.get(themelocator.inputColor).should("have.value", "#15803d");
cy.get(themelocator.inputColor).clear({ force: true });
cy.wait(2000);
theme.ChangeThemeColor(14, "Primary");
theme.ChangeThemeColor(9, "Primary");
cy.get(themelocator.inputColor).should("have.value", "#18181b"); //Black
cy.wait(2000);
cy.contains("Color").click({ force: true });

View File

@ -1,18 +1,24 @@
const commonlocators = require("../../../../locators/commonlocators.json");
const themelocator = require("../../../../locators/ThemeLocators.json");
import * as _ from "../../../../support/Objects/ObjectsCore";
import {
agHelper,
locators,
entityExplorer,
deployMode,
appSettings,
theme,
draggableWidgets,
} from "../../../../support/Objects/ObjectsCore";
let themeFont;
describe("Theme validation usecase for multi-select widget", function () {
it("1. Drag and drop multi-select widget and validate Default font and list of font validation + Bug 15007", function () {
_.entityExplorer.DragDropWidgetNVerify(
_.draggableWidgets.MULTISELECT,
300,
80,
);
_.appSettings.OpenAppSettings();
_.appSettings.GoToThemeSettings();
entityExplorer.DragDropWidgetNVerify(draggableWidgets.MULTISELECT, 300, 80);
agHelper.GetNClick(locators._canvas);
appSettings.OpenAppSettings();
appSettings.GoToThemeSettings();
//Border validation
//cy.contains("Border").click({ force: true });
cy.get(themelocator.border).should("have.length", "3");
@ -31,7 +37,7 @@ describe("Theme validation usecase for multi-select widget", function () {
//Shadow validation
//cy.contains("Shadow").click({ force: true });
cy.wait(2000);
cy.xpath(_.theme.locators._boxShadow("L")).click({ force: true });
cy.xpath(theme.locators._boxShadow("L")).click({ force: true });
cy.wait("@updateTheme").should(
"have.nested.property",
"response.body.responseMeta.status",
@ -71,33 +77,33 @@ describe("Theme validation usecase for multi-select widget", function () {
//Color - Bug 23501 - hence skipping
// cy.wait(1000);
// _.theme.ChangeThemeColor("purple", "Primary");
// theme.ChangeThemeColor("purple", "Primary");
// cy.get(themelocator.inputColor).should("have.value", "purple");
// cy.wait(1000);
// _.theme.ChangeThemeColor("brown", "Background");
// theme.ChangeThemeColor("brown", "Background");
// cy.get(themelocator.inputColor).should("have.value", "brown");
// cy.wait(1000);
// cy.contains("Color").click({ force: true });
_.appSettings.ClosePane();
appSettings.ClosePane();
});
it.skip("2. Publish the App and validate Font across the app + Bug 15007", function () {
//Skipping due to mentioned bug
_.deployMode.DeployApp();
deployMode.DeployApp();
cy.get(".rc-select-selection-item > .rc-select-selection-item-content")
.first()
.should("have.css", "font-family", themeFont);
cy.get(".rc-select-selection-item > .rc-select-selection-item-content")
.last()
.should("have.css", "font-family", themeFont);
_.deployMode.NavigateBacktoEditor();
deployMode.NavigateBacktoEditor();
});
it.skip("3. Validate current theme feature", function () {
cy.get("#canvas-selection-0").click({ force: true });
_.appSettings.OpenAppSettings();
_.appSettings.GoToThemeSettings();
appSettings.OpenAppSettings();
appSettings.GoToThemeSettings();
//Change the Theme
cy.get(commonlocators.changeThemeBtn).click({ force: true });
cy.get(themelocator.currentTheme).click({ force: true });
@ -110,12 +116,12 @@ describe("Theme validation usecase for multi-select widget", function () {
.invoke("css", "background-color")
.then((selectedBackgroudColor) => {
expect("rgba(0, 0, 0, 0)").to.equal(selectedBackgroudColor);
_.appSettings.ClosePane();
appSettings.ClosePane();
});
});
//Publish the App and validate change of Theme across the app in publish mode
_.deployMode.DeployApp();
deployMode.DeployApp();
cy.xpath("//div[@id='root']//section/parent::div").should(
"have.css",
"background-color",

View File

@ -9,7 +9,8 @@ export class ThemeSettings {
themeName +
"']//ancestor::div[@class= 'space-y-1 group']",
_colorPickerV2Popover: ".t--colorpicker-v2-popover",
_colorPickerV2Color: ".t--colorpicker-v2-color",
_colorPickerV2Color:
"//h3[text()='All Colors']/following-sibling::div//div[contains(@class,'t--colorpicker-v2-color')]",
_colorRingPrimary: "[data-testid='theme-primaryColor']",
_colorRingBackground: "[data-testid='theme-backgroundColor']",
_colorInput: (option: string) =>