Skip to content

Commit 673def4

Browse files
[UI][VAULT-42957] Namespace wizard playwright tests (#13289) (#13324)
* wip namespace wizard test * Namespaces wizard first step * Add more namespace step 2 tests * Modified namespace wizard tests! * Remove namespace wizard tests Co-authored-by: Kianna <30884335+kiannaquach@users.noreply.github.com>
1 parent 45530c0 commit 673def4

File tree

2 files changed

+98
-16
lines changed

2 files changed

+98
-16
lines changed

ui/e2e/tests/superuser/intro-pages.spec.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ test('intro pages workflow', async ({ page }) => {
106106
await page.getByRole('link', { name: 'Authentication methods' }).click();
107107
await expect(page.getByRole('button', { name: 'New to Auth methods?' })).not.toBeVisible();
108108

109-
basePage.dismissFlashMessages();
109+
await basePage.dismissFlashMessages();
110110

111111
await page.getByRole('link', { name: 'Back to main navigation' }).click();
112112
});
@@ -126,25 +126,10 @@ test('intro pages workflow', async ({ page }) => {
126126
await expect(page.getByRole('tab', { name: 'Select setup (current)' })).toBeVisible();
127127
await page.getByRole('button', { name: 'Exit' }).click();
128128

129-
// verify exit button closes the intro page and user is navigated back to namespaces list page
130129
await expect(page.getByRole('heading', { name: 'Welcome to Namespaces' })).not.toBeVisible();
131130
await expect(page.locator('h1')).toHaveText('Namespaces');
132131
await expect(page.getByRole('link', { name: 'Create namespace' })).toBeVisible();
133132
await expect(page.getByRole('button', { name: 'New to Namespaces?' })).toBeVisible();
134-
135-
// clicking create from banner routes to creation page
136-
await page.getByRole('button', { name: 'New to Namespaces?' }).click();
137-
await page.getByRole('button', { name: 'Guided start' }).click();
138-
await expect(page.getByText('Namespaces Guided Start')).toBeVisible();
139-
140-
await page.getByRole('radio', { name: 'Flexible/shared access: our' }).check();
141-
await expect(page.getByRole('heading', { name: 'Single namespace' })).toBeVisible();
142-
await page.getByRole('button', { name: 'Next' }).click();
143-
await expect(page.getByRole('link', { name: 'Set up identities' })).toBeVisible();
144-
await expect(page.getByRole('heading', { name: "No action needed, you're all" })).toBeVisible();
145-
await expect(page.getByRole('link', { name: 'Learn more about namespaces' })).toBeVisible();
146-
await page.getByRole('button', { name: 'Exit' }).click();
147-
148133
await page.getByRole('link', { name: 'Create namespace' }).click();
149134
await page.getByRole('textbox', { name: 'Path' }).fill('testNs');
150135
await page.getByRole('button', { name: 'Save' }).click();

ui/e2e/tests/superuser/namespace.spec.ts

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,100 @@ test('namespace workflow', async ({ page }) => {
2121
// verify that we are switched into the new namespace by checking for the namespace name in the header
2222
await expect(page.locator('#app-main-content').getByText('testNamespace')).toBeVisible();
2323
});
24+
25+
test('namespace wizard workflow', async ({ page }) => {
26+
await page.goto('dashboard');
27+
28+
await test.step('Navigate to namespaces wizard', async () => {
29+
await page.getByRole('link', { name: 'Access control' }).click();
30+
await page.getByRole('link', { name: 'Namespaces' }).click();
31+
await page.getByRole('button', { name: 'New to Namespaces?' }).click();
32+
const modal = page.getByRole('dialog', { name: 'Welcome to Namespaces' });
33+
await expect(modal).toBeVisible();
34+
await page.getByRole('button', { name: 'Guided start' }).click();
35+
await expect(page.getByRole('heading', { name: 'Namespaces Guided Start' })).toBeVisible();
36+
});
37+
38+
await test.step('Should show step 1 selection options', async () => {
39+
await page.getByRole('heading', { name: 'What best describes your' }).click();
40+
41+
await expect(
42+
page.getByRole('heading', {
43+
name: 'What best describes your access policy between teams and applications?',
44+
})
45+
).toContainText('What best describes your access policy between teams and applications?');
46+
await expect(page.getByText('Flexible/shared access: our')).toBeVisible();
47+
await expect(
48+
page.getByText('Strict isolation required: our policy mandates hard boundaries (separate')
49+
).toBeVisible();
50+
});
51+
52+
await test.step('Should show flexible/shared access information in Step 1 if it is selected', async () => {
53+
await page.getByText('Flexible/shared access:').click();
54+
await expect(page.getByRole('heading', { name: 'Your recommended setup' })).toContainText(
55+
'Your recommended setup'
56+
);
57+
await page.getByRole('heading', { name: 'Single namespace' }).click();
58+
await expect(page.getByRole('heading', { name: 'Single namespace' })).toContainText('Single namespace');
59+
await expect(page.getByText('Your organization should be')).toContainText(
60+
'Your organization should be comfortable with your current setup of one global namespace. You can always add more namespaces later.'
61+
);
62+
});
63+
64+
await test.step('Should navigate to "Apply changes" step once "next" is clicked for flexible/shared access selection', async () => {
65+
await page.getByRole('button', { name: 'Next' }).click();
66+
67+
await expect(page.getByRole('heading', { name: "No action needed, you're all set." })).toBeVisible();
68+
await expect(
69+
page.getByRole('heading', { name: 'Next up: build out your access lists and identities' })
70+
).toBeVisible();
71+
await expect(page.getByRole('heading', { name: 'Why use ACL and identities?' })).toBeVisible();
72+
await expect(page.getByRole('link', { name: 'Set up identities' })).toBeVisible();
73+
await expect(page.getByRole('link', { name: 'Learn more about namespaces' })).toBeVisible();
74+
});
75+
76+
await page.getByRole('button', { name: 'Back' }).click();
77+
78+
await test.step('Should navigate to "Map out namespaces" once "next" is clicked for strict isolation selection', async () => {
79+
await page.getByText('Strict isolation required: our policy mandates hard boundaries (separate').click();
80+
await page.getByRole('button', { name: 'Next' }).click();
81+
await expect(page.getByRole('heading', { name: 'Map out your namespaces' })).toContainText(
82+
'Map out your namespaces'
83+
);
84+
await page.getByText('Create the namespaces you').click();
85+
await expect(page.getByText('Create the namespaces you')).toContainText(
86+
'Create the namespaces you need using the 3-layer structure, starting with the global level. Refresh the preview to update. These changes will only be applied on the next step, once you select the implementation method.'
87+
);
88+
await page.getByRole('textbox', { name: 'Global' }).fill('global');
89+
await page.getByRole('textbox', { name: 'Org' }).fill('org-1');
90+
await page.getByRole('textbox', { name: 'Project' }).fill('project-2');
91+
await page.getByRole('button', { name: 'Add' }).first().click();
92+
await page.getByRole('button', { name: 'Next' }).click();
93+
});
94+
95+
await test.step('Should navigate and display "Apply changes" once "Map out your namespaces" is complete', async () => {
96+
await expect(
97+
page.getByText('Terraform automation Recommended Manage configurations by Infrastructure as')
98+
).toBeVisible();
99+
await expect(
100+
page.getByText('variable "global_child_namespaces" { type = set(string) default = ["org-1"] }')
101+
).toContainText(
102+
'variable "global_child_namespaces" { type = set(string) default = ["org-1"] } variable "global_org-1_child_namespaces" { type = set(string) default = ["project-2"] } resource "vault_namespace" "global" { path = "global" } resource "vault_namespace" "global_children" { for_each = var.global_child_namespaces namespace = vault_namespace.global.path path = each.key } resource "vault_namespace" "global_org-1_children" { for_each = var.global_org-1_child_namespaces namespace = vault_namespace.global_children["org-1"].path_fq path = each.key }'
103+
);
104+
await page.getByText('API/CLI Manage namespaces').click();
105+
await expect(page.getByText('API/CLI Manage namespaces')).toContainText(
106+
'API/CLI Manage namespaces directly via the Vault CLI or REST API. Best for quick updates, custom scripting, or terminal-based workflows.'
107+
);
108+
await expect(page.getByText('curl \\ --header "X-Vault-')).toContainText(
109+
'curl \\ --header "X-Vault-Token: $VAULT_TOKEN" \\ --request PUT \\ $VAULT_ADDR/v1/sys/namespaces/global curl \\ --header "X-Vault-Token: $VAULT_TOKEN" \\ --header "X-Vault-Namespace: /global" \\ --request PUT \\ $VAULT_ADDR/v1/sys/namespaces/org-1 curl \\ --header "X-Vault-Token: $VAULT_TOKEN" \\ --header "X-Vault-Namespace: /global/org-1" \\ --request PUT \\ $VAULT_ADDR/v1/sys/namespaces/project-2'
110+
);
111+
await page.getByRole('radio', { name: 'Vault UI workflow Apply' }).check();
112+
await expect(page.getByText('Apply changes immediately.')).toContainText(
113+
'Apply changes immediately. Note: Changes made in the UI will be overwritten by any future updates made via Infrastructure as Code (Terraform).'
114+
);
115+
await page.getByRole('tab', { name: 'Map out namespaces (complete)' }).click();
116+
await expect(page.getByRole('heading', { name: 'Map out your namespaces' })).toContainText(
117+
'Map out your namespaces'
118+
);
119+
});
120+
});

0 commit comments

Comments
 (0)