This commit is contained in:
wenpeng 2024-10-16 16:20:53 +08:00
parent 392fb7487b
commit 228c806846
5 changed files with 190 additions and 57 deletions

File diff suppressed because one or more lines are too long

111
.auth/mgj_admin.json Normal file
View File

@ -0,0 +1,111 @@
{
"cookies": [
{
"name": "realParentShopId",
"value": "1063590",
"domain": "vip1.meiguanjia.net",
"path": "/shair/",
"expires": 1763607851.35647,
"httpOnly": false,
"secure": false,
"sameSite": "Lax"
},
{
"name": "v",
"value": "mgj",
"domain": "vip1.meiguanjia.net",
"path": "/shair/",
"expires": 1763607851.356543,
"httpOnly": false,
"secure": false,
"sameSite": "Lax"
},
{
"name": "JSESSIONID",
"value": "6F73A614C651DB7F8F1F9EC08A03658D",
"domain": "vip1.meiguanjia.net",
"path": "/shair",
"expires": -1,
"httpOnly": true,
"secure": false,
"sameSite": "Lax"
},
{
"name": "shopId",
"value": "1063590",
"domain": ".meiguanjia.net",
"path": "/shair",
"expires": -1,
"httpOnly": false,
"secure": false,
"sameSite": "Lax"
},
{
"name": "userId",
"value": "1424506",
"domain": ".meiguanjia.net",
"path": "/shair",
"expires": -1,
"httpOnly": false,
"secure": false,
"sameSite": "Lax"
},
{
"name": "username",
"value": "%E5%B0%8F%E7%BE%8E%E7%BE%8E%E4%B8%9A",
"domain": "vip1.meiguanjia.net",
"path": "/shair",
"expires": 1729652651,
"httpOnly": false,
"secure": false,
"sameSite": "Lax"
},
{
"name": "token",
"value": "de064679-b32a-4617-9135-ca1289f568ae",
"domain": ".meiguanjia.net",
"path": "/shair",
"expires": -1,
"httpOnly": false,
"secure": false,
"sameSite": "Lax"
},
{
"name": "io",
"value": "x4_ZagMh7LMUnzzFGbNQ",
"domain": "socketlogin.meiguanjia.net",
"path": "/",
"expires": -1,
"httpOnly": true,
"secure": false,
"sameSite": "Lax"
}
],
"origins": [
{
"origin": "https://vip1.meiguanjia.net",
"localStorage": [
{
"name": "CLUSTER",
"value": "{\"cluster\":\"vip\",\"existence\":true,\"shopName\":\"小美美业3\",\"list\":[{\"id\":1424506,\"parentShopId\":1063590,\"shopId\":1063590,\"barberId\":null,\"barberName\":null,\"cardTypeId\":null,\"schemeIds\":null,\"cardtypeid\":null,\"softgenre\":null,\"token\":null,\"period\":null,\"startDatetime\":null,\"endDatetime\":null,\"fromHis\":0,\"lastUpdateTime\":null,\"operateStr\":null,\"powerStr\":null,\"descriptionFlag\":0,\"itemIdStr\":null,\"username\":null,\"openid\":null,\"role\":\"3\",\"name\":\"11\",\"roleStr\":null,\"type\":null,\"shopName\":\" \",\"shopIds\":null,\"qyWechatUserid\":null,\"status\":null,\"auditStatus\":null,\"mobile\":\"18900000001\",\"hqName\":\"小美美业3\",\"invaliddate\":1819512000000,\"shopStatus\":\"1\",\"mobileFlag\":false}],\"url\":\"https://vip1.meiguanjia.net/\"}"
},
{
"name": "SHAIR_NEW_MODE",
"value": "false"
},
{
"name": "renewalLastQueryTime",
"value": "1729047852587"
},
{
"name": "themeConfig",
"value": "1063590"
},
{
"name": "mgjversion",
"value": "3"
}
]
}
]
}

File diff suppressed because one or more lines are too long

6
.env
View File

