import { test as base, expect } from '@playwright/test'; import { HomeNavigation } from '@/pages/homeNavigationPage'; import { firstAccount, secondAccount, AuthAccount } from '@/common/auth'; type MyFixture = { homeNavigation: HomeNavigation; billSet: Set; }; export const test = base.extend({ page: async ({ page, baseURL }, use) => { await page.addLocatorHandler(page.locator('.left_img > .close_btn > .close_icon > svg'), async () => { await page.locator('.left_img > .close_btn > .close_icon > svg').click(); await expect(page.locator('.versionModal_main_content')).toBeVisible(); }); try { await page.goto(baseURL!, { timeout: 90 * 1000 }); } catch (error) { console.log(error); // await page.screenshot({ path: 'error.png' }); await page.reload(); } // await page.getByRole('button', { name: /开\s单/ }).waitFor(); await expect(page.getByRole('button', { name: /开\s单/ })).toBeEnabled(); await page.reload(); await page.getByRole('button', { name: /开\s单/ }).click(); // await page.getByRole('button', { name: /开\s单/ }).waitFor(); await expect(page.getByRole('button', { name: '创建会员' })).toBeEnabled(); await page.locator('.top > .anticon').first().click(); await expect(page.getByRole('button', { name: '创建会员' })).not.toBeVisible(); await expect(page.getByRole('button', { name: /开\s单/ })).toBeInViewport(); await use(page); }, /** * 首页导航 */ homeNavigation: async ({ page }, use) => { const homeNavigation = new HomeNavigation(page); await use(homeNavigation); }, /** * 流水单据集合(无重复水单) */ billSet: async ({ page }, use) => { const billSet = new Set(); await use(billSet); }, }); export { expect } from '@playwright/test';