-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aca3b84
commit cc5105e
Showing
7 changed files
with
30 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
|
||
# testing | ||
/coverage | ||
/cypress/debug | ||
|
||
# production | ||
/build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,22 @@ | ||
Cypress.Commands.add('login', (username, password) => { | ||
cy.visit('http://localhost:8081'); | ||
cy.get('input[placeholder*="Login ID"]').type('idtest0'); | ||
cy.get('input[placeholder*="Password"]').type('0000'); | ||
cy.get('button[type=submit]').click(); | ||
cy.get('[class=navbar-brand]').contains('MXCuBE'); | ||
}); | ||
|
||
describe('login', () => { | ||
it('cant login with invalid credentials', () => { | ||
cy.visit('http://localhost:8081'); | ||
cy.get('input[placeholder*="Login ID"]').type('idte0'); | ||
cy.get('input[placeholder*="Password"]').type('0000'); | ||
cy.get('button[type=submit]').click(); | ||
cy.get('pre*[class^="Login_error"]').should('be.visible'); | ||
it("can't login with invalid credentials", () => { | ||
cy.login('idte0', '0000'); | ||
cy.findByText('Could not authenticate').should('be.visible'); | ||
}); | ||
|
||
it('can login with valid credentials', () => { | ||
cy.visit('http://localhost:8081'); | ||
cy.get('input[placeholder*="Login ID"]').type('idtest0'); | ||
cy.get('input[placeholder*="Password"]').type('0000'); | ||
cy.get('button[type=submit]').click(); | ||
cy.get('[class=navbar-brand]').contains('MXCuBE'); | ||
cy.login(); | ||
cy.findByRole('link', { name: 'MXCuBE-Web (OSC)' }).should('be.visible'); | ||
}); | ||
}); | ||
|
||
describe('app', () => { | ||
beforeEach(() => { | ||
cy.login(); | ||
cy.findByRole('link', { name: 'MXCuBE-Web (OSC)' }).should('be.visible'); | ||
}); | ||
|
||
it('displays collection page', () => { | ||
cy.visit('http://localhost:8081'); | ||
cy.get('[class=navbar-brand]').contains('MXCuBE'); | ||
cy.findByRole('button', { name: /Beamline Actions/u }).should('be.visible'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import '@testing-library/cypress/add-commands'; | ||
|
||
Cypress.Commands.add('login', (username = 'idtest0', password = '0000') => { | ||
cy.visit('/'); | ||
cy.findByRole('heading', { name: 'MXCuBE' }).should('be.visible'); | ||
cy.findByLabelText('Login ID').type(username); | ||
cy.findByLabelText('Password').type(password); | ||
cy.findByRole('button', { name: 'Sign in' }).click(); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.