Skip to content

Commit

Permalink
Add e2e tests for increase, decrease, and reset font size
Browse files Browse the repository at this point in the history
  • Loading branch information
kinow committed Apr 21, 2020
1 parent 8714b81 commit 2f174aa
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions tests/e2e/specs/userprofile.js
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -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())
})
})

0 comments on commit 2f174aa

Please sign in to comment.