Skip to content

Commit aeff57c

Browse files
committed
feat(e2e): add statefulset list e2e test
Signed-off-by: SunsetB612 <[email protected]>
1 parent dd5346d commit aeff57c

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
Copyright 2024 The Karmada Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// apps/dashboard/e2e/namespace-list.spec.ts
18+
import { test, expect } from '@playwright/test';
19+
20+
// Set webServer.url and use.baseURL with the location of the WebServer
21+
const HOST = process.env.HOST || 'localhost';
22+
const PORT = process.env.PORT || 5173;
23+
const baseURL = `http://${HOST}:${PORT}`;
24+
const basePath = '/multicloud-resource-manage';
25+
const token = process.env.KARMADA_TOKEN || '';
26+
27+
test.beforeEach(async ({ page }) => {
28+
await page.goto(`${baseURL}/login`, { waitUntil: 'networkidle' });
29+
await page.evaluate((t) => localStorage.setItem('token', t), token);
30+
await page.goto(`${baseURL}${basePath}`, { waitUntil: 'networkidle' });
31+
await page.evaluate((t) => localStorage.setItem('token', t), token);
32+
await page.reload({ waitUntil: 'networkidle' });
33+
await page.waitForSelector('text=Overview', { timeout: 30000 });
34+
});
35+
36+
test('should display statefulset list', async ({ page }) => {
37+
// 打开 Workloads 菜单
38+
await page.click('text=Workloads');
39+
40+
// 点击可见的 Statefulset tab
41+
const statefulsetTab = page.locator('role=option[name="Statefulset"]');
42+
await statefulsetTab.waitFor({ state: 'visible', timeout: 30000 });
43+
await statefulsetTab.click();
44+
45+
// 验证选中状态
46+
await expect(statefulsetTab).toHaveAttribute('aria-selected', 'true');
47+
48+
49+
// 验证 StatefulSet 列表表格可见
50+
const table = page.locator('table');
51+
await expect(table).toBeVisible({ timeout: 30000 });
52+
53+
// Debug
54+
if (process.env.DEBUG === 'true') {
55+
await page.screenshot({ path: 'debug-statefulset-list.png', fullPage: true });
56+
}
57+
});

0 commit comments

Comments
 (0)