Skip to content

Commit

Permalink
Fix E2E test
Browse files Browse the repository at this point in the history
  • Loading branch information
axelboc committed Jul 24, 2023
1 parent 59a6fba commit 12adc7d
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 54 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ npm-debug.log*
/supervisord.pid
log
mxcube3/static

# Cypress debug screenshots
/cypress/debug/
6 changes: 6 additions & 0 deletions ui/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,11 @@ module.exports = createConfig({
'jest/require-top-level-describe': 'off', // filename should already be meaningful, extra nesting is unnecessary
},
}),
{
files: ['**/*.cy.js'],
rules: {
'sonarjs/no-duplicate-string': 'off', // incompatible with Cypress testing syntax
},
},
],
});
8 changes: 5 additions & 3 deletions ui/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ const { defineConfig } = require('cypress');

module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
baseUrl: 'http://localhost:8081',
supportFile: 'cypress/support.js',
},
screenshotsFolder: 'cypress/debug',
fixturesFolder: false,
video: false,
});
11 changes: 7 additions & 4 deletions ui/cypress/e2e/app.cy.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
describe('app', () => {
beforeEach(() => {
cy.visit('/');
});

it('loads the login page', () => {
cy.visit('http://localhost:8081');
cy.get('input[placeholder*="LoginID"]').should('be.visible');
cy.get('input[placeholder*="Password"]').should('be.visible');
cy.get('button[type=submit]').should('be.visible');
cy.findByRole('textbox', { label: 'Login ID' }).should('be.visible');
cy.findByRole('textbox', { label: 'Password' }).should('be.visible');
cy.findByRole('button', { label: 'Sign in' }).should('be.visible');
});
});
1 change: 1 addition & 0 deletions ui/cypress/support.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@testing-library/cypress/add-commands';
27 changes: 0 additions & 27 deletions ui/cypress/support/commands.js

This file was deleted.

20 changes: 0 additions & 20 deletions ui/cypress/support/e2e.js

This file was deleted.

2 changes: 2 additions & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
"start": "GENERATE_SOURCEMAP=false react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"e2e": "cypress run",
"format": "npm run prettier -- --write",
"fix": "npm run eslint -- --fix",
"cypress": "cypress open --e2e --browser firefox",
"prettier": "prettier . --cache --check",
"eslint": "eslint \"**/*.{js,jsx}\""
},
Expand Down

0 comments on commit 12adc7d

Please sign in to comment.