diff --git a/.github/workflows/cypress new ui.yml b/.github/workflows/cypress new ui.yml index 43aebdce..a036b01d 100644 --- a/.github/workflows/cypress new ui.yml +++ b/.github/workflows/cypress new ui.yml @@ -4,186 +4,50 @@ on: workflow_dispatch: jobs: - csv-add-affiliations: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: "Create creds json" - id: create-creds-json - uses: jsdaniell/create-json@v1.2.3 - with: - name: "credentials.json" - json: '{"adminEmail": "${{secrets.CY_ADMIN_EMAIL}}", "adminPassword": "${{secrets.CY_ADMIN_PASSWORD}}", "password": "${{secrets.CY_PASSWORD}}", "shortPassword": "${{secrets.CY_SHORT_PASSWORD}}", "shortConfirmationPassword": "${{secrets.CY_SHORT_CONFIRMATION_PASSWORD}}", "wrongConfirmationPasssword": "${{secrets.CY_WRONG_CONFIRMATION_PASSWORD}}"}' - dir: "ui/cypress/fixtures" - - name: "Create Gmail creds json" - id: create-gmail-creds-file - uses: jsdaniell/create-json@v1.2.3 - with: - name: "credentials_qa.json" - json: '{"installed":{"client_id":"${{secrets.CY_CREDS_CLIENT_ID}}","project_id":"${{secrets.CY_CREDS_PROJECT_ID}}","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"${{secrets.CY_CREDS_CLIENT_SECRET}}","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}' - dir: "ui/cypress/plugins" - - name: "Create Gmail token json" - id: create-gmail-token-file - uses: jsdaniell/create-json@v1.2.3 - with: - name: "token_qa.json" - json: '{"access_token":"${{secrets.CY_TOKEN_ACCESS}}","refresh_token":"${{secrets.CY_TOKEN_REFRESH}}","scope":"https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/gmail.send","token_type":"Bearer","expiry_date":${{secrets.CY_TOKEN_EXPIRY_DATE}}}' - dir: "ui/cypress/plugins" - - name: Cypress run - uses: cypress-io/github-action@v6 - with: - install-command: npm install cypress --legacy-peer-deps - working-directory: ui - spec: cypress/e2e/retention/csv-add-affiliations.cy.js - - uses: actions/upload-artifact@v4 - if: failure() - with: - name: "cypress-screenshots-${{ github.job }}" - path: ui/cypress/screenshots - - uses: actions/upload-artifact@v4 - if: failure() - with: - name: "cypress-videos-${{ github.job }}" - path: ui/cypress/videos + test_e2e_cypress: + strategy: + matrix: + include: + - name: csv-add-affiliations + spec: + - cypress/e2e/retention/csv-add-affiliations.cy.js - csv-edit-affiliations: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: "Create creds json" - id: create-creds-json - uses: jsdaniell/create-json@v1.2.3 - with: - name: "credentials.json" - json: '{"adminEmail": "${{secrets.CY_ADMIN_EMAIL}}", "adminPassword": "${{secrets.CY_ADMIN_PASSWORD}}", "password": "${{secrets.CY_PASSWORD}}", "shortPassword": "${{secrets.CY_SHORT_PASSWORD}}", "shortConfirmationPassword": "${{secrets.CY_SHORT_CONFIRMATION_PASSWORD}}", "wrongConfirmationPasssword": "${{secrets.CY_WRONG_CONFIRMATION_PASSWORD}}"}' - dir: "ui/cypress/fixtures" - - name: "Create Gmail creds json" - id: create-gmail-creds-file - uses: jsdaniell/create-json@v1.2.3 - with: - name: "credentials_qa.json" - json: '{"installed":{"client_id":"${{secrets.CY_CREDS_CLIENT_ID}}","project_id":"${{secrets.CY_CREDS_PROJECT_ID}}","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"${{secrets.CY_CREDS_CLIENT_SECRET}}","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}' - dir: "ui/cypress/plugins" - - name: "Create Gmail token json" - id: create-gmail-token-file - uses: jsdaniell/create-json@v1.2.3 - with: - name: "token_qa.json" - json: '{"access_token":"${{secrets.CY_TOKEN_ACCESS}}","refresh_token":"${{secrets.CY_TOKEN_REFRESH}}","scope":"https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/gmail.send","token_type":"Bearer","expiry_date":${{secrets.CY_TOKEN_EXPIRY_DATE}}}' - dir: "ui/cypress/plugins" - - name: Cypress run - uses: cypress-io/github-action@v6 - with: - install-command: npm install cypress --legacy-peer-deps - working-directory: ui - spec: | - cypress/e2e/retention/csv-edit-affiliations.cy.js - - uses: actions/upload-artifact@v4 - if: failure() - with: - name: cypress-screenshots - path: ui/cypress/screenshots - - uses: actions/upload-artifact@v4 - if: failure() - with: - name: cypress-videos - path: ui/cypress/videos + - name: csv-edit-affiliations + spec: + - cypress/e2e/retention/csv-edit-affiliations.cy.js - add-affiliation: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: "Create creds json" - id: create-creds-json - uses: jsdaniell/create-json@v1.2.3 - with: - name: "credentials.json" - json: '{"adminEmail": "${{secrets.CY_ADMIN_EMAIL}}", "adminPassword": "${{secrets.CY_ADMIN_PASSWORD}}", "password": "${{secrets.CY_PASSWORD}}", "shortPassword": "${{secrets.CY_SHORT_PASSWORD}}", "shortConfirmationPassword": "${{secrets.CY_SHORT_CONFIRMATION_PASSWORD}}", "wrongConfirmationPasssword": "${{secrets.CY_WRONG_CONFIRMATION_PASSWORD}}"}' - dir: "ui/cypress/fixtures" - - name: "Create Gmail creds json" - id: create-gmail-creds-file - uses: jsdaniell/create-json@v1.2.3 - with: - name: "credentials_qa.json" - json: '{"installed":{"client_id":"${{secrets.CY_CREDS_CLIENT_ID}}","project_id":"${{secrets.CY_CREDS_PROJECT_ID}}","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"${{secrets.CY_CREDS_CLIENT_SECRET}}","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}' - dir: "ui/cypress/plugins" - - name: "Create Gmail token json" - id: create-gmail-token-file - uses: jsdaniell/create-json@v1.2.3 - with: - name: "token_qa.json" - json: '{"access_token":"${{secrets.CY_TOKEN_ACCESS}}","refresh_token":"${{secrets.CY_TOKEN_REFRESH}}","scope":"https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/gmail.send","token_type":"Bearer","expiry_date":${{secrets.CY_TOKEN_EXPIRY_DATE}}}' - dir: "ui/cypress/plugins" - - name: Cypress run - uses: cypress-io/github-action@v6 - with: - install-command: npm install cypress --legacy-peer-deps - working-directory: ui - spec: | - cypress/e2e/retention/add-affiliation.cy.js - - uses: actions/upload-artifact@v4 - if: failure() - with: - name: cypress-screenshots - path: ui/cypress/screenshots - - uses: actions/upload-artifact@v4 - if: failure() - with: - name: cypress-videos - path: ui/cypress/videos + - name: add-affiliation + spec: + - cypress/e2e/retention/add-affiliation.cy.js - notifications: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: "Create creds json" - id: create-creds-json - uses: jsdaniell/create-json@v1.2.3 - with: - name: "credentials.json" - json: '{"adminEmail": "${{secrets.CY_ADMIN_EMAIL}}", "adminPassword": "${{secrets.CY_ADMIN_PASSWORD}}", "password": "${{secrets.CY_PASSWORD}}", "shortPassword": "${{secrets.CY_SHORT_PASSWORD}}", "shortConfirmationPassword": "${{secrets.CY_SHORT_CONFIRMATION_PASSWORD}}", "wrongConfirmationPasssword": "${{secrets.CY_WRONG_CONFIRMATION_PASSWORD}}"}' - dir: "ui/cypress/fixtures" - - name: "Create Gmail creds json" - id: create-gmail-creds-file - uses: jsdaniell/create-json@v1.2.3 - with: - name: "credentials_qa.json" - json: '{"installed":{"client_id":"${{secrets.CY_CREDS_CLIENT_ID}}","project_id":"${{secrets.CY_CREDS_PROJECT_ID}}","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"${{secrets.CY_CREDS_CLIENT_SECRET}}","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}' - dir: "ui/cypress/plugins" - - name: "Create Gmail token json" - id: create-gmail-token-file - uses: jsdaniell/create-json@v1.2.3 - with: - name: "token_qa.json" - json: '{"access_token":"${{secrets.CY_TOKEN_ACCESS}}","refresh_token":"${{secrets.CY_TOKEN_REFRESH}}","scope":"https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/gmail.send","token_type":"Bearer","expiry_date":${{secrets.CY_TOKEN_EXPIRY_DATE}}}' - dir: "ui/cypress/plugins" - - name: Cypress run - uses: cypress-io/github-action@v6 - with: - install-command: npm install cypress --legacy-peer-deps - working-directory: ui - spec: | - cypress/e2e/retention/notifications.cy.js - - uses: actions/upload-artifact@v4 - if: failure() - with: - name: cypress-screenshots - path: ui/cypress/screenshots - - uses: actions/upload-artifact@v4 - if: failure() - with: - name: cypress-videos - path: ui/cypress/videos + - name: notifications + spec: + - cypress/e2e/retention/notifications.cy.js + + - name: other-tests: + spec: + - cypress/e2e/retention/add-member.cy.js + - cypress/e2e/retention/add-user.cy.js + - cypress/e2e/retention/csv-invalid-affiliation.cy.js + - cypress/e2e/retention/edit-affiliation.cy.js + - cypress/e2e/retention/edit-member.cy.js + - cypress/e2e/retention/edit-user.cy.js + - cypress/e2e/retention/reset-password.cy.js + - cypress/e2e/retention/restricted-access.cy.js + - cypress/e2e/retention/ui-authorities.cy.js + - cypress/e2e/retention/ui-login.cy.js + - cypress/e2e/retention/ui-pagination.cy.js + - cypress/e2e/retention/ui-homepage.cy.js + - cypress/e2e/retention/ui-homepage-edit.cy.js + - cypress/e2e/retention/ui-reports.cy.js + +################################################################################################### - other-tests: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 + - name: "Create creds json" id: create-creds-json uses: jsdaniell/create-json@v1.2.3 @@ -191,6 +55,7 @@ jobs: name: "credentials.json" json: '{"adminEmail": "${{secrets.CY_ADMIN_EMAIL}}", "adminPassword": "${{secrets.CY_ADMIN_PASSWORD}}", "password": "${{secrets.CY_PASSWORD}}", "shortPassword": "${{secrets.CY_SHORT_PASSWORD}}", "shortConfirmationPassword": "${{secrets.CY_SHORT_CONFIRMATION_PASSWORD}}", "wrongConfirmationPasssword": "${{secrets.CY_WRONG_CONFIRMATION_PASSWORD}}"}' dir: "ui/cypress/fixtures" + - name: "Create Gmail creds json" id: create-gmail-creds-file uses: jsdaniell/create-json@v1.2.3 @@ -198,6 +63,7 @@ jobs: name: "credentials_qa.json" json: '{"installed":{"client_id":"${{secrets.CY_CREDS_CLIENT_ID}}","project_id":"${{secrets.CY_CREDS_PROJECT_ID}}","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://oauth2.googleapis.com/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"${{secrets.CY_CREDS_CLIENT_SECRET}}","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}' dir: "ui/cypress/plugins" + - name: "Create Gmail token json" id: create-gmail-token-file uses: jsdaniell/create-json@v1.2.3 @@ -205,33 +71,28 @@ jobs: name: "token_qa.json" json: '{"access_token":"${{secrets.CY_TOKEN_ACCESS}}","refresh_token":"${{secrets.CY_TOKEN_REFRESH}}","scope":"https://www.googleapis.com/auth/gmail.readonly https://www.googleapis.com/auth/gmail.send","token_type":"Bearer","expiry_date":${{secrets.CY_TOKEN_EXPIRY_DATE}}}' dir: "ui/cypress/plugins" + +########################################################################################################## + - name: Cypress run uses: cypress-io/github-action@v6 with: install-command: npm install cypress --legacy-peer-deps working-directory: ui spec: | - cypress/e2e/retention/add-member.cy.js - cypress/e2e/retention/add-user.cy.js - cypress/e2e/retention/csv-invalid-affiliation.cy.js - cypress/e2e/retention/edit-affiliation.cy.js - cypress/e2e/retention/edit-member.cy.js - cypress/e2e/retention/edit-user.cy.js - cypress/e2e/retention/reset-password.cy.js - cypress/e2e/retention/restricted-access.cy.js - cypress/e2e/retention/ui-authorities.cy.js - cypress/e2e/retention/ui-login.cy.js - cypress/e2e/retention/ui-pagination.cy.js - cypress/e2e/retention/ui-homepage.cy.js - cypress/e2e/retention/ui-homepage-edit.cy.js - cypress/e2e/retention/ui-reports.cy.js + ${{ matrix.spec }} + + # upload our cypress output results but only if the cypress tests failed + # NOTE: artifacts must have unique names - uses: actions/upload-artifact@v4 if: failure() with: - name: cypress-screenshots + name: "cypress-screenshots-${{ github.job }}" path: ui/cypress/screenshots + - uses: actions/upload-artifact@v4 if: failure() with: - name: cypress-videos + name: "cypress-videos-${{ github.job }}" path: ui/cypress/videos +