Skip to content

Commit

Permalink
setup cypress for e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mburri committed Nov 10, 2023
1 parent 597db21 commit b0e84d4
Show file tree
Hide file tree
Showing 9 changed files with 4,130 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: run e2e tests

on:
push:
branches: [ master, feature/cypress-e2e-tests ]
pull_request:
branches: [ master ]

jobs:
build_and_test:
name: build and run e2e tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Cache node
uses: actions/cache@v2
with:
path: ~/.node
key: ${{ runner.os }}-node-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-node

- name: Setup chromedriver
uses: nanasess/setup-chromedriver@master

- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11

- name: Build docker image
run: cd AMW_e2e
npm install
npm run docker:build

- name: Run e2e tests
run: cd AMW_e2e
npm run test:ci
1 change: 1 addition & 0 deletions AMW_e2e/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
9 changes: 9 additions & 0 deletions AMW_e2e/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { defineConfig } = require("cypress");

module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
});
5 changes: 5 additions & 0 deletions AMW_e2e/cypress/e2e/logn.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe("login", () => {
it("should login with basic auth", () => {
cy.visit("http://admin:admin@localhost:8080/AMW_web");
});
})
5 changes: 5 additions & 0 deletions AMW_e2e/cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
25 changes: 25 additions & 0 deletions AMW_e2e/cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
20 changes: 20 additions & 0 deletions AMW_e2e/cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
Loading

0 comments on commit b0e84d4

Please sign in to comment.