19 lines
885 B
JavaScript
19 lines
885 B
JavaScript
const { test: setup, expect } = require('@playwright/test');
|
|
const path = require('path');
|
|
const zhbAuthFile = path.join(process.cwd(), '.auth', 'zhb.json');
|
|
|
|
setup('zhb总部管理员登录', async ({ page, baseURL }) => {
|
|
const account = process.env.ZHB_ACCOUNT;
|
|
const password = process.env.ZHB_PASSWORD;
|
|
|
|
await page.goto(baseURL);
|
|
await expect(page.getByText('登录', { exact: true })).toBeEnabled();
|
|
await page.getByPlaceholder('用户名').fill(account);
|
|
await page.getByPlaceholder('密码', { exact: true }).fill(password);
|
|
await page.getByText('登录', { exact: true }).click();
|
|
await expect(page.getByText('演示一店')).toBeVisible();
|
|
await page.getByText('演示一店', { exact: true }).click();
|
|
await expect(page.locator('#tab_main li').filter({ hasText: '营业' })).toBeVisible();
|
|
await page.context().storageState({ path: zhbAuthFile });
|
|
});
|