Skip to content

Commit c8e23d3

Browse files
authored
Clean up and enable tests after PIN teste enabled (#2714)
1 parent 16433fc commit c8e23d3

File tree

7 files changed

+25
-48
lines changed

7 files changed

+25
-48
lines changed

demos/using-dev-build/specs/auth.e2e.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@ describe("authentication", () => {
99
// Click on "Create an Internet Identity Anchor"
1010
await browser.$("#registerButton").click();
1111

12-
// Construct Identity (no-op)
13-
// TODO: GIX-3138 Clean up after release
14-
// const constructIdentity = await browser.$(
15-
// '[data-action="construct-identity"]'
16-
// );
17-
// await constructIdentity.waitForExist();
18-
// await constructIdentity.click();
19-
2012
await browser.$("h1").waitForExist();
2113
const title = await browser.$("h1");
2214

src/frontend/src/test-e2e/constants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@ export const APPLE_USER_AGENT =
4141
// Edge on Windows
4242
export const EDGE_USER_AGENT =
4343
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36 Edg/116.0.1938.81";
44+
45+
// Same as in frontend/src/config.ts
46+
export const ENABLE_PIN_QUERY_PARAM_KEY = "enablePin";

src/frontend/src/test-e2e/flows.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ import {
1515
export const FLOWS = {
1616
register: async function (browser: WebdriverIO.Browser): Promise<string> {
1717
const registerView = new RegisterView(browser);
18-
// TODO: GIX-3138 Clean up after release
19-
// await registerView.waitForDisplay();
20-
// await registerView.create();
2118
if (CAPTCHA_ENABLED) {
2219
await registerView.waitForRegisterConfirm();
2320
await registerView.confirmRegisterConfirm();

src/frontend/src/test-e2e/pinAuth.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
APPLE_USER_AGENT,
33
DEVICE_NAME1,
44
EDGE_USER_AGENT,
5+
ENABLE_PIN_QUERY_PARAM_KEY,
56
II_URL,
67
TEST_APP_NICE_URL,
78
} from "./constants";
@@ -15,10 +16,7 @@ import {
1516
import { AuthenticateView, DemoAppView, MainView, PinAuthView } from "./views";
1617

1718
const DEFAULT_PIN_DEVICE_NAME = "Chrome on Mac OS";
18-
// Same as in frontend/src/config.ts
19-
const ENABLE_PIN_QUERY_PARAM_KEY = "enablePin";
2019

21-
// TODO: GIX-3138 Clean up after release
2220
test("PIN registration not enabled on non-Apple device", async () => {
2321
await runInBrowser(async (browser: WebdriverIO.Browser) => {
2422
await browser.url(`${II_URL}?${ENABLE_PIN_QUERY_PARAM_KEY}`);

src/frontend/src/test-e2e/pinAuthDisabled.test.ts

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,18 @@
1-
import { APPLE_USER_AGENT, II_URL, TEST_APP_NICE_URL } from "./constants";
1+
import {
2+
APPLE_USER_AGENT,
3+
ENABLE_PIN_QUERY_PARAM_KEY,
4+
II_URL,
5+
TEST_APP_NICE_URL,
6+
} from "./constants";
27
import { FLOWS } from "./flows";
38
import { runInBrowser, switchToPopup } from "./util";
4-
import { AuthenticateView, DemoAppView, RegisterView } from "./views";
9+
import { AuthenticateView, DemoAppView } from "./views";
510

6-
// TODO: GIX-3138 Clean up after release
7-
test.skip("Cannot register with PIN if dapp disallows PIN", async () => {
8-
await runInBrowser(async (browser: WebdriverIO.Browser) => {
9-
const demoAppView = new DemoAppView(browser);
10-
await demoAppView.open(TEST_APP_NICE_URL, II_URL);
11-
await demoAppView.waitForDisplay();
12-
await demoAppView.setAllowPin(false);
13-
expect(await demoAppView.getPrincipal()).toBe("");
14-
await demoAppView.signin();
15-
await switchToPopup(browser);
16-
const authenticateView = new AuthenticateView(browser);
17-
await authenticateView.waitForDisplay();
18-
await authenticateView.register();
19-
const registerView = new RegisterView(browser);
20-
await registerView.waitForDisplay();
21-
await registerView.assertPinRegistrationNotShown();
22-
}, APPLE_USER_AGENT);
23-
}, 300_000);
24-
25-
test.skip("Cannot auth with PIN if dapp disallows PIN", async () => {
11+
test("Cannot auth with PIN if dapp disallows PIN", async () => {
2612
await runInBrowser(async (browser: WebdriverIO.Browser) => {
2713
const pin = "123456";
2814

29-
await browser.url(II_URL);
15+
await browser.url(`${II_URL}?${ENABLE_PIN_QUERY_PARAM_KEY}`);
3016
const userNumber = await FLOWS.registerPinWelcomeView(browser, pin);
3117

3218
const demoAppView = new DemoAppView(browser);

src/frontend/src/test-e2e/verifiableCredentials/index.test.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { runInBrowser } from "$src/test-e2e/util";
22

33
import {
44
APPLE_USER_AGENT,
5+
ENABLE_PIN_QUERY_PARAM_KEY,
56
II_URL,
67
ISSUER_APP_URL,
78
ISSUER_APP_URL_LEGACY,
@@ -51,26 +52,29 @@ const testConfigs: Array<{
5152
relyingParty: string;
5253
issuer: string;
5354
authType: "pin" | "webauthn";
55+
iiUrl: string;
5456
}> = [
5557
{
5658
relyingParty: TEST_APP_CANONICAL_URL_LEGACY,
5759
issuer: ISSUER_APP_URL,
5860
authType: "webauthn",
61+
iiUrl: II_URL,
5962
},
6063
{
6164
relyingParty: TEST_APP_CANONICAL_URL,
6265
issuer: ISSUER_APP_URL_LEGACY,
6366
authType: "webauthn",
67+
iiUrl: II_URL,
68+
},
69+
{
70+
relyingParty: TEST_APP_CANONICAL_URL,
71+
issuer: ISSUER_APP_URL,
72+
authType: "pin",
73+
iiUrl: `${II_URL}?${ENABLE_PIN_QUERY_PARAM_KEY}`,
6474
},
65-
// TODO: Renable with PIN GIX-3139
66-
// {
67-
// relyingParty: TEST_APP_CANONICAL_URL,
68-
// issuer: ISSUER_APP_URL,
69-
// authType: "pin",
70-
// },
7175
];
7276

73-
testConfigs.forEach(({ relyingParty, issuer, authType }) => {
77+
testConfigs.forEach(({ relyingParty, issuer, authType, iiUrl }) => {
7478
const testSuffix = `RP: ${getDomain(relyingParty)}, ISS: ${getDomain(
7579
issuer
7680
)}, auth: ${authType}`;
@@ -86,7 +90,7 @@ testConfigs.forEach(({ relyingParty, issuer, authType }) => {
8690
frontendHostname: issuer,
8791
});
8892

89-
await browser.url(II_URL);
93+
await browser.url(iiUrl);
9094
const authConfig = await register[authType](browser);
9195

9296
// Add employee

src/frontend/src/test-e2e/views.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ export class RenameView extends View {
5757
}
5858

5959
export class RegisterView extends View {
60-
// View: Passkey or PIN registration
61-
// TODO: GIX-3138 Clean up after release
62-
// At the moment it's used only in skipped tests.
6360
async waitForDisplay(): Promise<void> {
6461
await this.browser
6562
.$('[data-action="construct-identity"]')

0 commit comments

Comments
 (0)