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

ci: update to shared workflows #412

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
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
12 changes: 12 additions & 0 deletions .github/workflows/comment-and-close.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: comment-and-close

on:
issues:
types: [opened]

jobs:
comment-and-close:
uses: dhis2/workflows-platform/.github/workflows/comment-and-close.yml@v1
if: '!contains(github.event.issue.sender.login , fromJson(''["dhis2-bot", "kodiakhq", "dependabot"]''))'
with:
issue_number: ${{ github.event.issue.number }}
14 changes: 14 additions & 0 deletions .github/workflows/deploy-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: deploy-pr

on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
deploy:
uses: dhis2/workflows-platform/.github/workflows/deploy-pr.yml@v1
if: '!github.event.pull_request.head.repo.fork'
secrets: inherit
17 changes: 17 additions & 0 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: deploy-production

on:
push:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
deploy:
uses: dhis2/workflows-platform/.github/workflows/deploy-production.yml@v1
secrets: inherit
with:
branch: master
135 changes: 0 additions & 135 deletions .github/workflows/dhis2-verify-app.yml

This file was deleted.

13 changes: 13 additions & 0 deletions .github/workflows/lint-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: lint-pr-title

on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
lint-pr-title:
uses: dhis2/workflows-platform/.github/workflows/lint-pr-title.yml@v1
27 changes: 27 additions & 0 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: test-and-release

on: push

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# Cancel previous runs if not on a release branch
cancel-in-progress: ${{ !contains(fromJSON('["refs/heads/master", "ref/heads/main"]'), github.ref) }}

jobs:
lint-commits:
uses: dhis2/workflows-platform/.github/workflows/lint-commits.yml@v1
lint:
uses: dhis2/workflows-platform/.github/workflows/lint.yml@v1
test:
uses: dhis2/workflows-platform/.github/workflows/test.yml@v1
e2e:
uses: dhis2/workflows-platform/.github/workflows/e2e.yml@v1
# Skips forks and dependabot PRs
if: '!github.event.push.repository.fork'
secrets: inherit
release:
needs: [lint-commits, lint, test, e2e]
uses: dhis2/workflows-platform/.github/workflows/release.yml@v1
# Skips forks and dependabot PRs
if: '!github.event.push.repository.fork'
secrets: inherit
5 changes: 5 additions & 0 deletions cypress.env.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"LOGIN_NAME": "login name here",
"LOGIN_PASSWORD": "password here",
"LOGIN_SERVER": "https://debug.dhis2.org/dev"
}
107 changes: 51 additions & 56 deletions cypress/e2e/dataElements/Edit.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
const saveAndExpect = (expected) => {
cy.intercept({ pathname: /dataElements/, method: 'PATCH' }, (req) => {
expect(req.body).to.deep.equal(expected)
req.reply({ statusCode: 200 })
})

cy.get('button:contains("Save and close")').click()
}

describe('Data elements / Edit', () => {
it('should change a value', () => {
const now = Date.now()

cy.visit('/')
cy.visit('/#/dataElements')

// Open data elements group in side nav
cy.get('[data-test="sidenav"] button:contains("Data elements")', {
timeout: 10000,
}).click()

// Navigate to data element list view
cy.get('[data-test="sidenav"] a:contains("Data element")')
.first() // the selector will also grab "Data element group" and "Data element group set"
.click()
// Wait for data elements to be loaded
cy.contains('ANC 1st visit', { timeout: 10000 })

// Go to Edit form
cy.get('[data-test="dhis2-uicore-tablebody"] tr:first-child')
Expand All @@ -28,52 +30,45 @@ describe('Data elements / Edit', () => {
.clear()
.type(`description ${now}`)

// Submit form
cy.get('button:contains("Save and close")').click()

cy.contains('Data element management').should('exist')

// Go to Edit form
cy.get('[data-test="dhis2-uicore-tablebody"] tr:first-child')
.find('td:last-child a')
.click()

cy.get('[data-test="formfields-description"] textarea').should(
'have.value',
`description ${now}`
)
saveAndExpect([
{
op: 'replace',
path: '/description',
value: `description ${now}`,
},
])
})

it('should not submit successfully when a required value has been removed', () => {
cy.visit('/')

// Open data elements group in side nav
cy.get('[data-test="sidenav"] button:contains("Data elements")', {
timeout: 10000,
}).click()

// Navigate to data element list view
cy.get('[data-test="sidenav"] a:contains("Data element")')
.first() // the selector will also grab "Data element group" and "Data element group set"
.click()

// Go to Edit form
cy.get('[data-test="dhis2-uicore-tablebody"] tr:first-child')
.find('td:last-child a')
.click()

cy.get('[data-test="formfields-name"] input').clear()

// Submit form
cy.get('button:contains("Save and close")').click()

// Assert error
cy.get('[data-test$="-validation"]:contains("Required")').should(
'have.length',
1
)
cy.get(
'[data-test="formfields-name-validation"]:contains("Required")'
).should('exist')
})
// it('should not submit successfully when a required value has been removed', () => {
// cy.visit('/')

// // Open data elements group in side nav
// cy.get('[data-test="sidenav"] button:contains("Data elements")', {
// timeout: 10000,
// }).click()

// // Navigate to data element list view
// cy.get('[data-test="sidenav"] a:contains("Data element")')
// .first() // the selector will also grab "Data element group" and "Data element group set"
// .click()

// // Go to Edit form
// cy.get('[data-test="dhis2-uicore-tablebody"] tr:first-child')
// .find('td:last-child a')
// .click()

// cy.get('[data-test="formfields-name"] input').clear()

// // Submit form
// cy.get('button:contains("Save and close")').click()

// // Assert error
// cy.get('[data-test$="-validation"]:contains("Required")').should(
// 'have.length',
// 1
// )
// cy.get(
// '[data-test="formfields-name-validation"]:contains("Required")'
// ).should('exist')
// })
})
Loading
Loading