2021-10-22 18:47:32 +02:00
|
|
|
xcontext("Custom Theming Properties", () => {
|
2021-09-27 19:19:25 +02:00
|
|
|
before(() => {
|
|
|
|
cy.login()
|
|
|
|
cy.createTestApp()
|
|
|
|
cy.navigateToFrontend()
|
|
|
|
})
|
|
|
|
|
2021-10-15 18:36:10 +02:00
|
|
|
/* Default Values:
|
|
|
|
Button roundness = Large
|
|
|
|
Accent colour = Blue 600
|
|
|
|
Accent colour (hover) = Blue 500
|
|
|
|
Navigation bar background colour = Gray 100
|
|
|
|
Navigation bar text colour = Gray 800 */
|
2021-09-27 19:19:25 +02:00
|
|
|
it("should reset the color property values", () => {
|
|
|
|
// Open Theme modal and change colours
|
|
|
|
cy.get(".spectrum-ActionButton-label").contains("Theme").click()
|
|
|
|
cy.get(".spectrum-Picker").contains("Large").click()
|
|
|
|
.parents()
|
|
|
|
.get(".spectrum-Menu-itemLabel").contains("None").click()
|
|
|
|
changeThemeColors()
|
|
|
|
// Reset colours
|
|
|
|
cy.get(".spectrum-Button-label").contains("Reset").click({force: true})
|
|
|
|
// Check values have reset
|
|
|
|
checkThemeColorDefaults()
|
|
|
|
})
|
|
|
|
|
2021-10-15 18:36:10 +02:00
|
|
|
/* Button Roundness Values:
|
|
|
|
None = 0
|
|
|
|
Small = 4px
|
|
|
|
Medium = 8px
|
|
|
|
Large = 16px */
|
2021-10-21 19:50:09 +02:00
|
|
|
it("should test button roundness", () => {
|
2021-10-15 18:36:10 +02:00
|
|
|
const buttonRoundnessValues = ["0", "4px", "8px", "16px"]
|
|
|
|
cy.wait(1000)
|
|
|
|
// Add button, change roundness and confirm value
|
|
|
|
cy.addComponent("Button", null).then((componentId) => {
|
|
|
|
buttonRoundnessValues.forEach(function (item, index){
|
|
|
|
cy.get(".spectrum-ActionButton-label").contains("Theme").click()
|
|
|
|
cy.get(".setting").contains("Button roundness").parent()
|
|
|
|
.get(".select-wrapper").click()
|
|
|
|
cy.get(".spectrum-Popover").find('li').eq(index).click()
|
|
|
|
cy.get(".spectrum-Button").contains("View changes").click({force: true})
|
|
|
|
cy.reload()
|
|
|
|
cy.getComponent(componentId)
|
|
|
|
.parents(".svelte-xiqd1c").eq(0).should('have.attr', 'style').and('contains', `--buttonBorderRadius:${item}`)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2021-09-27 19:19:25 +02:00
|
|
|
const changeThemeColors = () => {
|
|
|
|
// Changes the theme colours
|
2021-10-11 15:51:24 +02:00
|
|
|
cy.get(".spectrum-FieldLabel").contains("Accent color")
|
2021-09-27 19:19:25 +02:00
|
|
|
.parent().find(".container.svelte-z3cm5a").click()
|
|
|
|
.find('[title="Red 400"]').click()
|
2021-10-11 15:51:24 +02:00
|
|
|
cy.get(".spectrum-FieldLabel").contains("Accent color (hover)")
|
2021-09-27 19:19:25 +02:00
|
|
|
.parent().find(".container.svelte-z3cm5a").click()
|
|
|
|
.find('[title="Orange 400"]').click()
|
|
|
|
cy.get(".spectrum-FieldLabel").contains("Navigation bar background color")
|
|
|
|
.parent().find(".container.svelte-z3cm5a").click()
|
|
|
|
.find('[title="Yellow 400"]').click()
|
|
|
|
cy.get(".spectrum-FieldLabel").contains("Navigation bar text color")
|
|
|
|
.parent().find(".container.svelte-z3cm5a").click()
|
|
|
|
.find('[title="Green 400"]').click()
|
|
|
|
}
|
|
|
|
|
|
|
|
const checkThemeColorDefaults = () => {
|
2021-10-11 15:51:24 +02:00
|
|
|
cy.get(".spectrum-FieldLabel").contains("Accent color")
|
2021-09-27 19:19:25 +02:00
|
|
|
.parent().find(".container.svelte-z3cm5a").click()
|
|
|
|
.get('[title="Blue 600"]').children().find('[aria-label="Checkmark"]')
|
|
|
|
cy.get(".spectrum-Dialog-grid").click()
|
2021-10-11 15:51:24 +02:00
|
|
|
cy.get(".spectrum-FieldLabel").contains("Accent color (hover)")
|
2021-09-27 19:19:25 +02:00
|
|
|
.parent().find(".container.svelte-z3cm5a").click()
|
|
|
|
.get('[title="Blue 500"]').children().find('[aria-label="Checkmark"]')
|
|
|
|
cy.get(".spectrum-Dialog-grid").click()
|
|
|
|
cy.get(".spectrum-FieldLabel").contains("Navigation bar background color")
|
|
|
|
.parent().find(".container.svelte-z3cm5a").click()
|
|
|
|
.get('[title="Gray 100"]').children().find('[aria-label="Checkmark"]')
|
|
|
|
cy.get(".spectrum-Dialog-grid").click()
|
|
|
|
cy.get(".spectrum-FieldLabel").contains("Navigation bar text color")
|
|
|
|
.parent().find(".container.svelte-z3cm5a").click()
|
|
|
|
.get('[title="Gray 800"]').children().find('[aria-label="Checkmark"]')
|
|
|
|
}
|
2022-01-19 16:19:02 +01:00
|
|
|
|
2021-09-30 14:52:20 +02:00
|
|
|
})
|