Skip to content

Commit 49e85f8

Browse files
committed
fix(cypress): Wait for color change in pickRandomColor
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent 6215814 commit 49e85f8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cypress/e2e/theming/themingUtils.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,20 @@ export const pickRandomColor = function(): Cypress.Chainable<string> {
7777

7878
const colorPreviewSelector = '[data-user-theming-background-color],[data-admin-theming-setting-primary-color]'
7979

80+
let oldColor = ''
81+
cy.get(colorPreviewSelector).then(($el) => {
82+
oldColor = $el.css('background-color')
83+
})
84+
8085
// Open picker
8186
cy.contains('button', 'Change color').click()
8287

8388
// Click on random color
8489
cy.get('.color-picker__simple-color-circle').eq(randColour).click()
8590

91+
// Wait for color change
92+
cy.waitUntil(() => Cypress.$(colorPreviewSelector).css('background-color') !== oldColor)
93+
8694
// Get the selected color from the color preview block
8795
return cy.get(colorPreviewSelector).then(($el) => $el.css('background-color'))
8896
}

0 commit comments

Comments
 (0)