Skip to content

Commit 0a6f84c

Browse files
committed
test(e2e): register API-key client flow + fix nav-rename selectors
Adds TC-CL-003 (WDIO): open Apps, register a client, generate, and assert the mcpk_ key is shown once. Fixes specs the Workspaces→Mapping nav rename broke: clients.wdio now asserts "Mapping"; navigation + user-flows click the "Mapping" nav directly (their old has-text("Spaces").last() had incidentally matched the "Workspaces" button via substring). Signed-off-by: Mohammod Al Amin Ashik <maa.ashik00@gmail.com>
1 parent 770893f commit 0a6f84c

3 files changed

Lines changed: 36 additions & 6 deletions

File tree

tests/e2e/specs/clients.wdio.ts

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ describe('Connections - Page shell', () => {
2424
// Heading has been renamed.
2525
expect(pageSource.includes('Apps')).toBe(true);
2626

27-
// The page routes users to Workspaces for any routing questions.
28-
expect(pageSource.includes('Workspaces')).toBe(true);
27+
// The page routes users to the Mapping tab for any routing questions.
28+
expect(pageSource.includes('Mapping')).toBe(true);
2929
});
3030

3131
it('TC-CL-002: Open side panel and verify legacy routing controls are gone', async () => {
@@ -57,4 +57,32 @@ describe('Connections - Page shell', () => {
5757
expect(pageSource.includes("Let's hook up your first IDE")).toBe(true);
5858
}
5959
});
60+
61+
it('TC-CL-003: Register an API-key client and reveal the key once', async () => {
62+
// The desktop app auto-starts the gateway, so register_api_key_client can
63+
// mint a key. Open the Apps tab, register a client, and confirm the
64+
// generated mcpk_ key is shown exactly once.
65+
const connectionsBtn = await byTestId('nav-clients');
66+
await connectionsBtn.click();
67+
await browser.pause(1000);
68+
69+
const registerBtn = await byTestId('register-api-key-client-btn');
70+
await registerBtn.click();
71+
await browser.pause(800);
72+
73+
const nameInput = await byTestId('register-api-key-name');
74+
await nameInput.setValue('e2e-headless-bot');
75+
76+
const generateBtn = await byTestId('register-api-key-generate');
77+
await generateBtn.click();
78+
await browser.pause(1500);
79+
80+
await browser.saveScreenshot('./tests/e2e/screenshots/cl-03-api-key-created.png');
81+
82+
const keyEl = await byTestId('register-api-key-value');
83+
await expect(keyEl).toBeDisplayed();
84+
const keyText = await keyEl.getText();
85+
// Shown once, prefixed mcpk_ (never the stored hash).
86+
expect(keyText.startsWith('mcpk_')).toBe(true);
87+
});
6088
});

tests/e2e/specs/navigation.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ test.describe('Navigation', () => {
3030
await page.locator('nav button:has-text("Discover")').click({ force: true });
3131
await expect(page.locator('h1:has-text("Discover")')).toBeVisible();
3232

33-
// Spaces (use last() to avoid space switcher)
34-
await page.locator('nav button:has-text("Spaces")').last().click({ force: true });
33+
// Mapping (the workspace→tools mapping tab; nav label was renamed from
34+
// "Workspaces", but the page heading is still "Workspaces").
35+
await page.locator('nav button:has-text("Mapping")').click({ force: true });
3536
await expect(page.locator('h1:has-text("Workspaces")')).toBeVisible();
3637

3738
// FeatureSets

tests/e2e/specs/user-flows.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ test.describe('Complete User Flows', () => {
4444
await page.locator('nav button:has-text("Discover")').click();
4545
await expect(page.locator('h1:has-text("Discover")')).toBeVisible();
4646

47-
// Spaces (use last() to avoid space switcher)
48-
await page.locator('nav button:has-text("Spaces")').last().click();
47+
// Mapping (the workspace→tools mapping tab; nav label was renamed from
48+
// "Workspaces", but the page heading is still "Workspaces").
49+
await page.locator('nav button:has-text("Mapping")').click();
4950
await expect(page.locator('h1:has-text("Workspaces")')).toBeVisible();
5051

5152
// FeatureSets

0 commit comments

Comments
 (0)