diff --git a/.github/workflows/cypress new ui.yml b/.github/workflows/cypress new ui.yml new file mode 100644 index 000000000..8859483c9 --- /dev/null +++ b/.github/workflows/cypress new ui.yml @@ -0,0 +1,233 @@ +name: Cypress end to end tests + +on: + workflow_dispatch: + +jobs: + csv-add-affiliations: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: "Create creds json" + id: create-creds-json + uses: jsdaniell/create-json@1.1.2 + 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@1.1.2 + 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@1.1.2 + 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@v2 + 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@v2 + if: failure() + with: + name: cypress-screenshots + path: ui/cypress/screenshots + - uses: actions/upload-artifact@v2 + if: failure() + with: + name: cypress-videos + path: ui/cypress/videos + csv-edit-affiliations: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: "Create creds json" + id: create-creds-json + uses: jsdaniell/create-json@1.1.2 + 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@1.1.2 + 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@1.1.2 + 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@v2 + 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@v2 + if: failure() + with: + name: cypress-screenshots + path: ui/cypress/screenshots + - uses: actions/upload-artifact@v2 + if: failure() + with: + name: cypress-videos + path: ui/cypress/videos + add-affiliation: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: "Create creds json" + id: create-creds-json + uses: jsdaniell/create-json@1.1.2 + 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@1.1.2 + 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@1.1.2 + 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@v2 + with: + install-command: npm install cypress --legacy-peer-deps + working-directory: ui + spec: | + cypress/e2e/retention/add-affiliation.cy.js + - uses: actions/upload-artifact@v2 + if: failure() + with: + name: cypress-screenshots + path: ui/cypress/screenshots + - uses: actions/upload-artifact@v2 + if: failure() + with: + name: cypress-videos + path: ui/cypress/videos + notifications: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: "Create creds json" + id: create-creds-json + uses: jsdaniell/create-json@1.1.2 + 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@1.1.2 + 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@1.1.2 + 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@v2 + with: + install-command: npm install cypress --legacy-peer-deps + working-directory: ui + spec: | + cypress/e2e/retention/notifications.cy.js + - uses: actions/upload-artifact@v2 + if: failure() + with: + name: cypress-screenshots + path: ui/cypress/screenshots + - uses: actions/upload-artifact@v2 + if: failure() + with: + name: cypress-videos + path: ui/cypress/videos + other-tests: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: "Create creds json" + id: create-creds-json + uses: jsdaniell/create-json@1.1.2 + 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@1.1.2 + 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@1.1.2 + 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@v2 + 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 + - uses: actions/upload-artifact@v2 + if: failure() + with: + name: cypress-screenshots + path: ui/cypress/screenshots + - uses: actions/upload-artifact@v2 + if: failure() + with: + name: cypress-videos + path: ui/cypress/videos diff --git a/ui/cypress/e2e/reset-test-data.cy.js b/ui/cypress/e2e/reset-test-data.cy.js index ea7437460..4dfa1a03b 100644 --- a/ui/cypress/e2e/reset-test-data.cy.js +++ b/ui/cypress/e2e/reset-test-data.cy.js @@ -10,12 +10,12 @@ describe("Add new user", () => { it("Remove all affiliations from test group", function () { cy.programmaticSignin(data.member.users.owner.email, credentials.password); - cy.visit("/assertion"); + cy.visit("ui/en/affiliations"); cy.get(".btn-group").each(($e) => { cy.wrap($e).children().last().click(); cy.get("button").filter('[data-cy="confirmDeleteAffiliation"]').click(); }); - cy.visit("/user"); + cy.visit("ui/en/users"); cy.get(".btn-group").each(($e) => { cy.wrap($e) .children() @@ -32,7 +32,7 @@ describe("Add new user", () => { it("Remove all affiliations from test member", function () { cy.programmaticSignin(data.member.users.owner.email, credentials.password); - cy.visit("/user"); + cy.visit("ui/en/users"); cy.get(".btn-group").each(($e) => { cy.wrap($e) .children() @@ -52,7 +52,7 @@ describe("Add new user", () => { data.csvMember.users.owner.email, credentials.password, ); - cy.visit("/assertion"); + cy.visit("ui/en/affiliations"); cy.get(".btn-group").each(($e) => { cy.wrap($e).children().last().click(); cy.get("button").filter('[data-cy="confirmDeleteAffiliation"]').click(); @@ -65,7 +65,7 @@ describe("Add new user", () => { data.notificationsMember.users.owner.email, credentials.password, ); - cy.visit("/assertion"); + cy.visit("ui/en/affiliations"); cy.get(".btn-group").each(($e) => { cy.wrap($e).children().last().click(); cy.get("button").filter('[data-cy="confirmDeleteAffiliation"]').click(); diff --git a/ui/cypress/e2e/retention/add-user.cy.js b/ui/cypress/e2e/retention/add-user.cy.js index ac86e068a..b4e7d4a10 100644 --- a/ui/cypress/e2e/retention/add-user.cy.js +++ b/ui/cypress/e2e/retention/add-user.cy.js @@ -48,9 +48,7 @@ describe("Add new user", () => { cy.processPasswordForm("#password"); // check success message - cy.get(".alert-success").within(() => { - cy.get("a").filter('[data-cy="navigateToSignIn"]').click(); - }); + cy.get("a").filter('[data-cy="navigateToSignIn"]').click(); // sign in and confirm the activation was successful }); diff --git a/ui/cypress/e2e/retention/reset-password.cy.js b/ui/cypress/e2e/retention/reset-password.cy.js index 314ad2cd7..5bb9a7380 100644 --- a/ui/cypress/e2e/retention/reset-password.cy.js +++ b/ui/cypress/e2e/retention/reset-password.cy.js @@ -23,9 +23,7 @@ describe("Test the password reset functionality", () => { cy.processPasswordForm("#password"); - cy.get(".alert-success").within(() => { - cy.get("a").filter('data-cy="navigateToSignIn"]').click(); - }); + cy.get("a").filter('[data-cy="navigateToSignIn"]').click(); // sign in and confirm the activation was successful cy.programmaticSignin(data.member.users.owner.email, credentials.password); cy.programmaticSignout(); diff --git a/ui/cypress/fixtures/test-data.json b/ui/cypress/fixtures/test-data.json index 54935cf04..9acb684b3 100644 --- a/ui/cypress/fixtures/test-data.json +++ b/ui/cypress/fixtures/test-data.json @@ -6,7 +6,7 @@ "italianLanguageCode": "4: it", "outbox": { "email": "info@member-portal.qa.orcid.org", - "updateEmail": "update@notify.orcid.org", + "updateEmail": "DoNotReply@notify.orcid.org", "activationSubject": "ORCID Member Portal activation", "resetPasswordSubject": "ORCID Member Portal password reset", "ownerUpdateSubject": "ORCID Member Portal organization owner updated", diff --git a/ui/cypress/support/commands.js b/ui/cypress/support/commands.js index 88c74aa83..c89dfb95a 100644 --- a/ui/cypress/support/commands.js +++ b/ui/cypress/support/commands.js @@ -205,18 +205,16 @@ Cypress.Commands.add("fetchLinkAndGrantPermission", (email) => { .children() .last() .within(() => { - cy.get("a").filter('[data-cy="viewDetailsButton"]').click(); + cy.get("a").click(); + }); + cy.get("button").filter('[data-cy="copyToClipboard"]').click(), + cy.task("getClipboard").then((link) => { + cy.visit(link); }); - cy.get(".jh-entity-details").within(() => - cy.get("button").filter('[data-cy="copyToClipboard"]').click(), - ); - cy.task("getClipboard").then((link) => { - cy.visit(link); - }); // Handle cookies cy.get("#onetrust-reject-all-handler").click(); // Grant permission - cy.get("#username").clear().type(email); + cy.get("#username-input").clear().type(email); cy.get("#password").type(credentials.password); cy.get("#signin-button").click(); diff --git a/ui/src/app/landing-page/landing-page.component.html b/ui/src/app/landing-page/landing-page.component.html index 03715968c..55113a0cd 100644 --- a/ui/src/app/landing-page/landing-page.component.html +++ b/ui/src/app/landing-page/landing-page.component.html @@ -50,7 +50,7 @@

-

+

{{ thanksMessage }}