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 107f0a1 commit 947cc6d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/canister-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -402,21 +402,23 @@ 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
# 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 }}-captcha_${{ matrix.captcha }}-${{ matrix.shard }}
artifact_suffix: ${{ contains(matrix.settings.domain, 'internetcomputer') && 'current' || 'legacy' }}-${{ matrix.device }}-captcha_${{ matrix.settings.captcha }}-${{ matrix.shard }}

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -464,7 +466,7 @@ 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}"
captcha_variant="Captcha$(tr '[:lower:]' '[:upper:]' <<< ${${{ matrix.settings.captcha }}:0:1})${${{ matrix.settings.captcha }}:1}"
# NOTE: dfx install will run the postinstall scripts from dfx.json
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
Expand All @@ -489,10 +491,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.captcha }} \
II_CAPTCHA=${{ matrix.settings.captcha }} \
npm run test:e2e -- --shard=$(tr <<<'${{ matrix.shard }}' -s _ /)
- name: Stop dfx
Expand Down
4 changes: 1 addition & 3 deletions src/frontend/src/test-e2e/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
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";

// 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 @@ -28,8 +27,7 @@ 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 CAPTCHA_ENABLED = process.env.II_CAPTCHA === "enabled" ?? false;

export const DEVICE_NAME1 = "FIDO Passkey";
export const RECOVERY_PHRASE_NAME = "Recovery Phrase";
Expand Down
2 changes: 1 addition & 1 deletion 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,
Expand All @@ -10,7 +11,6 @@ import {
RegisterView,
WelcomeView,
} from "./views";
import { CAPTCHA_ENABLED } from "$src/test-e2e/constants";

export const FLOWS = {
register: async function (browser: WebdriverIO.Browser): Promise<string> {
Expand Down

0 comments on commit 947cc6d

Please sign in to comment.