aboutsummaryrefslogtreecommitdiffstats
path: root/cypress
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-01-24 17:34:52 +0100
committerFerdinand Thiessen <opensource@fthiessen.de>2024-01-25 16:04:32 +0100
commit5d61b806d640eb5e3116d0640f6341fcabb1bc24 (patch)
treec0fc9aba5b8afafbb6840f99dc0bb6b6488ebc66 /cypress
parent6215814ac5980cf2e3ca369838fb91baaea3926e (diff)
downloadnextcloud-server-5d61b806d640eb5e3116d0640f6341fcabb1bc24.tar.gz
nextcloud-server-5d61b806d640eb5e3116d0640f6341fcabb1bc24.zip
fix(cypress): Wait for color change in `pickRandomColor`
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'cypress')
-rw-r--r--cypress/e2e/theming/themingUtils.ts13
1 files changed, 10 insertions, 3 deletions
diff --git a/cypress/e2e/theming/themingUtils.ts b/cypress/e2e/theming/themingUtils.ts
index 7b570a8cb55..de0c5acd973 100644
--- a/cypress/e2e/theming/themingUtils.ts
+++ b/cypress/e2e/theming/themingUtils.ts
@@ -54,13 +54,12 @@ export const validateBodyThemingCss = function(expectedColor = defaultPrimary, e
*/
export const validateUserThemingDefaultCss = function(expectedColor = defaultPrimary, expectedBackground: string|null = defaultBackground) {
const defaultSelectButton = Cypress.$('[data-user-theming-background-default]')
- const customColor = Cypress.$('[data-user-theming-background-color]')
- if (defaultSelectButton.length === 0 || customColor.length === 0) {
+ if (defaultSelectButton.length === 0) {
return false
}
const defaultOptionBackground = defaultSelectButton.css('background-image')
- const colorPickerOptionColor = customColor.css('background-color')
+ const colorPickerOptionColor = defaultSelectButton.css('background-color')
const isValidBackgroundImage = !expectedBackground
? defaultOptionBackground === 'none'
@@ -77,12 +76,20 @@ export const pickRandomColor = function(): Cypress.Chainable<string> {
const colorPreviewSelector = '[data-user-theming-background-color],[data-admin-theming-setting-primary-color]'
+ let oldColor = ''
+ cy.get(colorPreviewSelector).then(($el) => {
+ oldColor = $el.css('background-color')
+ })
+
// Open picker
cy.contains('button', 'Change color').click()
// Click on random color
cy.get('.color-picker__simple-color-circle').eq(randColour).click()
+ // Wait for color change
+ cy.waitUntil(() => Cypress.$(colorPreviewSelector).css('background-color') !== oldColor)
+
// Get the selected color from the color preview block
return cy.get(colorPreviewSelector).then(($el) => $el.css('background-color'))
}