Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(cypress): update to cypress 12 #484

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions .github/workflows/dhis2-verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,31 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16
- name: End-to-End tests
uses: cypress-io/github-action@v2
- uses: actions/cache/restore@v3
with:
start: yarn start:nobrowser
wait-on: 'http://localhost:3000'
wait-on-timeout: 300
path: /var/lib/docker/volumes/d2-cluster-240_datadb/
key: cache
- uses: cypress-io/github-action@v5
with:
start: npx --yes @dhis2/cli-cluster up 2.40 --channel dev --db-version 2.40 --seed, yarn start:nobrowser
wait-on: 'http://localhost:8080/dhis-web-commons/security/login.action, http://localhost:3000'
wait-on-timeout: 600
record: true
parallel: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_dhis2BaseUrl: http://localhost:8080
CYPRESS_dhis2ApiVersion: 40
CYPRESS_networkMode: stub
CYPRESS_LOGIN_NAME: ${{ secrets.CYPRESS_LOGIN_NAME }}
CYPRESS_LOGIN_PASSWORD: ${{ secrets.CYPRESS_LOGIN_PASSWORD }}
CYPRESS_LOGIN_SERVER: http://localhost:8080
- run: npx --yes @dhis2/cli-cluster down 2.40
- run: sudo ls -laR /var/lib/docker/volumes/d2-cluster-240_datadb/
- run: sudo chown -R $USER:$(id -g) /var/lib/docker/volumes/d2-cluster-240_datadb/ && sudo chmod -R ugo+rwx /var/lib/docker/volumes/d2-cluster-240_datadb/
- run: sudo ls -laR /var/lib/docker/volumes/d2-cluster-240_datadb/
- uses: actions/cache/save@v3
with:
path: /var/lib/docker/volumes/d2-cluster-240_datadb/
key: cache

release:
runs-on: ubuntu-latest
Expand Down
50 changes: 50 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// eslint-disable-next-line import/no-unused-modules
const { defineConfig } = require('cypress')
const webpack = require('@cypress/webpack-preprocessor')
const preprocessor = require('@badeball/cypress-cucumber-preprocessor')

/**
* Configuration for the cypress-cucumber preprocessing, see:
* https://github.com/badeball/cypress-cucumber-preprocessor/tree/master/examples/webpack-cjs
*/
async function setupNodeEvents(on, config) {
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
await preprocessor.addCucumberPreprocessorPlugin(on, config)

on(
'file:preprocessor',
webpack({
webpackOptions: {
resolve: {
extensions: ['.ts', '.js'],
},
module: {
rules: [
{
test: /\.feature$/,
use: [
{
loader: '@badeball/cypress-cucumber-preprocessor/webpack',
options: config,
},
],
},
],
},
},
})
)

// Make sure to return the config object as it might have been modified by the plugin.
return config
}

module.exports = defineConfig({
projectId: 'sc56ms',
video: false,
e2e: {
setupNodeEvents,
baseUrl: 'http://localhost:3000',
specPattern: 'cypress/e2e/**/*.feature',
},
})
6 changes: 3 additions & 3 deletions cypress.env.json.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"dhis2BaseUrl": "http://localhost:8080",
"dhis2Username": "USERNAME_HERE",
"dhis2Password": "PASSWORD_HERE"
"LOGIN_NAME": "login name here",
"LOGIN_PASSWORD": "password here",
"LOGIN_SERVER": "https://debug.dhis2.org/dev"
}
11 changes: 0 additions & 11 deletions cypress.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('the user navigated to the add job page', () => {
cy.visit('/#/add')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

/**
* Local helpers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

/**
* Local helpers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('the user navigated to the add job page', () => {
cy.visit('/#/add')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

const infoHref =
'https://docs.dhis2.org/en/use/user-guides/dhis-core-version-236/maintaining-the-system/scheduling.html'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('a single user job exists', () => {
cy.intercept(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('a single cron scheduled user job exists', () => {
cy.intercept(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('a single user job exists', () => {
cy.intercept(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('a single user job exists', () => {
cy.intercept(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

/**
* Local helpers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

/**
* Local helpers
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

const infoHref =
'https://docs.dhis2.org/en/use/user-guides/dhis-core-version-236/maintaining-the-system/scheduling.html'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('some user jobs exist', () => {
cy.intercept(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('some user jobs exist', () => {
cy.intercept(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

const infoHref =
'https://docs.dhis2.org/en/use/user-guides/dhis-core-version-236/maintaining-the-system/scheduling.html'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'

/**
* Currently cypress can't override earlier defined intercepts. This
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('there are no user jobs', () => {
cy.intercept(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('the user navigated to the job list page', () => {
cy.visit('/')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('a single system job exists', () => {
cy.intercept(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('a single user job exists', () => {
cy.intercept(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('an unauthorized user navigates to the app', () => {
cy.intercept(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('a single system job exists', () => {
cy.intercept(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('a single system job exists', () => {
cy.intercept(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

const infoHref =
'https://docs.dhis2.org/en/use/user-guides/dhis-core-version-236/maintaining-the-system/scheduling.html'
Expand Down

This file was deleted.

271 changes: 0 additions & 271 deletions cypress/fixtures/network/40/jobs_can_be_filtered.json

This file was deleted.

Loading
Loading