Cypress-IDs and prettier for tests (#1634)

* Add cy.getById method and run prettier

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
This commit is contained in:
Erik Michelson 2021-11-19 18:04:04 +01:00 committed by GitHub
parent 8a8bacc0aa
commit d725b65140
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 758 additions and 1203 deletions

View file

@ -13,58 +13,48 @@ describe('Intro page', () => {
describe('customizable content', () => {
it('fetches and shows the correct intro page content', () => {
cy.getMarkdownBody()
.contains('test content')
cy.getMarkdownBody().contains('test content')
})
it('won\'t show anything if no content was found', () => {
it("won't show anything if no content was found", () => {
cy.intercept('/mock-backend/public/intro.md', {
statusCode: 404
})
cy.visit('/')
cy.get(`iframe[data-cypress-id="documentIframe"]`)
.should('not.exist')
cy.getById('documentIframe').should('not.exist')
})
})
describe('features button', () => {
it('is hidden when logged in', () => {
cy.get('[data-cypress-id="features-button"]')
.should('not.exist')
cy.getById('features-button').should('not.exist')
})
it('is visible when logged out', () => {
cy.logout()
cy.get('[data-cypress-id="features-button"]')
.should('exist')
cy.getById('features-button').should('exist')
})
})
describe('sign in button', () => {
it('is hidden when logged in', () => {
cy.get('[data-cypress-id="sign-in-button"]')
.should('not.exist')
cy.getById('sign-in-button').should('not.exist')
})
it('is visible when logged out', () => {
cy.logout()
cy.get('[data-cypress-id="sign-in-button"]')
.should('exist')
cy.getById('sign-in-button').should('exist')
})
})
describe('version dialog', () => {
it('can be opened and closed', () => {
cy.get('[data-cypress-id="version-modal"]')
.should('not.exist')
cy.get('[data-cypress-id="show-version-modal"]')
.click()
cy.get('[data-cypress-id="version-modal"]')
.should('be.visible')
cy.get('[data-cypress-id="version-modal"] .modal-header .close')
.click()
cy.get('[data-cypress-id="version-modal"]')
.should('not.exist')
cy.getById('version-modal').should('not.exist')
cy.getById('show-version-modal').click()
cy.getById('version-modal').should('be.visible')
cy.getById('version-modal').find('.modal-header .close').click()
cy.getById('version-modal').should('not.exist')
})
})
})