@ -4,6 +4,10 @@ ACCOUNT=15500005555
PASSWORD=hlk123 PASSWORD=hlk123
SMSCODE=1660 SMSCODE=1660
ZHB_ACCOUNT=du1 ZHB_ACCOUNT=18571458300
ZHB_PASSWORD=1 ZHB_PASSWORD=1
ZHB_BASE_URL="https://shengyibao.meiguanjia.net/shair/components/shair-web/base-system/index.html#" ZHB_BASE_URL="https://shengyibao.meiguanjia.net/shair/components/shair-web/base-system/index.html#"
MGJ_ACCOUNT=小美美业
MGJ_PASSWORD=1
MGJ_BASE_URL="https://vip1.meiguanjia.net/shair/?v=mgj"

View File

@ -2,39 +2,53 @@ const { test: setup, expect } = require('@playwright/test');
const path = require('path'); const path = require('path');
const authFile = path.join(__dirname, '../.auth/admin.json'); const authFile = path.join(__dirname, '../.auth/admin.json');
const zhbAuthFile = path.join(__dirname, '../.auth/zhb_admin.json'); const zhbAuthFile = path.join(__dirname, '../.auth/zhb_admin.json');
const mgjAuthFile = path.join(__dirname, '../.auth/mgj_admin.json');
setup('hlk总部管理员登录', async ({ page, baseURL }) => { setup('hlk总部管理员登录', async ({ page, baseURL }) => {
const $account = page.getByRole('textbox', { name: '请输入您的手机号码' }); const $account = page.getByRole('textbox', { name: '请输入您的手机号码' });
const $password = page.getByRole('textbox', { name: '请输入登录密码' }); const $password = page.getByRole('textbox', { name: '请输入登录密码' });
const $loginBtn = page.getByRole('button', { name: /登\s录/ }); const $loginBtn = page.getByRole('button', { name: /登\s录/ });
const account = process.env.ACCOUNT; const account = process.env.ACCOUNT;
const password = process.env.PASSWORD; const password = process.env.PASSWORD;
await page.goto(baseURL); await page.goto(baseURL);
await $account.fill(account); await $account.fill(account);
const phoneStatsIcon = page.locator('.ant-row', { has: $account }).locator('.pass_svg'); const phoneStatsIcon = page.locator('.ant-row', { has: $account }).locator('.pass_svg');
await $password.fill(password); await $password.fill(password);
await page.getByLabel('请同意慧来客隐私政策和用户协议').check(); await page.getByLabel('请同意慧来客隐私政策和用户协议').check();
await expect(phoneStatsIcon).toBeVisible(); await expect(phoneStatsIcon).toBeVisible();
await $loginBtn.click(); await $loginBtn.click();
await expect(page.getByRole('button', { name: /开\s单/ })).toBeVisible(); await expect(page.getByRole('button', { name: /开\s单/ })).toBeVisible();
await page.context().storageState({ path: authFile }); await page.context().storageState({ path: authFile });
}); });
setup('zhb总部管理员登录', async ({ page }) => { setup('zhb总部管理员登录', async ({ page }) => {
const baseURL = process.env.ZHB_BASE_URL; const baseURL = process.env.ZHB_BASE_URL;
const $account = page.getByPlaceholder('账户'); const account = process.env.ZHB_ACCOUNT;
const $password = page.getByPlaceholder('密码'); const password = process.env.ZHB_PASSWORD;
const $loginBtn = page.getByRole('button', { name: /登\s录/ });
const account = process.env.ZHB_ACCOUNT; const $account = page.getByPlaceholder('账户');
const password = process.env.ZHB_PASSWORD; const $password = page.getByPlaceholder('密码');
const $loginBtn = page.getByRole('button', { name: /登\s录/ });
await page.goto(baseURL); await page.goto(baseURL);
await $account.fill(account); await $account.fill(account);
await $password.fill(password); await $password.fill(password);
await $loginBtn.click(); await $loginBtn.click();
await expect(page.getByRole('heading', { name: '收银' })).toBeVisible(); await expect(page.getByRole('heading', { name: '收银' })).toBeVisible();
await page.context().storageState({ path: zhbAuthFile }); await page.context().storageState({ path: zhbAuthFile });
});
setup('mgj管理员登录', async ({ page }) => {
const baseURL = process.env.MGJ_BASE_URL;
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 });
}); });