Compare commits
20 Commits
3547f32493
...
d44f457d86
| Author | SHA1 | Date | |
|---|---|---|---|
| d44f457d86 | |||
| 356a048508 | |||
| 52365501f0 | |||
| 3f45ac233f | |||
| 554ea2408d | |||
| 88eae96f63 | |||
| bac0dbfdbe | |||
|
|
fad6c46850 | ||
|
|
86311180c2 | ||
|
|
98962f3e31 | ||
|
|
b2911faee1 | ||
|
|
7accd0ce75 | ||
|
|
afe574d2ca | ||
| fadfbe60fc | |||
| e2df441b75 | |||
| 91e31e348e | |||
| 439779dd56 | |||
| 93266d7aa8 | |||
| 56ca150b6e | |||
| b86b14a9a4 |
@ -1,29 +1,30 @@
|
|||||||
stages:
|
|
||||||
- test
|
|
||||||
- report
|
|
||||||
|
|
||||||
playwright_tests:
|
playwright_tests:
|
||||||
stage: test
|
stage: test
|
||||||
image: mcr.microsoft.com/playwright:focal
|
image: mcr.microsoft.com/playwright:v1.51.0-noble
|
||||||
|
timeout: 60 minutes
|
||||||
|
cache:
|
||||||
|
key: $CI_COMMIT_REF_SLUG
|
||||||
|
paths:
|
||||||
|
- node_modules/
|
||||||
|
before_script:
|
||||||
|
- npm config set registry https://registry.npmmirror.com
|
||||||
script:
|
script:
|
||||||
- npm install
|
- npm install
|
||||||
- npx playwright install
|
- npx playwright test /touch/boss_cashier.spec.ts --project '慧来客touch(管理员身份) - Desktop Chrome'
|
||||||
- npx playwright test
|
after_script:
|
||||||
|
- |
|
||||||
|
if [ "$CI_JOB_STATUS" == "success" ]; then
|
||||||
|
echo "Tests passed! Sending success message..."
|
||||||
|
else
|
||||||
|
echo "Tests failed! Sending failure message..."
|
||||||
|
fi
|
||||||
|
- ls -la playwright-report/
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- test-results/
|
- playwright-report/
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
|
when: always
|
||||||
send_report:
|
tags:
|
||||||
stage: report
|
- test
|
||||||
image: alpine:latest
|
|
||||||
script:
|
|
||||||
- apk add --no-cache curl
|
|
||||||
- |
|
|
||||||
if [ -d test-results ]; then
|
|
||||||
echo "Test Successful."
|
|
||||||
else
|
|
||||||
echo "No test results found."
|
|
||||||
fi
|
|
||||||
only:
|
only:
|
||||||
- main
|
- main
|
||||||
@ -17,7 +17,7 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@faker-js/faker": "^8.4.1",
|
"@faker-js/faker": "^8.4.1",
|
||||||
"@playwright/test": "^1.48.2",
|
"@playwright/test": "^1.51.1",
|
||||||
"@types/node": "^22.3.0",
|
"@types/node": "^22.3.0",
|
||||||
"axios": "^1.7.4",
|
"axios": "^1.7.4",
|
||||||
"cross-env": "^7.0.3"
|
"cross-env": "^7.0.3"
|
||||||
@ -31,7 +31,7 @@
|
|||||||
"ldap": "^0.7.1",
|
"ldap": "^0.7.1",
|
||||||
"ldap-authentication": "^3.2.2",
|
"ldap-authentication": "^3.2.2",
|
||||||
"ldapjs": "^3.0.7",
|
"ldapjs": "^3.0.7",
|
||||||
"playwright": "^1.47.2",
|
"playwright": "^1.51.1",
|
||||||
"qrcode-reader": "^1.0.4",
|
"qrcode-reader": "^1.0.4",
|
||||||
"sharp": "^0.33.5",
|
"sharp": "^0.33.5",
|
||||||
"tesseract.js": "^5.1.1",
|
"tesseract.js": "^5.1.1",
|
||||||
|
|||||||
@ -55,7 +55,7 @@ module.exports = defineConfig({
|
|||||||
|
|
||||||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
||||||
hasTouch: true,
|
hasTouch: true,
|
||||||
trace: 'retain-on-failure',
|
trace: 'on',
|
||||||
screenshot: 'only-on-failure',
|
screenshot: 'only-on-failure',
|
||||||
timezoneId: 'Asia/Shanghai',
|
timezoneId: 'Asia/Shanghai',
|
||||||
locale: 'zh-CN',
|
locale: 'zh-CN',
|
||||||
@ -87,7 +87,7 @@ module.exports = defineConfig({
|
|||||||
...devices['Desktop Chrome'],
|
...devices['Desktop Chrome'],
|
||||||
baseURL: process.env.BASE_URL,
|
baseURL: process.env.BASE_URL,
|
||||||
storageState: firstAuthFile,
|
storageState: firstAuthFile,
|
||||||
viewport: { width: 1280, height: 720 },
|
// viewport: { width: 1280, height: 720 },
|
||||||
isMobile: true,
|
isMobile: true,
|
||||||
},
|
},
|
||||||
testMatch: /.*boss_.*\.spec\.ts/,
|
testMatch: /.*boss_.*\.spec\.ts/,
|
||||||
@ -99,7 +99,7 @@ module.exports = defineConfig({
|
|||||||
...devices['Desktop Safari'],
|
...devices['Desktop Safari'],
|
||||||
baseURL: process.env.BASE_URL,
|
baseURL: process.env.BASE_URL,
|
||||||
storageState: firstAuthFile,
|
storageState: firstAuthFile,
|
||||||
viewport: { width: 1280, height: 720 },
|
// viewport: { width: 1280, height: 720 },
|
||||||
isMobile: true,
|
isMobile: true,
|
||||||
},
|
},
|
||||||
testMatch: /.*boss_.*\.spec\.ts/,
|
testMatch: /.*boss_.*\.spec\.ts/,
|
||||||
@ -110,7 +110,7 @@ module.exports = defineConfig({
|
|||||||
use: {
|
use: {
|
||||||
...devices['Desktop Chrome'],
|
...devices['Desktop Chrome'],
|
||||||
baseURL: process.env.BASE_URL,
|
baseURL: process.env.BASE_URL,
|
||||||
viewport: { width: 1280, height: 720 },
|
// viewport: { width: 1280, height: 720 },
|
||||||
isMobile: false,
|
isMobile: false,
|
||||||
},
|
},
|
||||||
testMatch: /.*staff_.*\.spec\.ts/,
|
testMatch: /.*staff_.*\.spec\.ts/,
|
||||||
@ -121,7 +121,7 @@ module.exports = defineConfig({
|
|||||||
use: {
|
use: {
|
||||||
...devices['Desktop Safari'],
|
...devices['Desktop Safari'],
|
||||||
baseURL: process.env.BASE_URL,
|
baseURL: process.env.BASE_URL,
|
||||||
viewport: { width: 1280, height: 720 },
|
// viewport: { width: 1280, height: 720 },
|
||||||
isMobile: false,
|
isMobile: false,
|
||||||
},
|
},
|
||||||
testMatch: /.*staff_.*\.spec\.ts/,
|
testMatch: /.*staff_.*\.spec\.ts/,
|
||||||
|
|||||||
13
tests/fixtures/baseFixture.ts
vendored
13
tests/fixtures/baseFixture.ts
vendored
@ -14,8 +14,13 @@ export const test = base.extend<MyFixture>({
|
|||||||
await expect(page.locator('.versionModal_main_content')).toBeVisible();
|
await expect(page.locator('.versionModal_main_content')).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!baseURL) throw new Error('baseURL is required');
|
try {
|
||||||
await page.goto(baseURL);
|
await page.goto(baseURL!, { timeout: 90 * 1000 });
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
// await page.screenshot({ path: 'error.png' });
|
||||||
|
await page.reload();
|
||||||
|
}
|
||||||
// await page.getByRole('button', { name: /开\s单/ }).waitFor();
|
// await page.getByRole('button', { name: /开\s单/ }).waitFor();
|
||||||
await expect(page.getByRole('button', { name: /开\s单/ })).toBeEnabled();
|
await expect(page.getByRole('button', { name: /开\s单/ })).toBeEnabled();
|
||||||
|
|
||||||
@ -24,7 +29,9 @@ export const test = base.extend<MyFixture>({
|
|||||||
await page.getByRole('button', { name: /开\s单/ }).click();
|
await page.getByRole('button', { name: /开\s单/ }).click();
|
||||||
// await page.getByRole('button', { name: /开\s单/ }).waitFor();
|
// await page.getByRole('button', { name: /开\s单/ }).waitFor();
|
||||||
await expect(page.getByRole('button', { name: '创建会员' })).toBeEnabled();
|
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);
|
await use(page);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -339,22 +339,55 @@ export class CustomerPage {
|
|||||||
* @param {string} phone 手机号
|
* @param {string} phone 手机号
|
||||||
*/
|
*/
|
||||||
private readonly confirmCreation = async (phone: string) => {
|
private readonly confirmCreation = async (phone: string) => {
|
||||||
const [response] = await Promise.all([
|
try {
|
||||||
this.page.waitForResponse(async res => res.url().includes('/invalid_check') && (await res.json()).code === 'SUCCESS'),
|
// 等待响应并点击按钮
|
||||||
this.page.getByRole('button', { name: '确认创建' }).click(),
|
const [response] = await Promise.all([
|
||||||
]);
|
this.page.waitForResponse(async (res) => {
|
||||||
const responseBody = await response.json();
|
const urlMatch = res.url().includes('/invalid_check');
|
||||||
|
if (!urlMatch) return false;
|
||||||
const phoneStatus = responseBody?.content?.status;
|
try {
|
||||||
if (phoneStatus === undefined || phoneStatus === null) {
|
const json = await res.json();
|
||||||
// 创建顾客成功
|
return json.code === 'SUCCESS';
|
||||||
return;
|
} catch (e) {
|
||||||
|
console.error('解析响应体失败:', e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
this.page.getByRole('button', { name: '确认创建' }).click(),
|
||||||
|
]);
|
||||||
|
|
||||||
|
// 解析响应体
|
||||||
|
let responseBody: any;
|
||||||
|
try {
|
||||||
|
responseBody = await response.json();
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error('无法解析服务器响应体,请检查网络连接或服务器状态');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查响应体内容
|
||||||
|
if (responseBody && typeof responseBody.content === 'object') {
|
||||||
|
const phoneStatus = responseBody.content?.status;
|
||||||
|
|
||||||
|
if (phoneStatus != null) {
|
||||||
|
throw new Error(`手机号码 ${phone} 已被使用,无法创建新顾客`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warn('响应体格式不符合预期,content 不是对象');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
// 捕获并记录异常
|
||||||
|
console.error('检查手机号码时发生错误:', error);
|
||||||
|
throw error; // 重新抛出异常以便调用方处理
|
||||||
}
|
}
|
||||||
await this.page.getByText('系统查询到当前手机号被建档后转为无效客,是否要恢复无效客?').waitFor();
|
|
||||||
await this.page.getByRole('button', { name: '重新建档' }).click();
|
|
||||||
const popupWindow = this.page.locator('.ant-message');
|
|
||||||
|
|
||||||
await expect(popupWindow).not.toContainText('该手机号码已经被使用');
|
// if (phoneStatus === undefined || phoneStatus === null) {
|
||||||
|
// 创建顾客成功
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// await this.page.getByText('系统查询到当前手机号被建档后转为无效客,是否要恢复无效客?').waitFor();
|
||||||
|
// await this.page.getByRole('button', { name: '重新建档' }).click();
|
||||||
|
// const popupWindow = this.page.locator('.ant-message');
|
||||||
|
// await expect(popupWindow).not.toContainText('该手机号码已经被使用');
|
||||||
|
|
||||||
// await popupWindow.waitFor();
|
// await popupWindow.waitFor();
|
||||||
// const popupContent = (await popupWindow.innerText()).trim();
|
// const popupContent = (await popupWindow.innerText()).trim();
|
||||||
|
|||||||
@ -18,7 +18,13 @@ for (let testAccount of testAccountArray) {
|
|||||||
.locator('div', { has: page.getByRole('textbox', { name: '请输入您的手机号码' }) })
|
.locator('div', { has: page.getByRole('textbox', { name: '请输入您的手机号码' }) })
|
||||||
.locator('.pass_svg');
|
.locator('.pass_svg');
|
||||||
|
|
||||||
await page.goto(baseURL!);
|
try {
|
||||||
|
await page.goto(baseURL!, { timeout: 90 * 1000 });
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
await page.bringToFront();
|
||||||
|
await page.reload();
|
||||||
|
}
|
||||||
await page.getByRole('textbox', { name: '请输入您的手机号码' }).fill(account);
|
await page.getByRole('textbox', { name: '请输入您的手机号码' }).fill(account);
|
||||||
await page.getByRole('textbox', { name: '请输入登录密码' }).fill(password);
|
await page.getByRole('textbox', { name: '请输入登录密码' }).fill(password);
|
||||||
await page.getByLabel('请同意慧来客隐私政策和用户协议').check();
|
await page.getByLabel('请同意慧来客隐私政策和用户协议').check();
|
||||||
@ -41,6 +47,6 @@ for (let testAccount of testAccountArray) {
|
|||||||
await page.getByRole('button', { name: /登\s录/ }).click();
|
await page.getByRole('button', { name: /登\s录/ }).click();
|
||||||
await page.getByRole('button', { name: /开\s单/ }).waitFor();
|
await page.getByRole('button', { name: /开\s单/ }).waitFor();
|
||||||
}
|
}
|
||||||
await page.context().storageState({ path: authFile });
|
await page.context().storageState({ path: authFile, indexedDB: true });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@ setup.describe('员工登录', () => {
|
|||||||
await page.getByLabel('请同意慧来客隐私政策和用户协议').check();
|
await page.getByLabel('请同意慧来客隐私政策和用户协议').check();
|
||||||
await $login.click();
|
await $login.click();
|
||||||
await expect(page.getByRole('button', { name: /开\s单/ })).toBeEnabled();
|
await expect(page.getByRole('button', { name: /开\s单/ })).toBeEnabled();
|
||||||
await page.context().storageState({ path: e.authFile });
|
await page.context().storageState({ path: e.authFile, indexedDB: true });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -37,31 +37,15 @@ test.describe('挂单', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('查看员工名下挂单', async ({ page, customerPage }) => {
|
test('查看员工名下挂单', async ({ page, customerPage }) => {
|
||||||
let OrderLQ = 0;
|
const $employeeBottom = page.locator('.userpanel_item');
|
||||||
let OrderZP = 0;
|
const employeeLq = $employeeBottom.getByText(Employees.FirstShop.Employee_8.name);
|
||||||
await test.step('记录员工原挂单数量', async () => {
|
const employeeZp = $employeeBottom.getByText(Employees.FirstShop.Employee_9.name);
|
||||||
// 点击底部员工刘强
|
|
||||||
const EmployeeLQ = page.locator('.userpanel_item').getByText(Employees.FirstShop.Employee_8.name);
|
|
||||||
if (await EmployeeLQ.isVisible()) {
|
|
||||||
await page.locator('.userpanel_item').filter({ hasText: Employees.FirstShop.Employee_8.name }).click();
|
|
||||||
await page.locator('.item_box').first().waitFor();
|
|
||||||
OrderLQ = await page.locator('.item_box').count();
|
|
||||||
} else {
|
|
||||||
OrderLQ = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 点击底部员工周萍
|
const $employeeLq = page.locator('.counselor:nth-child(2)').locator('.check_item:nth-child(1)').filter({ hasText: Employees.FirstShop.Employee_8.name });
|
||||||
const EmployeeZP = page.locator('.userpanel_item', { hasText: Employees.FirstShop.Employee_9.name });
|
|
||||||
if (await EmployeeZP.isVisible()) {
|
|
||||||
await page.locator('.userpanel_item').filter({ hasText: Employees.FirstShop.Employee_9.name }).click();
|
|
||||||
await page.locator('.item_box').first().waitFor();
|
|
||||||
OrderZP = await page.locator('.item_box').count();
|
|
||||||
} else {
|
|
||||||
OrderZP = 0;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
await test.step('刘强挂单1', async () => {
|
const $$pendingOrderCard = page.locator('.cash_content .list .item_box');
|
||||||
|
|
||||||
|
await test.step('刘强挂单', async () => {
|
||||||
//员工1开第1单
|
//员工1开第1单
|
||||||
await page.getByRole('button', { name: /^开\s单$/ }).click();
|
await page.getByRole('button', { name: /^开\s单$/ }).click();
|
||||||
await customerPage.searchCustomer(phone);
|
await customerPage.searchCustomer(phone);
|
||||||
@ -71,61 +55,18 @@ test.describe('挂单', () => {
|
|||||||
// 选择添加员工
|
// 选择添加员工
|
||||||
await page.locator('button.staff_btn').click();
|
await page.locator('button.staff_btn').click();
|
||||||
// 选择员工:刘强
|
// 选择员工:刘强
|
||||||
await page
|
await $employeeLq.click();
|
||||||
.locator('.counselor:nth-child(2)')
|
|
||||||
.locator('.check_item:nth-child(1)')
|
|
||||||
.filter({ hasText: Employees.FirstShop.Employee_8.name })
|
|
||||||
.click();
|
|
||||||
// 保存并复制到其他项目
|
// 保存并复制到其他项目
|
||||||
await page.locator('button.save_and_copy').filter({ hasText: '保存并复制到其他项目/卖品' }).click();
|
await page.locator('button.save_and_copy').filter({ hasText: '保存并复制到其他项目/卖品' }).click();
|
||||||
// 挂单
|
// 挂单
|
||||||
await page.locator('#cart_bottom_btn').getByText('挂单').click();
|
await page.locator('#cart_bottom_btn').getByText('挂单').click();
|
||||||
|
await expect.soft($$pendingOrderCard.first()).toContainText(`${username}`);
|
||||||
|
await expect($$pendingOrderCard.first()).toContainText(`${Employees.FirstShop.Employee_8.name}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
await test.step('刘强挂单2', async () => {
|
const $employeeZp = page.locator('.counselor:nth-child(2)').locator('.check_item:nth-child(1)').filter({ hasText: Employees.FirstShop.Employee_9.name });
|
||||||
//员工1开第2单
|
|
||||||
await page.getByRole('button', { name: /^开\s单$/ }).click();
|
|
||||||
await customerPage.searchCustomer(phone);
|
|
||||||
await customerPage.selectSearchCustomer(username);
|
|
||||||
|
|
||||||
// 选择第三个项目
|
await test.step('周萍挂单', async () => {
|
||||||
await page.locator('.project_list').filter({ hasText: ProjectName.Projects.Projects_3.name }).click();
|
|
||||||
// 选择添加员工
|
|
||||||
await page.locator('button.staff_btn').click();
|
|
||||||
// 选择员工:刘强
|
|
||||||
await page
|
|
||||||
.locator('.counselor:nth-child(2)')
|
|
||||||
.locator('.check_item:nth-child(1)')
|
|
||||||
.filter({ hasText: Employees.FirstShop.Employee_8.name })
|
|
||||||
.click();
|
|
||||||
// 保存并复制到其他项目
|
|
||||||
await page.locator('button.save_and_copy').filter({ hasText: '保存并复制到其他项目/卖品' }).click();
|
|
||||||
// 挂单
|
|
||||||
await page.locator('#cart_bottom_btn').getByText('挂单').click();
|
|
||||||
});
|
|
||||||
|
|
||||||
await test.step('刘强挂单3', async () => {
|
|
||||||
//员工1开第3单
|
|
||||||
await page.getByRole('button', { name: /^开\s单$/ }).click();
|
|
||||||
await customerPage.searchCustomer(phone);
|
|
||||||
await customerPage.selectSearchCustomer(username);
|
|
||||||
// 选择第二个项目
|
|
||||||
await page.locator('.project_list').filter({ hasText: ProjectName.Projects.Projects_2.name }).click();
|
|
||||||
// 选择添加员工
|
|
||||||
await page.locator('button.staff_btn').click();
|
|
||||||
// 选择员工:刘强
|
|
||||||
await page
|
|
||||||
.locator('.counselor:nth-child(2)')
|
|
||||||
.locator('.check_item:nth-child(1)')
|
|
||||||
.filter({ hasText: Employees.FirstShop.Employee_8.name })
|
|
||||||
.click();
|
|
||||||
// 保存并复制到其他项目
|
|
||||||
await page.locator('button.save_and_copy').filter({ hasText: '保存并复制到其他项目/卖品' }).click();
|
|
||||||
// 挂单
|
|
||||||
await page.locator('#cart_bottom_btn').getByText('挂单').click();
|
|
||||||
});
|
|
||||||
|
|
||||||
await test.step('周萍挂单1', async () => {
|
|
||||||
//员工2开第1单
|
//员工2开第1单
|
||||||
await page.getByRole('button', { name: /^开\s单$/ }).click();
|
await page.getByRole('button', { name: /^开\s单$/ }).click();
|
||||||
await customerPage.searchCustomer(phone);
|
await customerPage.searchCustomer(phone);
|
||||||
@ -137,54 +78,25 @@ test.describe('挂单', () => {
|
|||||||
// 选择添加员工
|
// 选择添加员工
|
||||||
await page.locator('button.staff_btn').click();
|
await page.locator('button.staff_btn').click();
|
||||||
// 选择员工:周萍
|
// 选择员工:周萍
|
||||||
await page
|
await $employeeZp.click();
|
||||||
.locator('.counselor:nth-child(2)')
|
|
||||||
.locator('.check_row:nth-child(2) .check_item:nth-child(1)')
|
|
||||||
.filter({ hasText: Employees.FirstShop.Employee_9.name })
|
|
||||||
.click();
|
|
||||||
// 保存并复制到其他项目
|
// 保存并复制到其他项目
|
||||||
await page.locator('button.save_and_copy').filter({ hasText: '保存并复制到其他项目/卖品' }).click();
|
await page.locator('button.save_and_copy').filter({ hasText: '保存并复制到其他项目/卖品' }).click();
|
||||||
// 挂单
|
// 挂单
|
||||||
await page.locator('#cart_bottom_btn').getByText('挂单').click();
|
await page.locator('#cart_bottom_btn').getByText('挂单').click();
|
||||||
|
await expect.soft($$pendingOrderCard.first()).toContainText(`${username}`);
|
||||||
|
await expect($$pendingOrderCard.first()).toContainText(`${Employees.FirstShop.Employee_9.name}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
await test.step('周萍挂单2', async () => {
|
await test.step('校验各个员工的挂单', async () => {
|
||||||
//员工2开第2单
|
|
||||||
await page.getByRole('button', { name: /^开\s单$/ }).click();
|
|
||||||
await customerPage.searchCustomer(phone);
|
|
||||||
await customerPage.selectSearchCustomer(username);
|
|
||||||
// 选择第二个项目
|
|
||||||
await page.locator('.project_list').filter({ hasText: ProjectName.Projects.Projects_2.name }).click();
|
|
||||||
// 选择添加员工
|
|
||||||
await page.locator('button.staff_btn').click();
|
|
||||||
// 选择员工:周萍
|
|
||||||
await page
|
|
||||||
.locator('.counselor:nth-child(2)')
|
|
||||||
.locator('.check_row:nth-child(2) .check_item:nth-child(1)')
|
|
||||||
.filter({ hasText: Employees.FirstShop.Employee_9.name })
|
|
||||||
.click();
|
|
||||||
// 保存并复制到其他项目
|
|
||||||
await page.locator('button.save_and_copy').filter({ hasText: '保存并复制到其他项目/卖品' }).click();
|
|
||||||
// 挂单
|
|
||||||
await page.locator('#cart_bottom_btn').getByText('挂单').click();
|
|
||||||
// 等待挂单成功
|
|
||||||
await page.locator('.ant-message').waitFor();
|
|
||||||
// 判断挂单成功弹窗消失后再执行下一步
|
|
||||||
await expect(page.locator('.ant-message')).not.toBeVisible();
|
|
||||||
});
|
|
||||||
|
|
||||||
await test.step('最后校验挂单数量', async () => {
|
|
||||||
// 点击底部员工刘强
|
// 点击底部员工刘强
|
||||||
await page.locator('.userpanel_item').filter({ hasText: Employees.FirstShop.Employee_8.name }).click();
|
await employeeLq.click();
|
||||||
await page.locator('.item_box').first().waitFor();
|
await expect.soft($$pendingOrderCard.first()).toContainText(`${username}`);
|
||||||
const order = await page.locator('.item_box').all();
|
await expect($$pendingOrderCard.first()).toContainText(`${Employees.FirstShop.Employee_8.name}`);
|
||||||
expect(order.length).toBe(3 + OrderLQ);
|
|
||||||
|
|
||||||
// 点击底部员工周萍
|
// 点击底部员工周萍
|
||||||
await page.locator('.userpanel_item').filter({ hasText: Employees.FirstShop.Employee_9.name }).click();
|
await employeeZp.click();
|
||||||
await page.locator('.item_box').first().waitFor();
|
await expect.soft($$pendingOrderCard.first()).toContainText(`${username}`);
|
||||||
const order1 = await page.locator('.item_box').all();
|
await expect($$pendingOrderCard.first()).toContainText(`${Employees.FirstShop.Employee_9.name}`);
|
||||||
expect(order1.length).toBe(2 + OrderZP);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -211,32 +123,18 @@ test.describe('挂单', () => {
|
|||||||
// // 点击底部员工吴浩
|
// // 点击底部员工吴浩
|
||||||
// 取单
|
// 取单
|
||||||
await page.locator('.item_box', { hasText: username }).waitFor();
|
await page.locator('.item_box', { hasText: username }).waitFor();
|
||||||
await page
|
await page.locator('.item_box').first().getByRole('button', { name: /^取\s单$/ }).click();
|
||||||
.locator('.item_box')
|
await page.locator('#buyList').getByText('雪肌晶纯护理').waitFor();
|
||||||
.first()
|
|
||||||
.getByRole('button', { name: /^取\s单$/ })
|
|
||||||
.click();
|
|
||||||
//结算
|
//结算
|
||||||
await page
|
await page.locator('.pay_btn').filter({ hasText: /^结\s算$/ }).click();
|
||||||
.locator('.pay_btn')
|
|
||||||
.filter({ hasText: /^结\s算$/ })
|
|
||||||
.click();
|
|
||||||
//点击优惠券折扣
|
//点击优惠券折扣
|
||||||
await page.getByText('优惠券抵扣').click();
|
await page.getByText('优惠券抵扣').click();
|
||||||
//点击赠送优惠券
|
//点击赠送优惠券
|
||||||
await page.getByText('赠送优惠券').click();
|
await page.getByText('赠送优惠券').click();
|
||||||
//点击定额10元券
|
//点击定额10元券
|
||||||
await page
|
await page.locator('.popup_content').locator('.alloytouch-target').filter({ hasText: Coupons.coupon.coupon_1.name }).click();
|
||||||
.locator('.popup_content')
|
|
||||||
.locator('.alloytouch-target')
|
|
||||||
.filter({ hasText: Coupons.coupon.coupon_1.name })
|
|
||||||
.click();
|
|
||||||
//确认
|
//确认
|
||||||
await page
|
await page.locator('.operation_btn').first().getByRole('button', { name: /^确\s定$/ }).click();
|
||||||
.locator('.operation_btn')
|
|
||||||
.first()
|
|
||||||
.getByRole('button', { name: /^确\s定$/ })
|
|
||||||
.click();
|
|
||||||
//选择定额10元券
|
//选择定额10元券
|
||||||
await page.getByLabel(Coupons.coupon.coupon_1.name).first().check();
|
await page.getByLabel(Coupons.coupon.coupon_1.name).first().check();
|
||||||
//确认选择
|
//确认选择
|
||||||
@ -276,27 +174,21 @@ test.describe('挂单', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('已过期单据不能取单,只能删除', async ({ page }) => {
|
test('已过期单据不能取单,只能删除', async ({ page }) => {
|
||||||
const $slidingMenu = page.locator('div.deleteList .m_sliding_menu');
|
|
||||||
await page.getByText('已过期 / 删除单据').click();
|
await page.getByText('已过期 / 删除单据').click();
|
||||||
await page.getByText('警告:已过期服务无法取单结算,请至收银台处理').waitFor();
|
await page.getByText('警告:已过期服务无法取单结算,请至收银台处理').waitFor();
|
||||||
await $slidingMenu.locator('div.item_box').first().waitFor();
|
|
||||||
await expect(
|
|
||||||
$slidingMenu
|
|
||||||
.locator('div.item_box')
|
|
||||||
.first()
|
|
||||||
.getByRole('button', { name: /^取\s单$/ }),
|
|
||||||
).not.toBeVisible();
|
|
||||||
|
|
||||||
const $delete = $slidingMenu
|
const $firstOrder = page.locator('.deleteList .m_sliding_menu .item_box').first();
|
||||||
.locator('div.item_box')
|
|
||||||
.first()
|
await expect($firstOrder.getByRole('button', { name: /^取\s单$/ })).not.toBeVisible();
|
||||||
.locator('.comment > div:nth-child(2) > .touchIcon');
|
|
||||||
await $delete.click();
|
await $firstOrder.locator('.comment > div:nth-child(2) > .touchIcon').click();
|
||||||
await page.getByPlaceholder('请输入1-100个字符备注内容').click();
|
await page.getByPlaceholder('请输入1-100个字符备注内容').click();
|
||||||
await page.getByPlaceholder('请输入1-100个字符备注内容').fill('测试备注');
|
await page.getByPlaceholder('请输入1-100个字符备注内容').fill('测试备注');
|
||||||
|
|
||||||
await page.getByRole('button', { name: /^保\s存$/ }).click();
|
await Promise.all([
|
||||||
await expect(page.locator('.ant-message').filter({ hasText: '删除成功' }).nth(2)).toBeVisible();
|
page.getByRole('button', { name: /^保\s存$/ }).click(),
|
||||||
|
expect(page.locator('.ant-message').filter({ hasText: '删除成功' })).toBeVisible(),
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -306,7 +198,7 @@ test.describe('挂单', () => {
|
|||||||
const phone = customer.phone;
|
const phone = customer.phone;
|
||||||
const username = customer.username;
|
const username = customer.username;
|
||||||
|
|
||||||
await page.pause();
|
// await page.pause();
|
||||||
|
|
||||||
await homeNavigation.gotoModule('收银');
|
await homeNavigation.gotoModule('收银');
|
||||||
await page.getByRole('button', { name: /^开\s单$/ }).click();
|
await page.getByRole('button', { name: /^开\s单$/ }).click();
|
||||||
|
|||||||
@ -48,7 +48,7 @@ test.describe('目标-目标设置', () => {
|
|||||||
.locator('.m-table-cell')
|
.locator('.m-table-cell')
|
||||||
.nth(1)
|
.nth(1)
|
||||||
.click();
|
.click();
|
||||||
await numberInput.setValue(Number(goal));
|
await numberInput.setValue('common', Number(goal));
|
||||||
await numberInput.confirmValue();
|
await numberInput.confirmValue();
|
||||||
await page.getByRole('button', { name: '保 存' }).click();
|
await page.getByRole('button', { name: '保 存' }).click();
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ test.describe('目标-目标设置', () => {
|
|||||||
.locator('.m-table-cell')
|
.locator('.m-table-cell')
|
||||||
.nth(1)
|
.nth(1)
|
||||||
.click();
|
.click();
|
||||||
await numberInput.setValue(0);
|
await numberInput.setValue('common', 0);
|
||||||
await numberInput.confirmValue();
|
await numberInput.confirmValue();
|
||||||
await page.getByRole('button', { name: '保 存' }).click();
|
await page.getByRole('button', { name: '保 存' }).click();
|
||||||
});
|
});
|
||||||
@ -191,7 +191,7 @@ test.describe('目标-目标设置', () => {
|
|||||||
|
|
||||||
const code = page.locator('.popupComTableStyle .m-table__body .main-table-body_tr');
|
const code = page.locator('.popupComTableStyle .m-table__body .main-table-body_tr');
|
||||||
await code.nth(nowRowB).locator('.m-table-cell').nth(1).click();
|
await code.nth(nowRowB).locator('.m-table-cell').nth(1).click();
|
||||||
await numberInput.setValue(Number(goalB));
|
await numberInput.setValue('common', Number(goalB));
|
||||||
await numberInput.confirmValue();
|
await numberInput.confirmValue();
|
||||||
|
|
||||||
// 员工C内行数
|
// 员工C内行数
|
||||||
@ -217,7 +217,7 @@ test.describe('目标-目标设置', () => {
|
|||||||
).not.toBeVisible();
|
).not.toBeVisible();
|
||||||
|
|
||||||
await code.nth(nowRowC).locator('.m-table-cell').nth(1).click();
|
await code.nth(nowRowC).locator('.m-table-cell').nth(1).click();
|
||||||
await numberInput.setValue(Number(goalC));
|
await numberInput.setValue('common', Number(goalC));
|
||||||
await numberInput.confirmValue();
|
await numberInput.confirmValue();
|
||||||
await page.getByRole('button', { name: /保\s存/ }).click();
|
await page.getByRole('button', { name: /保\s存/ }).click();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user