Skip to content

Commit

Permalink
Wip
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikrothenberger committed Oct 16, 2024
1 parent eb12561 commit 107f0a1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/canister-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,14 @@ jobs:
# The jest parameter is actually 1/N, 2/N etc but we use a artifact-friendly
# version here (with underscore).
shard: [ '1_6', '2_6', '3_6', '4_6', '5_6', '6_6' ]
# Whether the registration flow requires a captcha to be solved or not
captcha: ['enabled', 'disabled']
# Make sure that one failing test does not cancel all other matrix jobs
fail-fast: false

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

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -461,8 +463,10 @@ jobs:

- name: Deploy canisters
run: |
# Build the "CaptchaEnabled" / "CaptchaDisabled" variants from the matrix captcha value
captcha_variant="Captcha$(tr '[:lower:]' '[:upper:]' <<< ${${{ matrix.captcha }}:0:1})${${{ matrix.captcha }}:1}"
# 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
Expand All @@ -488,6 +492,7 @@ jobs:
II_URL=${{ matrix.domain }} \
SCREEN=${{ matrix.device }} \
II_E2E_CHROME_OPTS="--headless" \
II_CAPTCHA=${{ matrix.captcha }} \
npm run test:e2e -- --shard=$(tr <<<'${{ matrix.shard }}' -s _ /)
- name: Stop dfx
Expand Down
4 changes: 4 additions & 0 deletions src/frontend/src/test-e2e/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { KnownDapp } from "$src/flows/dappsExplorer/dapps";
import { readCanisterId } from "@dfinity/internet-identity-vite-plugins/utils";
import { getReplicaHost } from "../../../vite-plugins/dist/utils";
import { nonNullish } from "@dfinity/utils";

Check warning on line 4 in src/frontend/src/test-e2e/constants.ts

View workflow job for this annotation

GitHub Actions / frontend-checks

'nonNullish' is defined but never used. Allowed unused vars must match /^_/u

// XXX: this is not exactly a constant (since it might change on every node eval) but in
// practice is very stable, and is much easier to use as "constants" than as a lookup function.
Expand All @@ -27,6 +28,9 @@ 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";

Expand Down
13 changes: 9 additions & 4 deletions src/frontend/src/test-e2e/flows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ import {
RegisterView,
WelcomeView,
} from "./views";
import { CAPTCHA_ENABLED } from "$src/test-e2e/constants";

export const FLOWS = {
register: async function (browser: WebdriverIO.Browser): Promise<string> {
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();
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 107f0a1

Please sign in to comment.