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

feat: remove store #461

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
0c28be5
test(cypress): update to cypress 12
Mar 7, 2023
0f88c6d
style(eslint): suppress linting error
Mar 8, 2023
a04ee32
ci(e2e): test against debug
Mar 8, 2023
6949db2
test(cypress): use local backend
Mar 8, 2023
4458be2
ci(cypress): use parallel runs
Mar 13, 2023
515c2c5
test(cypress): remove unused cypress config option
Mar 13, 2023
e2a13fc
test(cypress): add link to cypress preprocessor repo
Mar 13, 2023
a899b67
test(cypress): add explanatory comments to cypress support file
Mar 13, 2023
7e5e595
test(cypress): remove ignoring of uncaught exceptions
Mar 13, 2023
cf3cf63
chore: add job schedules hook
Mar 15, 2023
6a4e21f
chore: add missing translations
Mar 15, 2023
5ec4c9a
chore: use job schedules endpoint for home route
Mar 27, 2023
f3339c8
chore: add use job by id hook for edit route
Mar 27, 2023
9d27929
chore: add job hooks tests
Mar 27, 2023
3772095
chore: add use job by id hook for view route
Mar 27, 2023
37aac02
chore: align test with wording other tests
Mar 27, 2023
5f2ab30
test(cypress): update e2e fixtures
Mar 28, 2023
4d98b23
test(jest): fix jest tests
Mar 29, 2023
8316312
refactor: remove containers
Mar 29, 2023
beb039c
chore: initial replacement of store
Apr 5, 2023
169b1cf
chore: add spinner
Apr 5, 2023
b441aa5
chore: fix hooks
Apr 5, 2023
b2e5263
chore: fix hook tests
Apr 5, 2023
ddf022a
chore: fix linting errors
Apr 5, 2023
de00c30
test(jest): fix parameter fields test
Apr 12, 2023
99643bc
test(jest): fix schedule field test
Apr 12, 2023
9e884c1
refactor: pass refetch to runjobmodal instead of using hook
Apr 12, 2023
92de2c3
test(jest): fix actions test
Apr 12, 2023
fadee96
test(jest): fix runjobaction test
Apr 12, 2023
9d5a3a5
test(jest): fix jobtable test
Apr 12, 2023
7d19b24
test(jest): fix jobtablerow test
Apr 12, 2023
61b35bf
test(jest): fix labeledoptionsfield test
Apr 17, 2023
768c7c7
test(jest): fix skiptabletypesfield test
Apr 17, 2023
fc29211
test(jest): fix jobtypefield test
Apr 17, 2023
aab288f
test(jest): fix deletejobaction test
Apr 17, 2023
0f7f4ee
test(jest): fix jobeditformcontainer test
Apr 17, 2023
31872dc
style(eslint): remove unused store context export
Apr 17, 2023
3990310
refactor: add data fetching states to JobTypeField
Apr 18, 2023
2aa14ef
refactor: add data fetching states to form fields
Apr 18, 2023
08bba52
refactor: pass refetch to togglejobswitch instead of using hook
Apr 19, 2023
10fb260
refactor: handle malformed data for job schedules
Apr 24, 2023
4f122d2
test(jest): fix async tests
Apr 25, 2023
33bdffb
test(cypress): ensure job types have loaded before clicking
Apr 25, 2023
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
14 changes: 7 additions & 7 deletions .github/workflows/dhis2-verify-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,19 @@ jobs:
with:
node-version: 16
- name: End-to-End tests
uses: cypress-io/github-action@v2
uses: cypress-io/github-action@v5
with:
start: yarn start:nobrowser
wait-on: 'http://localhost:3000'
wait-on-timeout: 300
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

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
Expand Up @@ -2,6 +2,7 @@ Feature: Users should be able to insert cron presets

Scenario: User inserts a cron preset
Given the user navigated to the add job page
And the job types have loaded
And the user selects a cron scheduled job type
When the user clicks the choose from preset times button
And selects a cron preset from the modal
Expand All @@ -10,6 +11,7 @@ Feature: Users should be able to insert cron presets

Scenario: User cancels inserting a cron preset
Given the user navigated to the add job page
And the job types have loaded
And the user selects a cron scheduled job type
When the user clicks the choose from preset times button
And selects a cron preset from the modal
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
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')
cy.findByRole('heading', { name: 'New Job' }).should('exist')
})

