})
it('See the default settings', function() {
- cy.get('[data-admin-theming-setting-primary-color-picker]').should('contain.text', defaultPrimary)
+ cy.get('[data-admin-theming-setting-primary-color-picker]').should('exist')
cy.get('[data-admin-theming-setting-primary-color-reset]').should('not.exist')
cy.get('[data-admin-theming-setting-file-reset]').should('not.exist')
cy.get('[data-admin-theming-setting-file-remove]').should('be.visible')
it('Change the primary color', function() {
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('setColor')
- pickRandomColor('[data-admin-theming-setting-primary-color-picker]')
- .then(color => { selectedColor = color })
+ pickRandomColor().then(color => { selectedColor = color })
cy.wait('@setColor')
cy.waitUntil(() => validateBodyThemingCss(selectedColor, defaultBackground))
it('Change the primary color', function() {
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('setColor')
- pickRandomColor('[data-admin-theming-setting-primary-color-picker]')
- .then((color) => { selectedColor = color })
+ pickRandomColor().then(color => { selectedColor = color })
cy.wait('@setColor')
cy.waitUntil(() => validateBodyThemingCss(selectedColor, defaultBackground))
it('Change the primary color', function() {
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('setColor')
- pickRandomColor('[data-admin-theming-setting-primary-color-picker]')
- .then(color => { selectedColor = color })
+ pickRandomColor().then(color => { selectedColor = color })
cy.wait('@setColor')
cy.waitUntil(() => cy.window().then(($window) => {
// Pick one of the first 8 options
const randColour = Math.floor(Math.random() * 8)
+ const colorPreviewSelector = '[data-user-theming-background-color],[data-admin-theming-setting-primary-color]'
+
// Open picker
- cy.get('button').contains('Change color').click()
+ cy.contains('button', 'Change color').click()
+
+ // Click on random color
+ cy.get('.color-picker__simple-color-circle').eq(randColour).click()
- // Return selected colour
- return cy.get('.color-picker__simple-color-circle').eq(randColour).then(($el) => {
- $el.trigger('click')
- return $el.css('background-color')
- })
+ // Get the selected color from the color preview block
+ return cy.get(colorPreviewSelector).then(($el) => $el.css('background-color'))
}
cy.intercept('*/apps/theming/background/color').as('setColor')
// Pick one of the bright color preset
- cy.get('button').contains('Change color').click()
+ cy.contains('button', 'Change color').click()
cy.get('.color-picker__simple-color-circle:eq(4)').click()
// Validate custom colour change
it('Select a custom color', function() {
cy.intercept('*/apps/theming/background/color').as('setColor')
- cy.get('button').contains('Change color').click()
+ cy.contains('button', 'Change color').click()
cy.get('.color-picker__simple-color-circle:eq(5)').click()
// Validate clear background