Skip to content

Commit

Permalink
Merge pull request #1112 from bcgov/cypress/ns-to-gw-regression
Browse files Browse the repository at this point in the history
Cypress/ns to gw regression tests
  • Loading branch information
rustyjux authored Jul 22, 2024
2 parents a4c48ab + 1009a01 commit 604195a
Show file tree
Hide file tree
Showing 98 changed files with 1,120 additions and 535 deletions.
1 change: 1 addition & 0 deletions .env.local
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ NEXT_PUBLIC_DEVELOPER_IDS=idir,bceid,bcsc,github
NEXT_PUBLIC_PROVIDER_IDS=idir
NEXT_PUBLIC_ACCOUNT_BCEID_URL=https://www.test.bceid.ca/logon.aspx?returnUrl=/profile_management
NEXT_PUBLIC_ACCOUNT_BCSC_URL=https://idtest.gov.bc.ca/account/
NEXT_PUBLIC_GRAFANA_URL=https://grafana-apps-gov-bc-ca.dev.api.gov.bc.ca

# For automated integrated testing
TEST_PORTAL_CLIENT_ID=aps-portal
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/aps-cypress-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,20 @@ jobs:
fi
done
- name: Upload E2E Test Results Report
- name: Upload E2E Test Results HTML Report
uses: actions/upload-artifact@v2
with:
name: test-results
name: test-results-html
path: ${{ github.workspace }}/e2e/results/report

- name: Upload E2E Code Coverage Report
- name: Upload E2E Test Results JSON Report
uses: actions/upload-artifact@v2
with:
name: test-results-json
path: ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json

- name: Upload E2E Code Coverage Report
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: ${{ github.workspace }}/e2e/coverage
Expand Down Expand Up @@ -100,8 +106,8 @@ jobs:
run: |
FAILURE_COUNT=$(cat ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json | jq '.stats.failures')
if [[ "$FAILURE_COUNT" -gt 0 ]]; then
FAILED_TESTS=$(cat ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json | jq '.results | .[] | .suites | .[].tests | .[] | select(.fail==true) | .title')
STATS=$(cat ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json | jq '.stats')
FAILED_TESTS=$(jq -r '.results[] | {file: .file, suites: .suites[]} | .suites as $suite | {file: .file, failed_tests: ($suite.tests[] | select(.fail == true) | {title})} | select(.failed_tests != null) | "- " + (.file | split("/") | .[2:] | join("/")) + " - " + .failed_tests.title' ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json)
STATS=$(cat ${{ github.workspace }}/e2e/results/bcgov-aps-e2e-report.json | jq -r '.stats | to_entries | map("\(.key)\t\(.value)") | .[]' | column -t)
echo -e "Stats: $STATS\n\nFailed Tests:\n$FAILED_TESTS\n\nRun Link: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" > msg
export MSG=$(cat msg)
gh issue create --title "FAILED: Automated Tests($FAILURE_COUNT)" --body "$MSG" --label "automation" --assignee "${{ env.GIT_COMMIT_AUTHOR }}"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Run this command to test logging in and creating a namespace:

```
gwa login
gwa namespace create --name gw-12345
gwa gateway create --gateway-id gw-12345
```

### Keycloak configuration
Expand Down
2 changes: 1 addition & 1 deletion e2e/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ COPY e2e/*.yml /e2e
COPY e2e/entrypoint.sh /tmp
ADD e2e/cypress /e2e/cypress

RUN curl -v -L -O https://github.com/bcgov/gwa-cli/releases/download/v2.0.15/gwa_Linux_x86_64.tgz \
RUN curl -v -L -O https://github.com/bcgov/gwa-cli/releases/download/v3.0.0/gwa_Linux_x86_64.tgz \
&& tar -xzf gwa_Linux_x86_64.tgz \
&& mv gwa /usr/local/bin/.

Expand Down
1 change: 1 addition & 0 deletions e2e/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default defineConfig({
},
chromeWebSecurity: false,
env: {
ASTRA_SCAN_ENABLED: true,
CLIENT_ID: 'aps-portal',
CLIENT_SECRET: '8e1a17ed-cb93-4806-ac32-e303d1c86018',
OIDC_ISSUER: 'http://keycloak.localtest.me:9081/auth/realms/master',
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/fixtures/access-manager.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"namespace": "permission"
},
"serviceAccount": {
"scopes": ["GatewayConfig.Publish", "Namespace.Manage", "Content.Publish"]
"scopes": ["GatewayConfig.Publish", "Gateway.Manage", "Content.Publish"]
},
"labels_consumer1": {
"labels": {
Expand Down
Loading

0 comments on commit 604195a

Please sign in to comment.