Skip to content

Commit 9b7b330

Browse files
committed
test(FR-2652): fast-path folder dialog wait and assert vfolder selection
1 parent 0bf0f55 commit 9b7b330

7 files changed

Lines changed: 362 additions & 109 deletions

e2e/admin-model-card/admin-model-card-create.spec.ts

Lines changed: 122 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -27,43 +27,75 @@ test.describe(
2727
const modal = adminModelCardPage.getCreateModal();
2828
await expect(modal).toBeVisible();
2929

30-
// Verify key form fields are present
30+
// Verify key form fields are present.
31+
// In antd v6, Form.Item tooltip icons contribute "question-circle" to the accessible
32+
// name, so we locate fields by form item label text rather than exact accessible name.
3133
await expect(modal.getByRole('textbox', { name: 'Name' })).toBeVisible();
3234
await expect(modal.getByText('Model Storage Folder')).toBeVisible();
3335
await expect(modal.getByText('Domain').first()).toBeVisible({
3436
timeout: 10000,
3537
});
3638
await expect(
37-
modal.getByRole('textbox', { name: 'Author (optional)' }),
39+
modal
40+
.locator('.ant-form-item')
41+
.filter({ hasText: 'Author' })
42+
.getByRole('textbox'),
3843
).toBeVisible();
3944
await expect(
40-
modal.getByRole('textbox', { name: 'Title (optional)' }),
45+
modal
46+
.locator('.ant-form-item')
47+
.filter({ hasText: 'Title' })
48+
.getByRole('textbox'),
4149
).toBeVisible();
4250
await expect(
43-
modal.getByRole('textbox', { name: 'Model Version (optional)' }),
51+
modal
52+
.locator('.ant-form-item')
53+
.filter({ hasText: 'Model Version' })
54+
.getByRole('textbox'),
4455
).toBeVisible();
4556
await expect(
46-
modal.getByRole('textbox', { name: 'Description (optional)' }),
57+
modal
58+
.locator('.ant-form-item')
59+
.filter({ hasText: 'Description' })
60+
.getByRole('textbox'),
4761
).toBeVisible();
4862
await expect(
49-
modal.getByRole('textbox', { name: 'Task (optional)' }),
63+
modal
64+
.locator('.ant-form-item')
65+
.filter({ hasText: 'Task' })
66+
.getByRole('textbox'),
5067
).toBeVisible();
5168
await expect(
52-
modal.getByRole('textbox', { name: 'Category (optional)' }),
69+
modal
70+
.locator('.ant-form-item')
71+
.filter({ hasText: 'Category' })
72+
.getByRole('textbox'),
5373
).toBeVisible();
5474
await expect(
55-
modal.getByRole('textbox', { name: 'Architecture (optional)' }),
75+
modal
76+
.locator('.ant-form-item')
77+
.filter({ hasText: 'Architecture' })
78+
.getByRole('textbox'),
5679
).toBeVisible();
5780
await expect(
58-
modal.getByRole('textbox', { name: 'License (optional)' }),
81+
modal
82+
.locator('.ant-form-item')
83+
.filter({ hasText: 'License' })
84+
.getByRole('textbox'),
5985
).toBeVisible();
6086
await expect(
61-
modal.getByRole('textbox', { name: 'README.md (optional)' }),
87+
modal
88+
.locator('.ant-form-item')
89+
.filter({ hasText: 'README.md' })
90+
.getByRole('textbox'),
6291
).toBeVisible();
6392

64-
// Verify Access Level is present as a required field (no default value)
93+
// Verify Access Level is present as a required field
6594
await expect(
66-
modal.getByRole('combobox', { name: 'Access Level' }),
95+
modal
96+
.locator('.ant-form-item')
97+
.filter({ hasText: 'Access Level' })
98+
.locator('.ant-select'),
6799
).toBeVisible();
68100

69101
// Verify the Create and Cancel buttons are present in the modal footer
@@ -79,6 +111,7 @@ test.describe(
79111
test('Superadmin can create a model card with only required fields', async ({
80112
page,
81113
}) => {
114+
test.setTimeout(90000);
82115
const adminModelCardPage = new AdminModelCardPage(page);
83116
const cardName = `e2e-test-required-only-${Date.now()}`;
84117

@@ -93,26 +126,35 @@ test.describe(
93126
// Fill in the Name field
94127
await modal.getByRole('textbox', { name: 'Name' }).fill(cardName);
95128

96-
// Select an available VFolder
97-
await modal.getByRole('combobox').first().click();
129+
// Select an available VFolder.
130+
// In antd v6 with BAISelect, click .ant-select-content to open the dropdown.
131+
await modal
132+
.locator('.ant-form-item')
133+
.filter({ hasText: 'Model Storage Folder' })
134+
.locator('.ant-select-content')
135+
.click();
98136
const vfolderDropdown = page
99137
.locator('.ant-select-dropdown:not(.ant-select-dropdown-hidden)')
100138
.first();
101-
await expect(vfolderDropdown).toBeVisible();
139+
await expect(vfolderDropdown).toBeVisible({ timeout: 10000 });
102140
await expect(vfolderDropdown.getByText(/Total \d+ items/)).toBeVisible({
103141
timeout: 10000,
104142
});
105143
await vfolderDropdown.locator('.ant-select-item-option').first().click();
106144

107-
// Select Access Level (required)
108-
await modal.getByRole('combobox', { name: 'Access Level' }).click();
145+
// Select Access Level (required). Access level options are "Private" (INTERNAL) and "Public".
146+
await modal
147+
.locator('.ant-form-item')
148+
.filter({ hasText: 'Access Level' })
149+
.locator('.ant-select-content')
150+
.click();
109151
const accessDropdown = page
110152
.locator('.ant-select-dropdown:not(.ant-select-dropdown-hidden)')
111153
.first();
112154
await expect(accessDropdown).toBeVisible();
113155
await accessDropdown
114156
.locator('.ant-select-item-option')
115-
.filter({ hasText: 'Internal' })
157+
.filter({ hasText: 'Private' })
116158
.click();
117159

118160
// Click Create
@@ -139,6 +181,7 @@ test.describe(
139181
test('Superadmin can create a model card with all fields populated', async ({
140182
page,
141183
}) => {
184+
test.setTimeout(90000);
142185
const adminModelCardPage = new AdminModelCardPage(page);
143186
const cardName = `e2e-test-full-card-${Date.now()}`;
144187

@@ -153,48 +196,75 @@ test.describe(
153196
// Fill Name
154197
await modal.getByRole('textbox', { name: 'Name' }).fill(cardName);
155198

156-
// Select VFolder
157-
await modal.getByRole('combobox').first().click();
199+
// Select VFolder. In antd v6 with BAISelect, click .ant-select-content to open the dropdown.
200+
await modal
201+
.locator('.ant-form-item')
202+
.filter({ hasText: 'Model Storage Folder' })
203+
.locator('.ant-select-content')
204+
.click();
158205
const vfolderDropdown = page
159206
.locator('.ant-select-dropdown:not(.ant-select-dropdown-hidden)')
160207
.first();
161-
await expect(vfolderDropdown).toBeVisible();
208+
await expect(vfolderDropdown).toBeVisible({ timeout: 10000 });
162209
await expect(vfolderDropdown.getByText(/Total \d+ items/)).toBeVisible({
163210
timeout: 10000,
164211
});
165212
await vfolderDropdown.locator('.ant-select-item-option').first().click();
166213

167-
// Fill optional fields
214+
// Fill optional fields. In antd v6, tooltip icons alter the accessible name so
215+
// we locate textboxes via their parent form item label.
168216
await modal
169-
.getByRole('textbox', { name: 'Author (optional)' })
217+
.locator('.ant-form-item')
218+
.filter({ hasText: 'Author' })
219+
.getByRole('textbox')
170220
.fill('Test Author');
171221
await modal
172-
.getByRole('textbox', { name: 'Title (optional)' })
222+
.locator('.ant-form-item')
223+
.filter({ hasText: 'Title' })
224+
.getByRole('textbox')
173225
.fill('Test Model Title');
174226
await modal
175-
.getByRole('textbox', { name: 'Model Version (optional)' })
227+
.locator('.ant-form-item')
228+
.filter({ hasText: 'Model Version' })
229+
.getByRole('textbox')
176230
.fill('1.0.0');
177231
await modal
178-
.getByRole('textbox', { name: 'Description (optional)' })
232+
.locator('.ant-form-item')
233+
.filter({ hasText: 'Description' })
234+
.getByRole('textbox')
179235
.fill('This is a test model description');
180236
await modal
181-
.getByRole('textbox', { name: 'Task (optional)' })
237+
.locator('.ant-form-item')
238+
.filter({ hasText: 'Task' })
239+
.getByRole('textbox')
182240
.fill('text-generation');
183241
await modal
184-
.getByRole('textbox', { name: 'Category (optional)' })
242+
.locator('.ant-form-item')
243+
.filter({ hasText: 'Category' })
244+
.getByRole('textbox')
185245
.fill('LLM');
186246
await modal
187-
.getByRole('textbox', { name: 'Architecture (optional)' })
247+
.locator('.ant-form-item')
248+
.filter({ hasText: 'Architecture' })
249+
.getByRole('textbox')
188250
.fill('Transformer');
189251
await modal
190-
.getByRole('textbox', { name: 'License (optional)' })
252+
.locator('.ant-form-item')
253+
.filter({ hasText: 'License' })
254+
.getByRole('textbox')
191255
.fill('Apache-2.0');
192256
await modal
193-
.getByRole('textbox', { name: 'README.md (optional)' })
257+
.locator('.ant-form-item')
258+
.filter({ hasText: 'README.md' })
259+
.getByRole('textbox')
194260
.fill('# Test Model\nThis is a test model.');
195261

196262
// Change Access Level to Public
197-
await modal.getByRole('combobox', { name: 'Access Level' }).click();
263+
await modal
264+
.locator('.ant-form-item')
265+
.filter({ hasText: 'Access Level' })
266+
.locator('.ant-select-content')
267+
.click();
198268
await expect(
199269
page
200270
.locator('.ant-select-dropdown:not(.ant-select-dropdown-hidden)')
@@ -248,12 +318,17 @@ test.describe(
248318
const modal = adminModelCardPage.getCreateModal();
249319
await expect(modal).toBeVisible();
250320

251-
// Select a VFolder but leave Name empty
252-
await modal.getByRole('combobox').first().click();
321+
// Select a VFolder but leave Name empty.
322+
// In antd v6 with BAISelect, click .ant-select-content to open the dropdown.
323+
await modal
324+
.locator('.ant-form-item')
325+
.filter({ hasText: 'Model Storage Folder' })
326+
.locator('.ant-select-content')
327+
.click();
253328
const vfolderDropdown = page
254329
.locator('.ant-select-dropdown:not(.ant-select-dropdown-hidden)')
255330
.first();
256-
await expect(vfolderDropdown).toBeVisible();
331+
await expect(vfolderDropdown).toBeVisible({ timeout: 10000 });
257332
await expect(vfolderDropdown.getByText(/Total \d+ items/)).toBeVisible({
258333
timeout: 10000,
259334
});
@@ -283,7 +358,15 @@ test.describe(
283358
const modal = adminModelCardPage.getCreateModal();
284359
await expect(modal).toBeVisible();
285360

286-
// Fill Name but leave VFolder empty
361+
// Fill Name but leave VFolder empty.
362+
// Wait for the VFolder select to load out of Suspense before filling the name,
363+
// so the form field is registered and will fire validation on submit.
364+
await expect(
365+
modal
366+
.locator('.ant-form-item')
367+
.filter({ hasText: 'Model Storage Folder' })
368+
.locator('.ant-select-content'),
369+
).toBeVisible({ timeout: 15000 });
287370
await modal
288371
.getByRole('textbox', { name: 'Name' })
289372
.fill('test-no-vfolder');
@@ -292,7 +375,9 @@ test.describe(
292375
await adminModelCardPage.getCreateModalSubmitButton().click();
293376

294377
// Verify validation error "VFolder is required."
295-
await expect(modal.getByText('VFolder is required.')).toBeVisible();
378+
await expect(modal.getByText('VFolder is required.')).toBeVisible({
379+
timeout: 10000,
380+
});
296381

297382
// Verify the modal remains open
298383
await expect(modal).toBeVisible();

0 commit comments

Comments
 (0)