From b2194e5950fe5ea3ff3c6a2268cc943fcdf29542 Mon Sep 17 00:00:00 2001 From: xief <1789784602@qq.com> Date: Thu, 8 May 2025 14:47:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=86=E5=8D=95=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/cad/cd.test.ts | 54 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 tests/cad/cd.test.ts diff --git a/tests/cad/cd.test.ts b/tests/cad/cd.test.ts new file mode 100644 index 0000000..24e60f7 --- /dev/null +++ b/tests/cad/cd.test.ts @@ -0,0 +1,54 @@ +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; +}); \ No newline at end of file