diff --git a/e2e/README.md b/e2e/README.md index 4c66d1def..fb5dd17b8 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -35,11 +35,15 @@ Install Cypress on your local machine by following [these instructions](https:// - Clone the API Service Portal repository - Run `./e2e $ npm i` to install all the dependencies +### Test data dependencies + +Many tests cannot be run independently because they depend on state established by other tests. These dependencies are [documented](test-data-dependencies.md) to assist in running tests selectively. + ### Running Cypress Locally -- `./e2e/cypress.json` contains the web app config. Update the file to use local or dev version of the portal for executing the tests +- `./e2e/cypress.config.ts` contains the web app config. Update the file to use local or dev version of the portal for executing the tests -- Recommendation is to use local version of portal. Use `docker-compose` to create local development environment +- Recommendation is to use local version of portal. Use `docker compose` to create local development environment #### Cypress Test Runner @@ -57,9 +61,9 @@ Install Cypress on your local machine by following [these instructions](https:// #### GitHub Actions -- Any new commit pushed to `util/*automation*` branch triggers job (`.github/workflows/aps-cypress-e2e.yaml`) and it spawns all the services including cypress to execute the test suite +- Any new commit pushed to a `cypress*` branch or `test`, triggers the job (`.github/workflows/aps-cypress-e2e.yaml`) and it spawns all the services including Cypress to execute the test suite -- The test results would be uploaded to `https://www.cypress.io/dashboard/` +- The test results would be uploaded to `https://www.cypress.io/dashboard/`, as well as attached as an artifact on the GitHub Action run. ## 3. Cypress on Windows @@ -97,13 +101,13 @@ WSL 2 or your local machine are prefaced with `WSL` and `LM` respectively in the ## 4. Creating Tests -After you run `npm run cy:open`, the Cypress console will open. Before continuing, ensure the `Electron` browser is selected from the drop-down list of available browsers (top-right corner of the Cypress test runner). +After you run `npm run cy:open`, the Cypress console will open. Before continuing, ensure the `Edge` browser is selected from the drop-down list of available browsers (top-right corner of the Cypress test runner). Each test file defined in the `./e2e/cypress/tests` directory will be visible. Click on a test in order to run all test cases in that file. A new browser window will open and you will see your tests executed sequentially. ### Test File Naming Convention and Location -- Test files follow this naming convention: `-.spec.ts`. (e.g., `01-create-api.spec.ts`) +- Test files follow this naming convention: `-.cy.ts`. (e.g., `01-create-api.cy.ts`) - Store the test files in the `./e2e/cypress/tests` directory. ### Test File Structure diff --git a/e2e/test-data-dependencies.md b/e2e/test-data-dependencies.md new file mode 100644 index 000000000..4cff415ea --- /dev/null +++ b/e2e/test-data-dependencies.md @@ -0,0 +1,109 @@ +| Test | Dependencies | +| ----------------------------------------------------------- | -------------------------------------------------------------- | +| 01-api-key | | +| │   01-create-api.cy.ts | NA | +| │   02-team-access.cy.ts | 1.1 | +| │   03-request-access-inactive-env.cy.ts | 1.1 to 1.2 | +| │   04-request-access-with-out-collecting-credentials.cy.ts | 1.1 to 1.3 | +| │   05-review-request-without-collecting-credentials.cy.ts | 1.1 to 1.4 | +| │   06-collect-credentials.cy.ts | 1.1 to 1.5 | +| │   07-approve-pending-rqst.cy.ts | 1.1 to 1.6 | +| │   08-grant-access.cy.ts | 1.1 to 1.7 | +| │   09-gwa-get.ts | 1.1 to 1.8 | +| │   10-revoke-access.cy.ts | 1.1 to 1.9 | +| 02-client-credential-flow | | +| │   01-client-cred-team-access.cy.ts | NA | +| │   02-create_authorizarion_profile.cy.ts | 2.1 | +| │   03-client-cred-create-api-prod-auth-pro.cy.ts | 2.1 to 2.2 | +| │   04-cids-access-rqst.cy.ts | 2.1 to 2.3 | +| │   05-cids-access-approve-api-rqst.cy.ts | 2.1 to 2.4 | +| │   06-client-scope-in-keycloak.ts | 2.1 to 2.5 | +| │   07-deselect-scope.ts | 2.1 to 2.6 | +| │   08-verify-client-scope-in-default-list.ts | 2.1 to 2.7 | +| │   09-jwt-genkp-access-rqst.cy.ts | 2.1 to 2.8 | +| │   10-jwt-genkp-access-approve-api-rqst.cy.ts | 2.1 to 2.9 | +| │   11-jwks-url-gen-keys-access-rqst.cy.ts | 2.1 to 2.10 | +| │   12-jwks-url-access-approval-api-rqst.cy.ts | 2.1 to 2.11 | +| │   13-jwks-publicKey-access-rqst.cy.ts | 2.1 to 2.12 | +| │   14-jwt-publlicKey-access-approve-api-rqst.cy.ts | 2.1 to 2.13 | +| 03-manage-labels | | +| │   01-rqst-access-for-labels.cy.ts | Folder 01-api-key | +| │   02-approve-pending-rqst-for-labels.spec.cy.ts | Folder 01-api-key and 3.1 | +| │   03-filter-labels.cy.ts | Folder 01-api-key and 3.1 to 3.2 | +| │   04-manage-labels.cy.ts | Folder 01-api-key and 3.1 to 3.3 | +| │   05-link-consumers.ts | Folder 01-api-key and 3.1 to 3.4 | +| 04-gateway-services | | +| │   01-gateway-service-details.cy.ts | Folder 01-api-key | +| │   02-filter-gateway-service.cy.ts | Folder 01-api-key | +| 05-migrate-user | | +| │   01-migrate-user-access.cy.ts | Folder 01-api-key | +| 06-refresh-credential | | +| │   01-api-key.cy.ts | Folder 01-api-key | +| │   02-client-credentials.cy.ts | Folder 02-client-credential-flow | +| 07-manage-control | | +| │   01-ip-restriction.cy.ts | Folders 01-api-key, 02-client-credential-flow, and 6.2 | +| │   02-rate-limiting.cy.ts | Folders 01-api-key, 02-client-credential-flow, and 7.1 | +| │   03-kong-api-only-apply-rate-limiting.cy.ts | Folders 01-api-key, 02-client-credential-flow, and 7.1 to 7.2 | +| 08-client-role | | +| │   01-keycloak-set-roles.cy.ts | Folder 02-client-credential-flow | +| │   02-add-roles-authorization-profile.ts | Folder 02-client-credential-flow and 8.1 | +| │   03-read-client-role.ts | Folder 02-client-credential-flow and 8.1 to 8.2 | +| │   04-write-client-role.ts | Folder 02-client-credential-flow and 8.1 to 8.3 | +| │   05-check-without-role.ts | Folder 02-client-credential-flow and 8.1 to 8.4 | +| 09-update-product-env | | +| │   01-client-credential-to-kong-acl-api.cy.ts | Folder 01-api-key and 02-client-credential-flow | +| │   02-kong-acl-api-to-client-credential.cy.ts | Folder 01-api-key and 02-client-credential-flow and 9.1 | +| │   03-apply-multiple-services.cy.ts | Folder 01-api-key and 02-client-credential-flow and 9.1 to 9.2 | +| │   04-change-env-status copy.cy.ts | Folder 01-api-key and 02-client-credential-flow and 9.1 to 9.3 | +| │   05-keycloak-shared-IDP-config.cy.ts | Folder 01-api-key and 02-client-credential-flow and 9.1 to 9.4 | +| │   06-shared-idp.cy.ts | Folder 01-api-key and 02-client-credential-flow and 9.1 to 9.5 | +| │   07-kong-public-auth.ts | Folder 01-api-key and 02-client-credential-flow and 9.1 to 9.6 | +| │   08-protected-externally.ts | Folder 01-api-key and 02-client-credential-flow and 9.1 to 9.7 | +| 10-clear-resources | | +| │   01-create-api.cy.ts | | +| │   02-team-access.cy.ts | 10.1 | +| │   03-rqst-access.cy.ts | 10.1 to 10.2 | +| │   04-delete-consumer.ts | 10.1 to 10.3 | +| │   05-delete-resources.cy.ts | 10.1 to 10.4 | +| │   06-delete-service-acc.ts | Folder 01-api-key and 10.1 to 10.5 | +| 11-activity-feed | | +| │   01-activity-feed.cy.ts | Folder 01-api-key | +| │   02-activity-feed-failure.cy.ts | Folder 01-api-key and 11.1 | +| 12-access-permission | | +| │   01-create-api.cy.ts | NA | +| │   02-team-access.cy.ts | 12.1 | +| │   03-rqst-access.cy.ts | 12.1 to 12.2 | +| │   04-access-manager.cy.ts | 12.1 to 12.2 | +| │   05-namespace-manage.cy.ts | 12.1 to 12.2 | +| │   06-credential-issuer.cy.ts | 12.1 to 12.2 | +| │   07-namespace-view.cy.ts | 12.1 to 12.2 | +| │   08-gateway-config.cy.ts | 12.1 to 12.2 | +| │   09-content-publish.cy.ts | 12.1 to 12.2 | +| 13-namespace-preview-mode | | +| │   01-create-api.cy.ts | NA | +| │   02-namespace-preview-mode.cy.ts | 13.1 | +| 14-org-assignment | | +| │   01-client-cred-team-access.ts | NA | +| │   02-multiple-org-admin.ts | 14.1 | +| │   03-verify-org-admin-member-org.ts | 14.1 to 14.2 | +| │   04-multiple-org-admin-org-unit.ts | 14.1 to 14.3 | +| │   05-verify-org-admin-member-org-unit.ts | 14.1 to 14.4 | +| 15-aps-api | | +| │   01-create-api.cy.ts | NA | +| │   02-organization.cy.ts | 1.1 and 15.1 | +| │   03-documentation.cy.ts | 15.1 to 15.2 | +| │   04-keycloak-shared-IDP-config.cy.ts | 15.1 to 15.3 | +| │   05-authorizationProfiles.cy.ts | 1.1, 2.1 to 2.3, 15.1 | +| │   06-products.cy.ts | 1.1 and 15.1 | +| │   07-api-directory.cy.ts | 1.1 and 15.1 | +| │   08-namespaces.cy.ts | 1.1 and 15.1 | +| 16-gwa-cli | | +| │   01-cli-commands.ts | NA | +| │   02-cli-generate-config.ts | 16.1 | +| 17-delete-application | | +| │   01-delete-application-without-access.cy.ts | NA | +| │   02-delete-application-with-pending-request.cy.ts | 17.1 | +| │   03-delete-application-with-approved-request.cy.ts | 17.1 to 17.2 | +| │   04-delete-namespace-gwa.ts | 17.1 to 17.3 | +| 18-scan-astra-result | | +|     01-store-and-scan-astra-result.ts | NA | \ No newline at end of file