diff --git a/tests/e2e/specs/userprofile.js b/tests/e2e/specs/userprofile.js index eda150b9f3..5c48b71298 100644 --- a/tests/e2e/specs/userprofile.js +++ b/tests/e2e/specs/userprofile.js @@ -1,3 +1,9 @@ +import { + getCurrentFontSize, + expectedFontSize, + INITIAL_FONT_SIZE +} from '@/utils/font-size' + describe('User Profile', () => { it('Visits the user profile', () => { cy.visit('/#/user-profile') @@ -9,4 +15,44 @@ describe('User Profile', () => { .should('be.visible') .should('be.disabled') }) + it('Increases the font size', () => { + cy.visit('/#/user-profile') + expect(INITIAL_FONT_SIZE).to.be.equal(getCurrentFontSize()) + const clicks = 3 + const expectedNewSize = expectedFontSize(true, clicks) + for (let i = 0; i < clicks; i++) { + cy + .get('#increase-font-size-button') + .click() + } + expect(expectedNewSize).to.be.equal(getCurrentFontSize()) + }) + it('Decreases the font size', () => { + cy.visit('/#/user-profile') + expect(INITIAL_FONT_SIZE).to.be.equal(getCurrentFontSize()) + const clicks = 3 + const expectedNewSize = expectedFontSize(false, clicks) + for (let i = 0; i < clicks; i++) { + cy + .get('#decrease-font-size-button') + .click() + } + expect(expectedNewSize).to.be.equal(getCurrentFontSize()) + }) + it('Resets the font size', () => { + cy.visit('/#/user-profile') + expect(INITIAL_FONT_SIZE).to.be.equal(getCurrentFontSize()) + const clicks = 3 + const expectedNewSize = expectedFontSize(false, clicks) + for (let i = 0; i < clicks; i++) { + cy + .get('#decrease-font-size-button') + .click() + } + expect(expectedNewSize).to.be.equal(getCurrentFontSize()) + cy + .get('#reset-font-size-button') + .click() + expect(INITIAL_FONT_SIZE).to.be.equal(getCurrentFontSize()) + }) })