From c7f923d8348914c2510ba5129166ee392d7f0278 Mon Sep 17 00:00:00 2001 From: LingandRX Date: Fri, 3 Jan 2025 22:29:51 +0800 Subject: [PATCH] =?UTF-8?q?test(touch):=20=E4=BC=98=E5=8C=96=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E8=84=9A=E6=9C=AC=E7=9A=84=E5=AE=9A=E4=BD=8D=E5=99=A8?= =?UTF-8?q?=E5=92=8C=E6=96=AD=E8=A8=80=E9=80=BB=E8=BE=91-=20=E5=9C=A8=20bo?= =?UTF-8?q?ss=5Fappointment.spec.ts=20=E4=B8=AD=EF=BC=8C=E5=B0=86=E9=A1=BE?= =?UTF-8?q?=E5=AE=A2=E9=A2=84=E7=BA=A6=E7=9A=84=E5=AE=9A=E4=BD=8D=E5=99=A8?= =?UTF-8?q?=E4=BB=8E=20'.a=5FuserInfo'=20=E4=BF=AE=E6=94=B9=E4=B8=BA=20'di?= =?UTF-8?q?v.a=5FuserInfo'=EF=BC=8C=E6=8F=90=E9=AB=98=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E5=87=86=E7=A1=AE=E6=80=A7=20-=20=E5=9C=A8=20boss=5Fcashier.sp?= =?UTF-8?q?ec.ts=20=E4=B8=AD=EF=BC=8C=E7=AE=80=E5=8C=96=E4=BA=86=E5=B7=B2?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=E5=8D=95=E6=8D=AE=E5=92=8C=E5=B7=B2=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=8D=95=E6=8D=AE=E7=9A=84=E6=B5=8B=E8=AF=95=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=EF=BC=8C=E4=BD=BF=E7=94=A8=E6=9B=B4=E9=AB=98=E6=95=88?= =?UTF-8?q?=E7=9A=84=E5=AE=9A=E4=BD=8D=E5=99=A8=E5=92=8C=E6=96=AD=E8=A8=80?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=20-=20=E4=BC=98=E5=8C=96=E4=BA=86=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1/=E6=94=AF=E4=BB=98=E5=AE=9D=E6=94=B6=E6=AC=BE?= =?UTF-8?q?=E5=92=8C=E4=BC=9A=E5=91=98=E5=8D=A1=E6=B6=88=E8=B4=B9=E7=9A=84?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=AD=A5=E9=AA=A4=EF=BC=8C=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=20setCommonValue=20=E6=9B=BF=E4=BB=A3=20setValue=20=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/touch/boss_appointment.spec.ts | 2 +- tests/touch/boss_cashier.spec.ts | 56 ++++++++++------------------ 2 files changed, 20 insertions(+), 38 deletions(-) diff --git a/tests/touch/boss_appointment.spec.ts b/tests/touch/boss_appointment.spec.ts index a737418..9d0b14f 100644 --- a/tests/touch/boss_appointment.spec.ts +++ b/tests/touch/boss_appointment.spec.ts @@ -191,7 +191,7 @@ test.describe('预约状态', () => { const $employee = page.locator('.room_table .tr .name_th').filter({ hasText: employee.name }); // 顾客预约定位器 const $customerAppointment = page - .locator('.a_userInfo') + .locator('div.a_userInfo') .filter({ hasText: customer.phone }) .filter({ hasText: customer.username }); diff --git a/tests/touch/boss_cashier.spec.ts b/tests/touch/boss_cashier.spec.ts index 631c14c..be442be 100644 --- a/tests/touch/boss_cashier.spec.ts +++ b/tests/touch/boss_cashier.spec.ts @@ -276,26 +276,19 @@ test.describe('挂单', () => { }); test('已过期单据不能取单,只能删除', async ({ page }) => { - // 点击已过期 / 删除单据 + const $slidingMenu = page.locator('div.deleteList .m_sliding_menu'); await page.getByText('已过期 / 删除单据').click(); - // 等待过期删除水单页面出来 - await page.locator('.deleteList').locator('.item_box').first().waitFor(); - // 水单都没有取单 - const PendingOrder_1 = page.locator('.deleteList').locator('.item_box'); + 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.locator('div.item_box').first().locator('.comment > div:nth-child(2) > .touchIcon'); + await $delete.click(); + await page.getByPlaceholder('请输入1-100个字符备注内容').click(); + await page.getByPlaceholder('请输入1-100个字符备注内容').fill('测试备注'); - await expect(PendingOrder_1.getByRole('button', { name: /^取\s单$/ })).not.toBeVisible(); - await page - .locator( - 'div:nth-child(3) > .scroller-body > .alloytouch-target > .list > div > .item > .comment > div:nth-child(2) > .touchIcon', - ) - .first() - .click(); - await expect(async () => { - await page.locator('label').filter({ hasText: '1' }).click(); - await page.locator('.ant-radio-checked').waitFor(); - }).toPass(); await page.getByRole('button', { name: /^保\s存$/ }).click(); - await expect(page.locator('div').filter({ hasText: '删除成功' }).nth(2)).toBeVisible(); + await expect(page.locator('.ant-message').filter({ hasText: '删除成功' }).nth(2)).toBeVisible(); }); }); @@ -390,22 +383,13 @@ test.describe('挂单', () => { test('已删除单据不能取单,也不能删除', async ({ page }) => { // 找到已过期/删除单据 - await page.locator('.cash_content > .main > .top').getByText('已过期').click(); - await expect(async () => { - // 点击已删除服务 - await page.getByText(' 已删除服务 ').click(); - await page.locator('.loading_container').waitFor({ state: 'hidden' }); - // 等待过期删除水单页面出来 - await page.locator('.deleteList').locator('.item_box').first().waitFor({ timeout: 2000 }); - // 判断有没有取单和删除 - const PendingOrder = page.locator('.deleteList').locator('.item_box'); - await expect(PendingOrder.getByRole('button', { name: /^取\s单$/ })).not.toBeVisible(); - await expect( - page.locator( - 'div:nth-child(3) > .scroller-body > .alloytouch-target > .list > div > .item > .comment > div:nth-child(2) > .touchIcon', - ), - ).not.toBeVisible(); - }).toPass(); + await page.getByText('已过期 / 删除单据').click(); + await expect(page.getByText('已删除服务', { exact: true })).toBeInViewport(); + await page.getByText('已删除服务', { exact: true }).click(); + await expect(page.getByText('警告:已过期服务无法取单结算,请至收银台处理')).not.toBeInViewport(); + const $slidingMenu = page.locator('div.deleteList .m_sliding_menu'); + await expect($slidingMenu.locator('div.item_box').first()).toBeVisible(); + await expect($slidingMenu.locator('div.comment > i.anticon').first()).not.toBeVisible(); }); test('微信/支付宝收款', async ({ page, homeNavigation, baseURL }) => { @@ -1247,8 +1231,6 @@ test.describe('收银-开单&结算', () => { await expect(page.locator('.membercard_box .bonuses').first()).toContainText('100'); }); - await page.reload(); - await test.step('使用卡金和赠金', async () => { //使用卡金和赠金 await page.reload(); @@ -1274,13 +1256,13 @@ test.describe('收银-开单&结算', () => { await page.getByText('卡金').nth(4).click(); await page.getByRole('button', { name: '增加收款' }).click(); // 输入金额 - await numberInput.setValue(100); + await numberInput.setCommonValue(100); await numberInput.confirmValue(); // 选择赠送金支付 await page.getByText('赠金').nth(2).click(); await page.getByRole('button', { name: '增加收款' }).click(); // 输入金额 - await numberInput.setValue(90); + await numberInput.setCommonValue(90); await numberInput.confirmValue(); // 结算 await page.getByRole('button', { name: /^结\s算$/ }).click();