|
|
|
@ -21,9 +21,15 @@ |
|
|
|
|
*/ |
|
|
|
|
/* eslint-disable n/no-unpublished-import */ |
|
|
|
|
import { User } from '@nextcloud/cypress' |
|
|
|
|
import { colord } from 'colord' |
|
|
|
|
|
|
|
|
|
import { defaultPrimary, defaultBackground, pickRandomColor, validateBodyThemingCss, validateUserThemingDefaultCss } from './themingUtils' |
|
|
|
|
import { |
|
|
|
|
defaultPrimary, |
|
|
|
|
defaultBackground, |
|
|
|
|
pickRandomColor, |
|
|
|
|
validateBodyThemingCss, |
|
|
|
|
validateUserThemingDefaultCss, |
|
|
|
|
expectBackgroundColor, |
|
|
|
|
} from './themingUtils' |
|
|
|
|
|
|
|
|
|
const admin = new User('admin', 'admin') |
|
|
|
|
|
|
|
|
@ -36,15 +42,24 @@ describe('Admin theming settings visibility check', function() { |
|
|
|
|
|
|
|
|
|
it('See the admin theming section', function() { |
|
|
|
|
cy.visit('/settings/admin/theming') |
|
|
|
|
cy.get('[data-admin-theming-settings]').should('exist').scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-settings]') |
|
|
|
|
.should('exist') |
|
|
|
|
.scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-settings]').should('be.visible') |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('See the default settings', function() { |
|
|
|
|
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-color-picker]').should('exist') |
|
|
|
|
cy.get('[data-admin-theming-setting-file-reset]').should('not.exist') |
|
|
|
|
cy.get('[data-admin-theming-setting-file-remove]').should('be.visible') |
|
|
|
|
cy.get('[data-admin-theming-setting-file-remove]').should('exist') |
|
|
|
|
|
|
|
|
|
cy.get( |
|
|
|
|
'[data-admin-theming-setting-primary-color] [data-admin-theming-setting-color]', |
|
|
|
|
).then(($el) => expectBackgroundColor($el, defaultPrimary)) |
|
|
|
|
|
|
|
|
|
cy.get( |
|
|
|
|
'[data-admin-theming-setting-background-color] [data-admin-theming-setting-color]', |
|
|
|
|
).then(($el) => expectBackgroundColor($el, defaultPrimary)) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
@ -59,24 +74,42 @@ describe('Change the primary color and reset it', function() { |
|
|
|
|
|
|
|
|
|
it('See the admin theming section', function() { |
|
|
|
|
cy.visit('/settings/admin/theming') |
|
|
|
|
cy.get('[data-admin-theming-settings]').should('exist').scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-settings]') |
|
|
|
|
.should('exist') |
|
|
|
|
.scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-settings]').should('be.visible') |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Change the primary color', function() { |
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('setColor') |
|
|
|
|
|
|
|
|
|
pickRandomColor().then(color => { selectedColor = color }) |
|
|
|
|
pickRandomColor('[data-admin-theming-setting-primary-color]').then( |
|
|
|
|
(color) => { |
|
|
|
|
selectedColor = color |
|
|
|
|
}, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
cy.wait('@setColor') |
|
|
|
|
cy.waitUntil(() => validateBodyThemingCss(selectedColor, defaultBackground)) |
|
|
|
|
cy.waitUntil(() => |
|
|
|
|
validateBodyThemingCss( |
|
|
|
|
selectedColor, |
|
|
|
|
defaultBackground, |
|
|
|
|
defaultPrimary, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Screenshot the login page and validate login page', function() { |
|
|
|
|
cy.logout() |
|
|
|
|
cy.visit('/') |
|
|
|
|
|
|
|
|
|
cy.waitUntil(() => validateBodyThemingCss(selectedColor, defaultBackground)) |
|
|
|
|
cy.waitUntil(() => |
|
|
|
|
validateBodyThemingCss( |
|
|
|
|
selectedColor, |
|
|
|
|
defaultBackground, |
|
|
|
|
defaultPrimary, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
cy.screenshot() |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
@ -98,21 +131,29 @@ describe('Remove the default background and restore it', function() { |
|
|
|
|
|
|
|
|
|
it('See the admin theming section', function() { |
|
|
|
|
cy.visit('/settings/admin/theming') |
|
|
|
|
cy.get('[data-admin-theming-settings]').should('exist').scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-settings]') |
|
|
|
|
.should('exist') |
|
|
|
|
.scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-settings]').should('be.visible') |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Remove the default background', function() { |
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('removeBackground') |
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as( |
|
|
|
|
'removeBackground', |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
cy.get('[data-admin-theming-setting-file-remove]').click() |
|
|
|
|
|
|
|
|
|
cy.wait('@removeBackground') |
|
|
|
|
cy.waitUntil(() => validateBodyThemingCss(defaultPrimary, null)) |
|
|
|
|
cy.waitUntil(() => cy.window().then((win) => { |
|
|
|
|
const backgroundPlain = getComputedStyle(win.document.body).getPropertyValue('--image-background-plain') |
|
|
|
|
return backgroundPlain !== '' |
|
|
|
|
})) |
|
|
|
|
cy.waitUntil(() => |
|
|
|
|
cy.window().then((win) => { |
|
|
|
|
const backgroundPlain = getComputedStyle( |
|
|
|
|
win.document.body, |
|
|
|
|
).getPropertyValue('--image-background') |
|
|
|
|
return backgroundPlain !== '' |
|
|
|
|
}), |
|
|
|
|
) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Screenshot the login page and validate login page', function() { |
|
|
|
@ -132,7 +173,7 @@ describe('Remove the default background and restore it', function() { |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
describe('Remove the default background with a custom primary color', function() { |
|
|
|
|
describe('Remove the default background with a custom background color', function() { |
|
|
|
|
let selectedColor = '' |
|
|
|
|
|
|
|
|
|
before(function() { |
|
|
|
@ -143,23 +184,40 @@ describe('Remove the default background with a custom primary color', function() |
|
|
|
|
|
|
|
|
|
it('See the admin theming section', function() { |
|
|
|
|
cy.visit('/settings/admin/theming') |
|
|
|
|
cy.get('[data-admin-theming-settings]').should('exist').scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-settings]') |
|
|
|
|
.should('exist') |
|
|
|
|
.scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-settings]').should('be.visible') |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Change the primary color', function() { |
|
|
|
|
it('Change the background color', function() { |
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('setColor') |
|
|
|
|
|
|
|
|
|
pickRandomColor().then(color => { selectedColor = color }) |
|
|
|
|
pickRandomColor('[data-admin-theming-setting-background-color]').then( |
|
|
|
|
(color) => { |
|
|
|
|
selectedColor = color |
|
|
|
|
}, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
cy.wait('@setColor') |
|
|
|
|
cy.waitUntil(() => validateBodyThemingCss(selectedColor, defaultBackground)) |
|
|
|
|
cy.waitUntil(() => |
|
|
|
|
validateBodyThemingCss( |
|
|
|
|
defaultPrimary, |
|
|
|
|
defaultBackground, |
|
|
|
|
selectedColor, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Remove the default background', function() { |
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('removeBackground') |
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as( |
|
|
|
|
'removeBackground', |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
cy.get('[data-admin-theming-setting-file-remove]').click() |
|
|
|
|
cy.get('[data-admin-theming-setting-file-remove]').scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-setting-file-remove]').click({ |
|
|
|
|
force: true, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
cy.wait('@removeBackground') |
|
|
|
|
}) |
|
|
|
@ -168,7 +226,9 @@ describe('Remove the default background with a custom primary color', function() |
|
|
|
|
cy.logout() |
|
|
|
|
cy.visit('/') |
|
|
|
|
|
|
|
|
|
cy.waitUntil(() => validateBodyThemingCss(selectedColor, null)) |
|
|
|
|
cy.waitUntil(() => |
|
|
|
|
validateBodyThemingCss(defaultPrimary, null, selectedColor), |
|
|
|
|
) |
|
|
|
|
cy.screenshot() |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
@ -182,6 +242,8 @@ describe('Remove the default background with a custom primary color', function() |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
describe('Remove the default background with a bright color', function() { |
|
|
|
|
let selectedColor = '' |
|
|
|
|
|
|
|
|
|
before(function() { |
|
|
|
|
// Just in case previous test failed
|
|
|
|
|
cy.resetAdminTheming() |
|
|
|
@ -191,37 +253,51 @@ describe('Remove the default background with a bright color', function() { |
|
|
|
|
|
|
|
|
|
it('See the admin theming section', function() { |
|
|
|
|
cy.visit('/settings/admin/theming') |
|
|
|
|
cy.get('[data-admin-theming-settings]').should('exist').scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-settings]') |
|
|
|
|
.should('exist') |
|
|
|
|
.scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-settings]').should('be.visible') |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Remove the default background', function() { |
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('removeBackground') |
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as( |
|
|
|
|
'removeBackground', |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
cy.get('[data-admin-theming-setting-file-remove]').click() |
|
|
|
|
|
|
|
|
|
cy.wait('@removeBackground') |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Change the primary color', function() { |
|
|
|
|
it('Change the background color', function() { |
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('setColor') |
|
|
|
|
|
|
|
|
|
// Pick one of the bright color preset
|
|
|
|
|
cy.get('[data-admin-theming-setting-primary-color-picker]').click() |
|
|
|
|
cy.get('.color-picker__simple-color-circle:eq(4)').click() |
|
|
|
|
pickRandomColor( |
|
|
|
|
'[data-admin-theming-setting-background-color]', |
|
|
|
|
4, |
|
|
|
|
).then((color) => { |
|
|
|
|
selectedColor = color |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
cy.wait('@setColor') |
|
|
|
|
cy.waitUntil(() => validateBodyThemingCss('#ddcb55', null)) |
|
|
|
|
cy.waitUntil(() => |
|
|
|
|
validateBodyThemingCss(defaultPrimary, null, selectedColor), |
|
|
|
|
) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('See the header being inverted', function() { |
|
|
|
|
cy.waitUntil(() => cy.window().then((win) => { |
|
|
|
|
const firstEntry = win.document.querySelector('.app-menu-main li img') |
|
|
|
|
if (!firstEntry) { |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
return getComputedStyle(firstEntry).filter === 'invert(1)' |
|
|
|
|
})) |
|
|
|
|
cy.waitUntil(() => |
|
|
|
|
cy.window().then((win) => { |
|
|
|
|
const firstEntry = win.document.querySelector( |
|
|
|
|
'.app-menu-main li img', |
|
|
|
|
) |
|
|
|
|
if (!firstEntry) { |
|
|
|
|
return false |
|
|
|
|
} |
|
|
|
|
return getComputedStyle(firstEntry).filter === 'invert(1)' |
|
|
|
|
}), |
|
|
|
|
) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
@ -238,7 +314,9 @@ describe('Change the login fields then reset them', function() { |
|
|
|
|
|
|
|
|
|
it('See the admin theming section', function() { |
|
|
|
|
cy.visit('/settings/admin/theming') |
|
|
|
|
cy.get('[data-admin-theming-settings]').should('exist').scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-settings]') |
|
|
|
|
.should('exist') |
|
|
|
|
.scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-settings]').should('be.visible') |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
@ -246,42 +324,54 @@ describe('Change the login fields then reset them', function() { |
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('updateFields') |
|
|
|
|
|
|
|
|
|
// Name
|
|
|
|
|
cy.get('[data-admin-theming-setting-field="name"] input[type="text"]') |
|
|
|
|
.scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-setting-field="name"] input[type="text"]') |
|
|
|
|
.type(`{selectall}${name}{enter}`) |
|
|
|
|
cy.get( |
|
|
|
|
'[data-admin-theming-setting-field="name"] input[type="text"]', |
|
|
|
|
).scrollIntoView() |
|
|
|
|
cy.get( |
|
|
|
|
'[data-admin-theming-setting-field="name"] input[type="text"]', |
|
|
|
|
).type(`{selectall}${name}{enter}`) |
|
|
|
|
cy.wait('@updateFields') |
|
|
|
|
|
|
|
|
|
// Url
|
|
|
|
|
cy.get('[data-admin-theming-setting-field="url"] input[type="url"]') |
|
|
|
|
.scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-setting-field="url"] input[type="url"]') |
|
|
|
|
.type(`{selectall}${url}{enter}`) |
|
|
|
|
cy.get( |
|
|
|
|
'[data-admin-theming-setting-field="url"] input[type="url"]', |
|
|
|
|
).scrollIntoView() |
|
|
|
|
cy.get( |
|
|
|
|
'[data-admin-theming-setting-field="url"] input[type="url"]', |
|
|
|
|
).type(`{selectall}${url}{enter}`) |
|
|
|
|
cy.wait('@updateFields') |
|
|
|
|
|
|
|
|
|
// Slogan
|
|
|
|
|
cy.get('[data-admin-theming-setting-field="slogan"] input[type="text"]') |
|
|
|
|
.scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-setting-field="slogan"] input[type="text"]') |
|
|
|
|
.type(`{selectall}${slogan}{enter}`) |
|
|
|
|
cy.get( |
|
|
|
|
'[data-admin-theming-setting-field="slogan"] input[type="text"]', |
|
|
|
|
).scrollIntoView() |
|
|
|
|
cy.get( |
|
|
|
|
'[data-admin-theming-setting-field="slogan"] input[type="text"]', |
|
|
|
|
).type(`{selectall}${slogan}{enter}`) |
|
|
|
|
cy.wait('@updateFields') |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Ensure undo button presence', function() { |
|
|
|
|
cy.get('[data-admin-theming-setting-field="name"] .input-field__trailing-button') |
|
|
|
|
.scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-setting-field="name"] .input-field__trailing-button') |
|
|
|
|
.should('be.visible') |
|
|
|
|
|
|
|
|
|
cy.get('[data-admin-theming-setting-field="url"] .input-field__trailing-button') |
|
|
|
|
.scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-setting-field="url"] .input-field__trailing-button') |
|
|
|
|
.should('be.visible') |
|
|
|
|
|
|
|
|
|
cy.get('[data-admin-theming-setting-field="slogan"] .input-field__trailing-button') |
|
|
|
|
.scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-setting-field="slogan"] .input-field__trailing-button') |
|
|
|
|
.should('be.visible') |
|
|
|
|
cy.get( |
|
|
|
|
'[data-admin-theming-setting-field="name"] .input-field__trailing-button', |
|
|
|
|
).scrollIntoView() |
|
|
|
|
cy.get( |
|
|
|
|
'[data-admin-theming-setting-field="name"] .input-field__trailing-button', |
|
|
|
|
).should('be.visible') |
|
|
|
|
|
|
|
|
|
cy.get( |
|
|
|
|
'[data-admin-theming-setting-field="url"] .input-field__trailing-button', |
|
|
|
|
).scrollIntoView() |
|
|
|
|
cy.get( |
|
|
|
|
'[data-admin-theming-setting-field="url"] .input-field__trailing-button', |
|
|
|
|
).should('be.visible') |
|
|
|
|
|
|
|
|
|
cy.get( |
|
|
|
|
'[data-admin-theming-setting-field="slogan"] .input-field__trailing-button', |
|
|
|
|
).scrollIntoView() |
|
|
|
|
cy.get( |
|
|
|
|
'[data-admin-theming-setting-field="slogan"] .input-field__trailing-button', |
|
|
|
|
).should('be.visible') |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Validate login screen changes', function() { |
|
|
|
@ -317,19 +407,29 @@ describe('Disable user theming and enable it back', function() { |
|
|
|
|
|
|
|
|
|
it('See the admin theming section', function() { |
|
|
|
|
cy.visit('/settings/admin/theming') |
|
|
|
|
cy.get('[data-admin-theming-settings]').should('exist').scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-settings]') |
|
|
|
|
.should('exist') |
|
|
|
|
.scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-settings]').should('be.visible') |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Disable user background theming', function() { |
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('disableUserTheming') |
|
|
|
|
|
|
|
|
|
cy.get('[data-admin-theming-setting-disable-user-theming]') |
|
|
|
|
.scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-setting-disable-user-theming]') |
|
|
|
|
.should('be.visible') |
|
|
|
|
cy.get('[data-admin-theming-setting-disable-user-theming] input[type="checkbox"]').check({ force: true }) |
|
|
|
|
cy.get('[data-admin-theming-setting-disable-user-theming] input[type="checkbox"]').should('be.checked') |
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as( |
|
|
|
|
'disableUserTheming', |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
cy.get( |
|
|
|
|
'[data-admin-theming-setting-disable-user-theming]', |
|
|
|
|
).scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-setting-disable-user-theming]').should( |
|
|
|
|
'be.visible', |
|
|
|
|
) |
|
|
|
|
cy.get( |
|
|
|
|
'[data-admin-theming-setting-disable-user-theming] input[type="checkbox"]', |
|
|
|
|
).check({ force: true }) |
|
|
|
|
cy.get( |
|
|
|
|
'[data-admin-theming-setting-disable-user-theming] input[type="checkbox"]', |
|
|
|
|
).should('be.checked') |
|
|
|
|
|
|
|
|
|
cy.wait('@disableUserTheming') |
|
|
|
|
}) |
|
|
|
@ -343,8 +443,9 @@ describe('Disable user theming and enable it back', function() { |
|
|
|
|
|
|
|
|
|
it('User cannot not change background settings', function() { |
|
|
|
|
cy.visit('/settings/user/theming') |
|
|
|
|
cy.get('[data-user-theming-background-disabled]').scrollIntoView() |
|
|
|
|
cy.get('[data-user-theming-background-disabled]').should('be.visible') |
|
|
|
|
cy.contains( |
|
|
|
|
'Customization has been disabled by your administrator', |
|
|
|
|
).should('exist') |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
@ -363,40 +464,60 @@ describe('The user default background settings reflect the admin theming setting |
|
|
|
|
|
|
|
|
|
it('See the admin theming section', function() { |
|
|
|
|
cy.visit('/settings/admin/theming') |
|
|
|
|
cy.get('[data-admin-theming-settings]').should('exist').scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-settings]') |
|
|
|
|
.should('exist') |
|
|
|
|
.scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-settings]').should('be.visible') |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Change the primary color', function() { |
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('setColor') |
|
|
|
|
|
|
|
|
|
pickRandomColor().then(color => { selectedColor = color }) |
|
|
|
|
|
|
|
|
|
cy.wait('@setColor') |
|
|
|
|
cy.waitUntil(() => cy.window().then(($window) => { |
|
|
|
|
const primary = $window.getComputedStyle($window.document.body).getPropertyValue('--color-primary-default') |
|
|
|
|
return colord(primary).isEqual(selectedColor) |
|
|
|
|
})) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Change the default background', function() { |
|
|
|
|
cy.intercept('*/apps/theming/ajax/uploadImage').as('setBackground') |
|
|
|
|
|
|
|
|
|
cy.fixture('image.jpg', null).as('background') |
|
|
|
|
cy.get('[data-admin-theming-setting-file="background"] input[type="file"]').selectFile('@background', { force: true }) |
|
|
|
|
cy.get( |
|
|
|
|
'[data-admin-theming-setting-file="background"] input[type="file"]', |
|
|
|
|
).selectFile('@background', { force: true }) |
|
|
|
|
|
|
|
|
|
cy.wait('@setBackground') |
|
|
|
|
cy.waitUntil(() => cy.window().then((win) => { |
|
|
|
|
const currentBackgroundDefault = getComputedStyle(win.document.body).getPropertyValue('--image-background-default') |
|
|
|
|
return currentBackgroundDefault.includes('/apps/theming/image/background?v=') |
|
|
|
|
})) |
|
|
|
|
cy.waitUntil(() => |
|
|
|
|
validateBodyThemingCss( |
|
|
|
|
defaultPrimary, |
|
|
|
|
'/apps/theming/image/background?v=', |
|
|
|
|
null, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Change the background color', function() { |
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('setColor') |
|
|
|
|
|
|
|
|
|
pickRandomColor('[data-admin-theming-setting-background-color]').then( |
|
|
|
|
(color) => { |
|
|
|
|
selectedColor = color |
|
|
|
|
}, |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
cy.wait('@setColor') |
|
|
|
|
cy.waitUntil(() => |
|
|
|
|
validateBodyThemingCss( |
|
|
|
|
defaultPrimary, |
|
|
|
|
'/apps/theming/image/background?v=', |
|
|
|
|
selectedColor, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Login page should match admin theming settings', function() { |
|
|
|
|
cy.logout() |
|
|
|
|
cy.visit('/') |
|
|
|
|
|
|
|
|
|
cy.waitUntil(() => validateBodyThemingCss(selectedColor, '/apps/theming/image/background?v=')) |
|
|
|
|
cy.waitUntil(() => |
|
|
|
|
validateBodyThemingCss( |
|
|
|
|
defaultPrimary, |
|
|
|
|
'/apps/theming/image/background?v=', |
|
|
|
|
selectedColor, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Login as user', function() { |
|
|
|
@ -413,9 +534,17 @@ describe('The user default background settings reflect the admin theming setting |
|
|
|
|
|
|
|
|
|
it('Default user background settings should match admin theming settings', function() { |
|
|
|
|
cy.get('[data-user-theming-background-default]').should('be.visible') |
|
|
|
|
cy.get('[data-user-theming-background-default]').should('have.class', 'background--active') |
|
|
|
|
|
|
|
|
|
cy.waitUntil(() => validateUserThemingDefaultCss(selectedColor, '/apps/theming/image/background?v=')) |
|
|
|
|
cy.get('[data-user-theming-background-default]').should( |
|
|
|
|
'have.class', |
|
|
|
|
'background--active', |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
cy.waitUntil(() => |
|
|
|
|
validateUserThemingDefaultCss( |
|
|
|
|
selectedColor, |
|
|
|
|
'/apps/theming/image/background?v=', |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
@ -432,12 +561,16 @@ describe('The user default background settings reflect the admin theming setting |
|
|
|
|
|
|
|
|
|
it('See the admin theming section', function() { |
|
|
|
|
cy.visit('/settings/admin/theming') |
|
|
|
|
cy.get('[data-admin-theming-settings]').should('exist').scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-settings]') |
|
|
|
|
.should('exist') |
|
|
|
|
.scrollIntoView() |
|
|
|
|
cy.get('[data-admin-theming-settings]').should('be.visible') |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
it('Remove the default background', function() { |
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('removeBackground') |
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as( |
|
|
|
|
'removeBackground', |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
cy.get('[data-admin-theming-setting-file-remove]').click() |
|
|
|
|
|
|
|
|
@ -466,7 +599,10 @@ describe('The user default background settings reflect the admin theming setting |
|
|
|
|
|
|
|
|
|
it('Default user background settings should match admin theming settings', function() { |
|
|
|
|
cy.get('[data-user-theming-background-default]').should('be.visible') |
|
|
|
|
cy.get('[data-user-theming-background-default]').should('have.class', 'background--active') |
|
|
|
|
cy.get('[data-user-theming-background-default]').should( |
|
|
|
|
'have.class', |
|
|
|
|
'background--active', |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
cy.waitUntil(() => validateUserThemingDefaultCss(defaultPrimary, null)) |
|
|
|
|
}) |
|
|
|
|