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(); }); if (!baseURL) throw new Error('baseURL is required'); await page.goto(baseURL); // 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';