85 lines
2.5 KiB
JavaScript
85 lines
2.5 KiB
JavaScript
/// <reference types="cypress" />
|
|
|
|
import {email} from 'chance';
|
|
|
|
describe('sign up and sign in', () => {
|
|
it('redirects to rails app', () => {
|
|
cy.visit('/')
|
|
cy.contains('Signin to begin')
|
|
cy.contains('Please sign in to your jamkazam account')
|
|
cy.get('.btn').contains('Sign in').click()
|
|
//cy.visit(Cypress.env('baseUrl'))
|
|
//legacy app sign in page
|
|
cy.url().should('eq', `${Cypress.env('legacyBaseUrl')}/signin`)
|
|
//cy.get('a.show-signup-dialog').first().click()
|
|
//cy.get('a.signup-email').first().click()
|
|
//cy.url().should('eq', `${Cypress.env('legacyBaseUrl')}/signup`)
|
|
|
|
//legacy app sign up page
|
|
|
|
})
|
|
|
|
// it('signs up', () => {
|
|
// cy.visit(`${Cypress.env('legacyBaseUrl')}/signup`)
|
|
// cy.get('#jam_ruby_user_first_name').type('David')
|
|
// cy.get('#jam_ruby_user_last_name').type('Miller')
|
|
// cy.get('#jam_ruby_user_email').type(chance.email() )
|
|
// cy.get('#jam_ruby_user_password').type('jam123')
|
|
// cy.get('#jam_ruby_user_password_confirmation').type('jam123')
|
|
// cy.get('#jam_ruby_user_terms_of_service').check()
|
|
// cy.get('#create-account-submit').click()
|
|
// })
|
|
|
|
// it('access dashboard', () => {
|
|
// cy.visit(Cypress.env('baseUrl'))
|
|
// cy.contains('Dashboard')
|
|
// })
|
|
})
|
|
|
|
describe.only('Dashboard', () => {
|
|
before(() => {
|
|
cy.visit(`${Cypress.env('legacyBaseUrl')}/signin`)
|
|
cy.get('.signin-form').first().within(() => {
|
|
cy.get('#session_email').type('nuwan@jamkazam.com')
|
|
cy.get('#session_password').type('jam123')
|
|
cy.get('input.signin-submit').click()
|
|
})
|
|
})
|
|
|
|
beforeEach(() => {
|
|
// before each test, we can automatically preserve the
|
|
// 'session_id' and 'remember_token' cookies. this means they
|
|
// will not be cleared before the NEXT test starts.
|
|
//
|
|
// the name of your cookies will likely be different
|
|
// this is an example
|
|
Cypress.Cookies.preserveOnce('session_id', 'remember_token')
|
|
})
|
|
|
|
it('is on dashboard', () => {
|
|
cy.visit(Cypress.env('baseUrl'))
|
|
cy.contains('Dashboard')
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
// describe('with authenticated user', () => {
|
|
// beforeEach(() => {
|
|
// cy.visit(`${Cypress.env('legacyBaseUrl')}/signin`)
|
|
// cy.get('.signin-form').first().within(() => {
|
|
// cy.get('#session_email').type('nuwan@jamkazam.com')
|
|
// cy.get('#session_password').type('jam123')
|
|
// cy.get('input.signin-submit').click()
|
|
// })
|
|
// })
|
|
|
|
// it('user in legacy app', () => {
|
|
// cy.url().should('contain', 'client')
|
|
// cy.visit(Cypress.env('baseUrl'))
|
|
// cy.contains('Dashboard')
|
|
// })
|
|
// })
|
|
|