Skip to content

Commit

Permalink
Added a few simple test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-oscarsson committed Sep 1, 2023
1 parent 044e10b commit 623bb2c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
36 changes: 32 additions & 4 deletions ui/cypress/e2e/app.cy.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,36 @@
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 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');
});
});

describe('app', () => {
it('loads the login page', () => {
beforeEach(() => {
cy.login();
});

it('displays collection page', () => {
cy.visit('http://localhost:8081');
cy.get('input[placeholder*="Login ID"]').should('be.visible');
cy.get('input[placeholder*="Password"]').should('be.visible');
cy.get('button[type=submit]').should('be.visible');
cy.get('[class=navbar-brand]').contains('MXCuBE');
});
});
9 changes: 9 additions & 0 deletions ui/cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@ import './commands';

// Alternatively you can use CommonJS syntax:
// require('./commands')
beforeEach(() => {
it('can login', () => {
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');
});
});

0 comments on commit 623bb2c

Please sign in to comment.