Skip to content
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(cypress): Adjust cypress tests for changed theming #43405

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(cypress): Adjust cypress tests for changed theming
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Feb 6, 2024
commit d247e237b64bb51384123ccab8b4b9c54bb22e55
13 changes: 9 additions & 4 deletions cypress/e2e/theming/themingUtils.ts
Original file line number Diff line number Diff line change
@@ -21,8 +21,8 @@
*/
import { colord } from 'colord'

export const defaultPrimary = '#0082c9'
export const defaultAccessiblePrimary = '#00679e'
const defaultNextcloudBlue = '#0082c9'
export const defaultPrimary = '#00679e'
export const defaultBackground = 'kamil-porembinski-clouds.jpg'

/**
@@ -60,14 +60,19 @@ export const validateUserThemingDefaultCss = function(expectedColor = defaultPri

const defaultOptionBackground = defaultSelectButton.css('background-image')
const colorPickerOptionColor = defaultSelectButton.css('background-color')
const isNextcloudBlue = colord(colorPickerOptionColor).isEqual('#0082c9')

const isValidBackgroundImage = !expectedBackground
? defaultOptionBackground === 'none'
: defaultOptionBackground.includes(expectedBackground)

console.debug({ colorPickerOptionColor: colord(colorPickerOptionColor).toHex(), expectedColor, isValidBackgroundImage })
console.debug({ colorPickerOptionColor: colord(colorPickerOptionColor).toHex(), expectedColor, isValidBackgroundImage, isNextcloudBlue })

return isValidBackgroundImage && colord(colorPickerOptionColor).isEqual(expectedColor)
return isValidBackgroundImage && (
colord(colorPickerOptionColor).isEqual(expectedColor)
// we replace nextcloud blue with the the default rpimary (apps/theming/lib/Themes/DefaultTheme.php line 76)
|| (isNextcloudBlue && colord(expectedColor).isEqual(defaultPrimary))
)
}

export const pickRandomColor = function(): Cypress.Chainable<string> {
4 changes: 2 additions & 2 deletions cypress/e2e/theming/user-background.cy.ts
Original file line number Diff line number Diff line change
@@ -95,7 +95,7 @@ describe('User select shipped backgrounds and remove background', function() {

// Validate changed background and primary
cy.wait('@setBackground')
cy.waitUntil(() => validateBodyThemingCss('#56633d', background))
cy.waitUntil(() => validateBodyThemingCss('#869171', background))
})

it('Remove background', function() {
@@ -109,7 +109,7 @@ describe('User select shipped backgrounds and remove background', function() {

// Validate clear background
cy.wait('@clearBackground')
cy.waitUntil(() => validateBodyThemingCss('#56633d', null))
cy.waitUntil(() => validateBodyThemingCss('#869171', null))
})
})

Loading