Skip to content

Commit

Permalink
Wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederik Rothenberger committed Oct 16, 2024
1 parent eb12561 commit dfa2009
Showing 3 changed files with 24 additions and 9 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/canister-tests.yml
Original file line number Diff line number Diff line change
@@ -402,8 +402,12 @@ jobs:
matrix:
device: [ 'desktop', 'mobile' ]
# We run the integration tests on both the official and legacy domains, to make sure
# the webapp (routes, csp, etc) works on both.
domain: [ 'https://identity.internetcomputer.org', 'https://identity.ic0.app' ]
# the webapp (routes, csp, etc) works on both. Captchas are statically enabled on one
# domain and disabled on the other.
# Both settings are combined in one single matrix variable as otherwise there would be
# excessively many combinations to be run and it would be questionable how much more of
# a signal we would get from that.
settings: [{domain: 'https://identity.internetcomputer.org', captcha: 'enabled'}, {domain: 'https://identity.ic0.app', captcha: 'disabled'}]
# Specify some shards for jest (a jest instance will only run a subset of files
# based on the shard assigned to it)
# The jest parameter is actually 1/N, 2/N etc but we use a artifact-friendly
@@ -414,7 +418,7 @@ jobs:

env:
# Suffix used for tagging artifacts
artifact_suffix: ${{ contains(matrix.domain, 'internetcomputer') && 'current' || 'legacy' }}-${{ matrix.device }}-${{ matrix.shard }}
artifact_suffix: ${{ contains(matrix.settings.domain, 'internetcomputer') && 'current' || 'legacy' }}-${{ matrix.device }}-captcha_${{ matrix.settings.captcha }}-${{ matrix.shard }}

steps:
- uses: actions/checkout@v4
@@ -461,8 +465,11 @@ jobs:

- name: Deploy canisters
run: |
# Build the "CaptchaEnabled" / "CaptchaDisabled" variants from the matrix captcha value
captcha_variant="Captcha$(tr '[:lower:]' '[:upper:]' <<< ${${{ matrix.settings.captcha }}:0:1})${${{ matrix.settings.captcha }}:1}"
echo "(opt record { captcha_config = opt record { max_unsolved_captchas= 50:nat64; captcha_trigger = variant {Static = variant { $captcha_variant }}}})"
# NOTE: dfx install will run the postinstall scripts from dfx.json
dfx canister install internet_identity --wasm internet_identity_test.wasm.gz
dfx canister install internet_identity --wasm internet_identity_test.wasm.gz --argument "(opt record { captcha_config = opt record { max_unsolved_captchas= 50:nat64; captcha_trigger = variant {Static = variant { $captcha_variant }}}})"
dfx canister install test_app --wasm demos/test-app/test_app.wasm
dfx canister install issuer --wasm demos/vc_issuer/vc_demo_issuer.wasm.gz
@@ -485,9 +492,10 @@ jobs:
# NOTE: we run chrome in headless mode because that's the only thing that works in GHA
# NOTE: the last bit (tr) replaces 1_N with 1/N
- run: |
II_URL=${{ matrix.domain }} \
II_URL=${{ matrix.settings.domain }} \
SCREEN=${{ matrix.device }} \
II_E2E_CHROME_OPTS="--headless" \
II_CAPTCHA=${{ matrix.settings.captcha }} \
npm run test:e2e -- --shard=$(tr <<<'${{ matrix.shard }}' -s _ /)
- name: Stop dfx
2 changes: 2 additions & 0 deletions src/frontend/src/test-e2e/constants.ts
Original file line number Diff line number Diff line change
@@ -27,6 +27,8 @@ export const ISSUER_CUSTOM_ORIGIN_NICE_URL = `https://nice-issuer-custom-orig.co
export const II_URL =
process.env.II_URL ?? "https://identity.internetcomputer.org";

export const CAPTCHA_ENABLED = process.env.II_CAPTCHA === "enabled" ?? false;

export const DEVICE_NAME1 = "FIDO Passkey";
export const RECOVERY_PHRASE_NAME = "Recovery Phrase";

13 changes: 9 additions & 4 deletions src/frontend/src/test-e2e/flows.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { CAPTCHA_ENABLED } from "$src/test-e2e/constants";
import {
AddDeviceSuccessView,
AddRemoteDeviceInstructionsView,
@@ -16,8 +17,10 @@ export const FLOWS = {
const registerView = new RegisterView(browser);
await registerView.waitForDisplay();
await registerView.create();
await registerView.waitForRegisterConfirm();
await registerView.confirmRegisterConfirm();
if (CAPTCHA_ENABLED) {
await registerView.waitForRegisterConfirm();
await registerView.confirmRegisterConfirm();
}
await registerView.waitForIdentity();
const userNumber = await registerView.registerGetIdentity();
await registerView.registerConfirmIdentity();
@@ -53,8 +56,10 @@ export const FLOWS = {
await pinRegistrationView.setPin(pin);
await pinRegistrationView.waitForConfirmPin();
await pinRegistrationView.confirmPin(pin);
await registerView.waitForRegisterConfirm();
await registerView.confirmRegisterConfirm();
if (CAPTCHA_ENABLED) {
await registerView.waitForRegisterConfirm();
await registerView.confirmRegisterConfirm();
}
await registerView.waitForIdentity();
const userNumber = await registerView.registerGetIdentity();
await registerView.registerConfirmIdentity();

0 comments on commit dfa2009

Please sign in to comment.