Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

前端Playwright测试框架 #6

Open
wjymtg opened this issue Dec 9, 2024 · 0 comments
Open

前端Playwright测试框架 #6

wjymtg opened this issue Dec 9, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@wjymtg
Copy link
Collaborator

wjymtg commented Dec 9, 2024

我看了下comfy的前端测试,他们相当于是在Playwright的基础上又搭了一套框架,咱们没必要搞那么复杂,直接用Playwright就行。

虽然没法直接操作canvas里的节点,但是可以根据xy定位操作,只需要一些固定的测试用工作流。下面这段代码就是一个简单的节点移动测试:
test('move node test', async ({ page }) => {
await page.goto('http://127.0.0.1:8188/');
await page.waitForTimeout(1000);
await page.getByLabel('Workflows (w)').click();
await page.getByLabel('BizyAirMoveTest.json').locator('div').first().click();
await page.locator('#graph-canvas').click({
position: {
x: 732,
y: 259
}
});
await page.mouse.down();
await page.mouse.move(1058, 204);
await page.mouse.up();
await expect(page).toHaveScreenshot('move_node.png');
});
效果如下:

2024-12-09.18-31-58.mp4

当然还有很多要考虑,比如测试怎么写保障通用、需要哪些测试、github action怎么触发等等。
我计划先搭好workflow写几个示例,后面慢慢完善。

@wjymtg wjymtg added the enhancement New feature or request label Dec 9, 2024
@wjymtg wjymtg self-assigned this Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant