|
|
|
@ -23,14 +23,11 @@
|
|
|
|
|
import { User } from '@nextcloud/cypress'
|
|
|
|
|
import { colord } from 'colord'
|
|
|
|
|
|
|
|
|
|
import { pickRandomColor, validateBodyThemingCss, validateUserThemingDefaultCss } from './themingUtils'
|
|
|
|
|
import { defaultPrimary, defaultBackground, pickRandomColor, validateBodyThemingCss, validateUserThemingDefaultCss } from './themingUtils'
|
|
|
|
|
|
|
|
|
|
const admin = new User('admin', 'admin')
|
|
|
|
|
|
|
|
|
|
const defaultPrimary = '#0082c9'
|
|
|
|
|
const defaultBackground = 'kamil-porembinski-clouds.jpg'
|
|
|
|
|
|
|
|
|
|
describe('Admin theming settings', function() {
|
|
|
|
|
describe('Admin theming settings visibility check', function() {
|
|
|
|
|
before(function() {
|
|
|
|
|
// Just in case previous test failed
|
|
|
|
|
cy.resetAdminTheming()
|
|
|
|
@ -50,8 +47,9 @@ describe('Admin theming settings', function() {
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
describe('Change the primary colour and reset it', function() {
|
|
|
|
|
describe('Change the primary color and reset it', function() {
|
|
|
|
|
let selectedColor = ''
|
|
|
|
|
|
|
|
|
|
before(function() {
|
|
|
|
|
// Just in case previous test failed
|
|
|
|
|
cy.resetAdminTheming()
|
|
|
|
@ -63,7 +61,7 @@ describe('Change the primary colour and reset it', function() {
|
|
|
|
|
cy.get('[data-admin-theming-settings]').scrollIntoView().should('be.visible')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('Change the primary colour', function() {
|
|
|
|
|
it('Change the primary color', function() {
|
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('setColor')
|
|
|
|
|
|
|
|
|
|
pickRandomColor('[data-admin-theming-setting-primary-color-picker]')
|
|
|
|
@ -73,18 +71,18 @@ describe('Change the primary colour and reset it', function() {
|
|
|
|
|
cy.waitUntil(() => validateBodyThemingCss(selectedColor, defaultBackground))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('Screenshot the login page', function() {
|
|
|
|
|
it('Screenshot the login page and validate login page', function() {
|
|
|
|
|
cy.logout()
|
|
|
|
|
cy.visit('/')
|
|
|
|
|
|
|
|
|
|
cy.waitUntil(() => validateBodyThemingCss(selectedColor, defaultBackground))
|
|
|
|
|
cy.screenshot()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('Undo theming settings', function() {
|
|
|
|
|
it('Undo theming settings and validate login page again', function() {
|
|
|
|
|
cy.resetAdminTheming()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('Screenshot the login page', function() {
|
|
|
|
|
cy.visit('/')
|
|
|
|
|
|
|
|
|
|
cy.waitUntil(validateBodyThemingCss)
|
|
|
|
|
cy.screenshot()
|
|
|
|
|
})
|
|
|
|
@ -108,26 +106,74 @@ describe('Remove the default background and restore it', function() {
|
|
|
|
|
cy.get('[data-admin-theming-setting-file-remove]').click()
|
|
|
|
|
|
|
|
|
|
cy.wait('@removeBackground')
|
|
|
|
|
cy.waitUntil(() => validateBodyThemingCss(defaultPrimary, null))
|
|
|
|
|
cy.waitUntil(() => cy.window().then((win) => {
|
|
|
|
|
const currentBackgroundDefault = getComputedStyle(win.document.body).getPropertyValue('--image-background-default')
|
|
|
|
|
const backgroundPlain = getComputedStyle(win.document.body).getPropertyValue('--image-background-plain')
|
|
|
|
|
return !currentBackgroundDefault.includes(defaultBackground)
|
|
|
|
|
&& backgroundPlain !== ''
|
|
|
|
|
return backgroundPlain !== ''
|
|
|
|
|
}))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('Screenshot the login page', function() {
|
|
|
|
|
it('Screenshot the login page and validate login page', function() {
|
|
|
|
|
cy.logout()
|
|
|
|
|
cy.visit('/')
|
|
|
|
|
|
|
|
|
|
cy.waitUntil(() => validateBodyThemingCss(defaultPrimary, null))
|
|
|
|
|
cy.screenshot()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('Undo theming settings', function() {
|
|
|
|
|
it('Undo theming settings and validate login page again', function() {
|
|
|
|
|
cy.resetAdminTheming()
|
|
|
|
|
cy.visit('/')
|
|
|
|
|
|
|
|
|
|
cy.waitUntil(validateBodyThemingCss)
|
|
|
|
|
cy.screenshot()
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
describe('Remove the default background with a custom primary color', function() {
|
|
|
|
|
let selectedColor = ''
|
|
|
|
|
|
|
|
|
|
before(function() {
|
|
|
|
|
// Just in case previous test failed
|
|
|
|
|
cy.resetAdminTheming()
|
|
|
|
|
cy.login(admin)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('See the admin theming section', function() {
|
|
|
|
|
cy.visit('/settings/admin/theming')
|
|
|
|
|
cy.get('[data-admin-theming-settings]').scrollIntoView().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)
|
|
|
|
|
|
|
|
|
|
cy.wait('@setColor')
|
|
|
|
|
cy.waitUntil(() => validateBodyThemingCss(selectedColor, defaultBackground))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('Remove the default background', function() {
|
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('removeBackground')
|
|
|
|
|
|
|
|
|
|
cy.get('[data-admin-theming-setting-file-remove]').click()
|
|
|
|
|
|
|
|
|
|
cy.wait('@removeBackground')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('Screenshot the login page and validate login page', function() {
|
|
|
|
|
cy.logout()
|
|
|
|
|
cy.visit('/')
|
|
|
|
|
|
|
|
|
|
cy.waitUntil(() => validateBodyThemingCss(selectedColor, null))
|
|
|
|
|
cy.screenshot()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('Screenshot the login page', function() {
|
|
|
|
|
it('Undo theming settings and validate login page again', function() {
|
|
|
|
|
cy.resetAdminTheming()
|
|
|
|
|
cy.visit('/')
|
|
|
|
|
|
|
|
|
|
cy.waitUntil(validateBodyThemingCss)
|
|
|
|
|
cy.screenshot()
|
|
|
|
|
})
|
|
|
|
@ -154,7 +200,7 @@ describe('Remove the default background with a bright color', function() {
|
|
|
|
|
cy.wait('@removeBackground')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('Change the primary colour', function() {
|
|
|
|
|
it('Change the primary color', function() {
|
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('setColor')
|
|
|
|
|
|
|
|
|
|
// Pick one of the bright color preset
|
|
|
|
@ -162,7 +208,7 @@ describe('Remove the default background with a bright color', function() {
|
|
|
|
|
cy.get('.color-picker__simple-color-circle:eq(4)').click()
|
|
|
|
|
|
|
|
|
|
cy.wait('@setColor')
|
|
|
|
|
cy.waitUntil(() => validateBodyThemingCss('#ddcb55', ''))
|
|
|
|
|
cy.waitUntil(() => validateBodyThemingCss('#ddcb55', null))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('See the header being inverted', function() {
|
|
|
|
@ -229,7 +275,7 @@ describe('Change the login fields then reset them', function() {
|
|
|
|
|
.scrollIntoView().should('be.visible')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('Check login screen changes', function() {
|
|
|
|
|
it('Validate login screen changes', function() {
|
|
|
|
|
cy.logout()
|
|
|
|
|
cy.visit('/')
|
|
|
|
|
|
|
|
|
@ -243,7 +289,7 @@ describe('Change the login fields then reset them', function() {
|
|
|
|
|
cy.resetAdminTheming()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('Check login screen changes', function() {
|
|
|
|
|
it('Validate login screen changes again', function() {
|
|
|
|
|
cy.visit('/')
|
|
|
|
|
|
|
|
|
|
cy.get('[data-login-form-headline]').should('not.contain.text', name)
|
|
|
|
@ -265,7 +311,7 @@ describe('Disable user theming and enable it back', function() {
|
|
|
|
|
cy.get('[data-admin-theming-settings]').scrollIntoView().should('be.visible')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('Disable user theming', function() {
|
|
|
|
|
it('Disable user background theming', function() {
|
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('disableUserTheming')
|
|
|
|
|
|
|
|
|
|
cy.get('[data-admin-theming-setting-disable-user-theming]')
|
|
|
|
@ -283,13 +329,13 @@ describe('Disable user theming and enable it back', function() {
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('See the user disabled background settings', function() {
|
|
|
|
|
it('User cannot not change background settings', function() {
|
|
|
|
|
cy.visit('/settings/user/theming')
|
|
|
|
|
cy.get('[data-user-theming-background-disabled]').scrollIntoView().should('be.visible')
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
describe('User default option matches admin theming', function() {
|
|
|
|
|
describe('The user default background settings reflect the admin theming settings', function() {
|
|
|
|
|
let selectedColor = ''
|
|
|
|
|
|
|
|
|
|
before(function() {
|
|
|
|
@ -307,7 +353,7 @@ describe('User default option matches admin theming', function() {
|
|
|
|
|
cy.get('[data-admin-theming-settings]').scrollIntoView().should('be.visible')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('Change the primary colour', function() {
|
|
|
|
|
it('Change the primary color', function() {
|
|
|
|
|
cy.intercept('*/apps/theming/ajax/updateStylesheet').as('setColor')
|
|
|
|
|
|
|
|
|
|
pickRandomColor('[data-admin-theming-setting-primary-color-picker]')
|
|
|
|
@ -333,7 +379,7 @@ describe('User default option matches admin theming', function() {
|
|
|
|
|
}))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('Logout and check changes', function() {
|
|
|
|
|
it('Login page should match admin theming settings', function() {
|
|
|
|
|
cy.logout()
|
|
|
|
|
cy.visit('/')
|
|
|
|
|
|
|
|
|
@ -351,10 +397,61 @@ describe('User default option matches admin theming', function() {
|
|
|
|
|
cy.get('[data-user-theming-background-settings]').scrollIntoView().should('be.visible')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('See the default background option selected', function() {
|
|
|
|
|
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='))
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
describe('The user default background settings reflect the admin theming settings with background removed', function() {
|
|
|
|
|
before(function() {
|
|
|
|
|
// Just in case previous test failed
|
|
|
|
|
cy.resetAdminTheming()
|
|
|
|
|
cy.login(admin)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
after(function() {
|
|
|
|
|
cy.resetAdminTheming()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('See the admin theming section', function() {
|
|
|
|
|
cy.visit('/settings/admin/theming')
|
|
|
|
|
cy.get('[data-admin-theming-settings]').scrollIntoView().should('be.visible')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('Remove the default background', function() {
|
|
|
|
|
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))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('Login page should match admin theming settings', function() {
|
|
|
|
|
cy.logout()
|
|
|
|
|
cy.visit('/')
|
|
|
|
|
|
|
|
|
|
cy.waitUntil(() => validateBodyThemingCss(defaultPrimary, null))
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('Login as user', function() {
|
|
|
|
|
cy.createRandomUser().then((user) => {
|
|
|
|
|
cy.login(user)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('See the user background settings', function() {
|
|
|
|
|
cy.visit('/settings/user/theming')
|
|
|
|
|
cy.get('[data-user-theming-background-settings]').scrollIntoView().should('be.visible')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
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(defaultPrimary, null))
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|