Given('the job types have loaded', () => {
cy.get('[data-test="dhis2-uicore-select-input"]').should(
'not.have.class',
'disabled'
)
})

Given('the user selects a cron scheduled job type', () => {
cy.get('[data-test="dhis2-uicore-select-input"]').click()
cy.findByText('Data integrity').click()
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,15 +1,15 @@
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(
{ pathname: /jobConfigurations$/ },
{ pathname: /scheduler$/ },
{ fixture: 'list-route/some-user-jobs' }
)
})

Given('some user and system jobs exist', () => {
cy.intercept(
{ pathname: /jobConfigurations$/ },
{ pathname: /scheduler$/ },
{ fixture: 'list-route/some-user-and-system-jobs' }
)
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
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(
{ pathname: /jobConfigurations$/ },
{ pathname: /scheduler$/ },
{ fixture: 'list-route/some-user-jobs' }
)
})

Given('some user and system jobs exist', () => {
cy.intercept(
{ pathname: /jobConfigurations$/ },
{ pathname: /scheduler$/ },
{ fixture: 'list-route/some-user-and-system-jobs' }
)
})
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
Expand Up @@ -4,12 +4,12 @@ Feature: User jobs can be enabled and disabled
Given a disabled user job exists
And the user navigated to the job list page
And the job toggle switch is off
When the user clicks the job toggle switch
When the user clicks the disabled job toggle switch
Then the job toggle switch is on

Scenario: The user disables a user job
Given an enabled user job exists
And the user navigated to the job list page
And the job toggle switch is on
When the user clicks the job toggle switch
When the user clicks the enabled job toggle switch
Then the job toggle switch is off
48 changes: 48 additions & 0 deletions cypress/e2e/list-route/job-toggle/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { Given, When, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('a disabled user job exists', () => {
cy.intercept(
{ pathname: /scheduler$/ },
{ fixture: 'list-route/disabled-user-job' }
)
})

Given('an enabled user job exists', () => {
cy.intercept(
{ pathname: /scheduler$/ },
{ fixture: 'list-route/enabled-user-job' }
)
})

Given('the user navigated to the job list page', () => {
cy.visit('/')
cy.findByRole('heading', { name: 'Scheduled jobs' }).should('exist')
})

Given('the job toggle switch is off', () => {
cy.findByRole('switch', { name: 'Toggle job' }).should('not.be.checked')
})

When('the user clicks the enabled job toggle switch', () => {
cy.intercept({ pathname: /lnWRZN67iDU$/ }, { statusCode: 204 })
cy.intercept(
{ pathname: /scheduler$/ },
{ fixture: 'list-route/disabled-user-job' }
)

cy.findByRole('switch', { name: 'Toggle job' }).click()
})

When('the user clicks the disabled job toggle switch', () => {
cy.intercept({ pathname: /lnWRZN67iDU$/ }, { statusCode: 204 })
cy.intercept(
{ pathname: /scheduler$/ },
{ fixture: 'list-route/enabled-user-job' }
)

cy.findByRole('switch', { name: 'Toggle job' }).click()
})

Then('the job toggle switch is on', () => {
cy.findByRole('switch', { name: 'Toggle job' }).should('be.checked')
})
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { Given, Then } from 'cypress-cucumber-preprocessor/steps'
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'

Given('there are no user jobs', () => {
cy.intercept(
{ pathname: /jobConfigurations$/ },
{ fixture: 'list-route/no-jobs' }
)
cy.intercept({ pathname: /scheduler$/ }, { fixture: 'list-route/no-jobs' })
})

Given('some user jobs exist', () => {
cy.intercept(
{ pathname: /jobConfigurations$/ },
{ pathname: /scheduler$/ },
{ fixture: 'list-route/some-user-jobs' }
)
})
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,10 +1,15 @@
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(
{ pathname: /jobConfigurations$/ },
{ pathname: /scheduler$/ },
{ fixture: 'list-route/single-system-job' }
)

cy.intercept(
{ pathname: /jobConfigurations$/ },
{ fixture: 'list-route/single-system-job-job-configurations' }
)
})

Given('the user navigated to the job list page', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
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(
{ pathname: /jobConfigurations$/ },
{ pathname: /scheduler$/ },
{ fixture: 'list-route/single-user-job' }
)

cy.intercept(
{ pathname: /jobConfigurations$/ },
{ fixture: 'list-route/single-user-job-job-configurations' }
)
})

Given('the user navigated to the job list page', () => {
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
Loading