22 lines
1.0 KiB
JavaScript
22 lines
1.0 KiB
JavaScript
const { test: setup, expect } = require('@playwright/test');
|
|
const path = require('path');
|
|
const hlkAuthFile = path.join(process.cwd(), '.auth', 'hlk_admin.json');
|
|
|
|
setup('hlk总部管理员登录', async ({ page, baseURL }) => {
|
|
const $account = page.getByRole('textbox', { name: '请输入您的手机号码' });
|
|
const $password = page.getByRole('textbox', { name: '请输入登录密码' });
|
|
const $loginBtn = page.getByRole('button', { name: /登\s录/ });
|
|
|
|
const account = process.env.ACCOUNT;
|
|
const password = process.env.PASSWORD;
|
|
|
|
await page.goto(baseURL);
|
|
await $account.fill(account);
|
|
const phoneStatsIcon = page.locator('.ant-row', { has: $account }).locator('.pass_svg');
|
|
await $password.fill(password);
|
|
await page.getByLabel('请同意慧来客隐私政策和用户协议').check();
|
|
await expect(phoneStatsIcon).toBeVisible();
|
|
await $loginBtn.click();
|
|
await expect(page.getByRole('button', { name: /开\s单/ })).toBeVisible();
|
|
await page.context().storageState({ path: hlkAuthFile });
|
|
}); |