playwright-demo/tests/cad/cd.test.ts
2025-05-08 14:47:15 +08:00

54 lines
2.2 KiB
TypeScript

import { test, expect } from '@playwright/test';
test('webcad-cd', async ({ page }) => {
await page.goto('https://t.cfcad.cn/');
await page.getByPlaceholder('请输入您的账号').click();
await page.getByPlaceholder('请输入您的账号').fill('zc3');
await page.getByPlaceholder('请输入您的账号').press('Tab');
await page.getByPlaceholder('请输入您的密码').fill('123456');
await page.getByRole('button', { name: '登录' }).click();
await page.getByRole('button', { name: '开始设计>>' }).click();
await page.getByRole('listitem', { name: '左右侧板 LEFTRIGHTBOARD' }).getByRole('img').click();
await page.getByRole('button', { name: '确定' }).click();
await page.locator('canvas').nth(1).click({
position: {
x: 483,
y: 381
}
});
await page.getByText('顶底板').click();
await page.getByRole('button', { name: '确定' }).click();
await page.locator('canvas').nth(1).click({
position: {
x: 520,
y: 377
}
});
await page.getByPlaceholder('请输入命令:').click();
await page.getByPlaceholder('请输入命令:').fill('cd');
await page.getByPlaceholder('请输入命令:').press('Enter');
await page.locator('canvas').nth(1).click({
position: {
x: 826,
y: 447
}
});
await page.locator('canvas').nth(1).click({
position: {
x: 402,
y: 57
}
});
await page.locator('body').press('Enter');
await page.frameLocator('iframe').getByRole('cell', { name: '|||' }).click();
await page.frameLocator('iframe').locator('td:nth-child(3) > .cell').first().dblclick();
await page.frameLocator('iframe').getByRole('button', { name: '下一步' }).click();
await page.frameLocator('iframe').getByPlaceholder('请输入内容').nth(1).click();
await page.frameLocator('iframe').getByPlaceholder('请输入内容').nth(1).fill('11');
await page.frameLocator('iframe').getByPlaceholder('请输入内容').nth(2).click();
await page.frameLocator('iframe').getByPlaceholder('请输入内容').nth(2).fill('2222');
await page.frameLocator('iframe').locator('#app').click();
const page1Promise = page.waitForEvent('popup');
await page.frameLocator('iframe').getByRole('button', { name: '保存' }).click();
const page1 = await page1Promise;
});