improve tests

This commit is contained in:
Nolan Lawson 2018-02-18 17:54:38 -08:00
parent 014f23887f
commit cad7f98e37
4 changed files with 6 additions and 0 deletions

View File

@ -1,6 +1,7 @@
describe('Basic spec', () => { describe('Basic spec', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('/') cy.visit('/')
cy.wait(500)
}) })
it('has the correct <h1>', () => { it('has the correct <h1>', () => {

View File

@ -1,6 +1,7 @@
describe('Login spec', () => { describe('Login spec', () => {
beforeEach(() => { beforeEach(() => {
cy.visit('/') cy.visit('/')
cy.wait(500)
}) })
it('Cannot log in to a fake instance', () => { it('Cannot log in to a fake instance', () => {
@ -24,6 +25,7 @@ describe('Login spec', () => {
it('Logs out', () => { it('Logs out', () => {
cy.login('foobar@localhost:3000', 'foobarfoobar') cy.login('foobar@localhost:3000', 'foobarfoobar')
cy.wait(500)
cy.get('nav a[aria-label=Settings]').click() cy.get('nav a[aria-label=Settings]').click()
cy.get('a').contains('Instances').click() cy.get('a').contains('Instances').click()
cy.get('a').contains('localhost:3000').click() cy.get('a').contains('localhost:3000').click()

View File

@ -4,6 +4,7 @@ describe('Basic timeline spec', () => {
beforeEach(() => { beforeEach(() => {
cy.login('foobar@localhost:3000', 'foobarfoobar') cy.login('foobar@localhost:3000', 'foobarfoobar')
cy.visit('/') cy.visit('/')
cy.wait(500)
}) })
const homeTimeline = [ const homeTimeline = [

View File

@ -33,8 +33,10 @@ Cypress.Commands.add('login', (email, password) => {
}) })
cy.visit('/settings/instances/add') cy.visit('/settings/instances/add')
cy.wait(500)
cy.get('#instanceInput').clear().type('localhost:3000') cy.get('#instanceInput').clear().type('localhost:3000')
cy.get('.add-new-instance').submit() cy.get('.add-new-instance').submit()
cy.wait(500)
cy.url().should('equal', 'http://localhost:3000/auth/sign_in') cy.url().should('equal', 'http://localhost:3000/auth/sign_in')
cy.get('input#user_email').should('exist') cy.get('input#user_email').should('exist')
cy.get('input#user_password').should('exist') cy.get('input#user_password').should('exist')