17 lines
678 B
JavaScript
17 lines
678 B
JavaScript
const { test: setup, expect } = require('@playwright/test');
|
|
const path = require('path');
|
|
const mgjAuthFile = path.join(__dirname, '../../.auth/mgj_admin.json');
|
|
|
|
|
|
setup('mgj管理员登录', async ({ page,baseURL }) => {
|
|
const account = process.env.MGJ_ACCOUNT;
|
|
const password = process.env.MGJ_PASSWORD;
|
|
|
|
await page.goto(baseURL);
|
|
await page.getByPlaceholder('请输入您的用户名').fill(account);
|
|
await page.getByPlaceholder('请输入密码').fill(password);
|
|
await page.getByText('登录', { exact: true }).click();
|
|
await expect(page.getByRole('link', { name: '管理层' })).toBeVisible();
|
|
await page.context().storageState({ path: mgjAuthFile });
|
|
});
|