csv
This commit is contained in:
parent
919325202b
commit
2d952ddc5d
7
package-lock.json
generated
7
package-lock.json
generated
@ -9,6 +9,7 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"csv-parse": "^5.5.6",
|
||||||
"sharp": "^0.33.5",
|
"sharp": "^0.33.5",
|
||||||
"tesseract.js": "^5.1.1"
|
"tesseract.js": "^5.1.1"
|
||||||
},
|
},
|
||||||
@ -480,6 +481,12 @@
|
|||||||
"simple-swizzle": "^0.2.2"
|
"simple-swizzle": "^0.2.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/csv-parse": {
|
||||||
|
"version": "5.5.6",
|
||||||
|
"resolved": "https://registry.npmmirror.com/csv-parse/-/csv-parse-5.5.6.tgz",
|
||||||
|
"integrity": "sha512-uNpm30m/AGSkLxxy7d9yRXpJQFrZzVWLFBkS+6ngPcZkw/5k3L/jjFuj7tVnEpRn+QgmiXr21nDlhCiUK4ij2A==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/detect-libc": {
|
"node_modules/detect-libc": {
|
||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"resolved": "https://registry.npmmirror.com/detect-libc/-/detect-libc-2.0.3.tgz",
|
"resolved": "https://registry.npmmirror.com/detect-libc/-/detect-libc-2.0.3.tgz",
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
"hlk_codegen": "npx playwright codegen https://hlk.meiguanjia.net/#/",
|
"hlk_codegen": "npx playwright codegen https://hlk.meiguanjia.net/#/",
|
||||||
"mgj_codegen": "npx playwright codegen https://vip1.meiguanjia.net/shair/?v=mgj",
|
"mgj_codegen": "npx playwright codegen https://vip1.meiguanjia.net/shair/?v=mgj",
|
||||||
"zhb_codegen": "npx playwright codegen https://shengyibao.meiguanjia.net/young/",
|
"zhb_codegen": "npx playwright codegen https://shengyibao.meiguanjia.net/young/",
|
||||||
|
"zhb_csv-100": "npx playwright test ./tests/zhb/csv-demo.spec.js:13 --repeat-each=100",
|
||||||
"ui": "npx playwright test --ui",
|
"ui": "npx playwright test --ui",
|
||||||
"pwi": "npm ci && npx playwright install",
|
"pwi": "npm ci && npx playwright install",
|
||||||
"pwu": "npx playwright install --with-deps"
|
"pwu": "npx playwright install --with-deps"
|
||||||
@ -21,6 +22,7 @@
|
|||||||
"dotenv": "^16.4.5"
|
"dotenv": "^16.4.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"csv-parse": "^5.5.6",
|
||||||
"sharp": "^0.33.5",
|
"sharp": "^0.33.5",
|
||||||
"tesseract.js": "^5.1.1"
|
"tesseract.js": "^5.1.1"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,7 +45,7 @@ for (let i = 0; i < 3; i++) {
|
|||||||
await h5Page.locator('.bar_item', { hasText: '商城' }).click();
|
await h5Page.locator('.bar_item', { hasText: '商城' }).click();
|
||||||
await expect(h5Page.locator('.title', { hasText: '商城' })).toBeVisible();
|
await expect(h5Page.locator('.title', { hasText: '商城' })).toBeVisible();
|
||||||
await h5Page.locator('.li span', { hasText: '全部' }).click();
|
await h5Page.locator('.li span', { hasText: '全部' }).click();
|
||||||
await h5Page.locator('.p-item').nth(1).click();
|
await h5Page.locator('.p-item').nth(2).click();
|
||||||
await h5Page.waitForLoadState();
|
await h5Page.waitForLoadState();
|
||||||
await h5Page.getByText('立即购买').click();
|
await h5Page.getByText('立即购买').click();
|
||||||
await h5Page
|
await h5Page
|
||||||
|
|||||||
118
tests/zhb/csv-demo.spec.js
Normal file
118
tests/zhb/csv-demo.spec.js
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
const path = require('path');
|
||||||
|
const { parse } = require('csv-parse/sync');
|
||||||
|
const fs = require('fs');
|
||||||
|
const { faker } = require('@faker-js/faker');
|
||||||
|
const { test, expect } = require('./fixture/common');
|
||||||
|
const { Customer } = require('./pom/customerPage');
|
||||||
|
|
||||||
|
const records = parse(fs.readFileSync(path.join(__dirname, 'zhb.csv')), {
|
||||||
|
columns: true,
|
||||||
|
skip_empty_lines: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
test('csv', async ({ zhbPage }, workerInfo) => {
|
||||||
|
console.log(records.length);
|
||||||
|
const $area = zhbPage
|
||||||
|
.locator('.area')
|
||||||
|
.filter({ has: zhbPage.locator('.area-name', { hasText: '二楼' }) });
|
||||||
|
const $$room = $area.locator('.room-list .room');
|
||||||
|
|
||||||
|
// 随机csv文件中的任意一个顾客
|
||||||
|
const record = records[faker.number.int({ min: 0, max: records.length - 1 })];
|
||||||
|
const { name, phone } = record;
|
||||||
|
console.log({ name, phone });
|
||||||
|
const customer = new Customer({ name: name, phone: name });
|
||||||
|
|
||||||
|
// 使用房间名称
|
||||||
|
let useRoomName;
|
||||||
|
await test.step('购买商品', async () => {
|
||||||
|
await zhbPage.locator('#tab_main li').filter({ hasText: '营业' }).click();
|
||||||
|
const $emptyRoom = $$room
|
||||||
|
.filter({ has: zhbPage.getByText('空房') })
|
||||||
|
.nth(workerInfo.workerIndex % 3);
|
||||||
|
useRoomName = await $emptyRoom.locator('.roomName').innerText();
|
||||||
|
expect(useRoomName).not.toBeNull();
|
||||||
|
await $emptyRoom.click();
|
||||||
|
await expect(async () => {
|
||||||
|
if (await zhbPage.locator('.close > .iconfont').first().isVisible()) {
|
||||||
|
await zhbPage.locator('.close > .iconfont').first().click();
|
||||||
|
}
|
||||||
|
await zhbPage.getByRole('button', { name: '选择顾客' }).click({ timeout: 3000 });
|
||||||
|
await expect(zhbPage.locator('#page_searchMember').getByText('创建会员')).toBeVisible();
|
||||||
|
}).toPass();
|
||||||
|
await zhbPage
|
||||||
|
.getByRole('textbox', { name: '输入会员手机号或姓名或卡号搜索' })
|
||||||
|
.fill(customer.phone, { delay: 100 });
|
||||||
|
await zhbPage.locator('#page_searchMember svg').click();
|
||||||
|
|
||||||
|
const $customerTr = zhbPage
|
||||||
|
.locator('.list-warp')
|
||||||
|
.filter({ has: zhbPage.locator('.name', { hasText: customer.name }) });
|
||||||
|
await $customerTr.locator('.list-body').first().click();
|
||||||
|
|
||||||
|
await zhbPage.getByText('项目开单').click();
|
||||||
|
await expect(zhbPage.locator('#page_roomDetail').getByText('服务项目')).toBeVisible();
|
||||||
|
await zhbPage.getByText('选择', { exact: true }).nth(1).click();
|
||||||
|
await expect(zhbPage.locator('#serviceSelector').getByText('项目选择')).toBeVisible();
|
||||||
|
await zhbPage
|
||||||
|
.locator('.goods-content-item')
|
||||||
|
.nth(faker.number.int({ min: 0, max: 14 }))
|
||||||
|
.click();
|
||||||
|
await zhbPage.locator('#serviceSelector').getByText('确认').click();
|
||||||
|
await zhbPage
|
||||||
|
.locator('div')
|
||||||
|
.filter({ hasText: /^明星足浴$/ })
|
||||||
|
.locator('span')
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
await zhbPage.getByRole('button', { name: '完成开单' }).click();
|
||||||
|
await expect(zhbPage.getByRole('button', { name: '结账' })).toBeVisible({ timeout: 30_000 });
|
||||||
|
await zhbPage.getByRole('button', { name: '结账' }).click();
|
||||||
|
await zhbPage.locator('#page_footBathPay').getByText('结算签字').click();
|
||||||
|
|
||||||
|
await expect(async () => {
|
||||||
|
await zhbPage.locator('#page_footBathPay li').filter({ hasText: '现金' }).click();
|
||||||
|
await expect(zhbPage.locator('#page_footBathPay li').filter({ hasText: '现金' })).toHaveClass(
|
||||||
|
/selected/
|
||||||
|
);
|
||||||
|
await zhbPage
|
||||||
|
.locator('#page_footBathPay span')
|
||||||
|
.filter({ hasText: /结\s算/ })
|
||||||
|
.click();
|
||||||
|
await expect(zhbPage.getByText('顾客满意度点评')).toBeVisible({ timeout: 2000 });
|
||||||
|
}).toPass();
|
||||||
|
|
||||||
|
await zhbPage.getByText('不想评价').click();
|
||||||
|
await zhbPage.locator('#page_footBathPay').getByText('立即返回').click();
|
||||||
|
});
|
||||||
|
|
||||||
|
await test.step('起钟下钟,清理房间', async () => {
|
||||||
|
const $cleanRoom = $$room.filter({
|
||||||
|
has: zhbPage.locator('.roomName', { hasText: new RegExp(`^${useRoomName}$`) }),
|
||||||
|
});
|
||||||
|
await expect($cleanRoom).toContainText('已结清');
|
||||||
|
await $cleanRoom.click();
|
||||||
|
await zhbPage.getByText('技师操作').click();
|
||||||
|
await zhbPage.getByText('起钟', { exact: true }).click();
|
||||||
|
await zhbPage.getByText('起钟成功!').click();
|
||||||
|
await zhbPage.getByText('技师操作').click();
|
||||||
|
await zhbPage.getByText('下钟', { exact: true }).click();
|
||||||
|
await zhbPage
|
||||||
|
.locator('div')
|
||||||
|
.filter({ hasText: /^确认返回$/ })
|
||||||
|
.locator('div')
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
await zhbPage.getByRole('button', { name: '不需要' }).click();
|
||||||
|
|
||||||
|
await expect($cleanRoom).toContainText('打扫');
|
||||||
|
await $cleanRoom.click();
|
||||||
|
await zhbPage
|
||||||
|
.locator('div')
|
||||||
|
.filter({ hasText: /^确定取消$/ })
|
||||||
|
.locator('div')
|
||||||
|
.first()
|
||||||
|
.click();
|
||||||
|
await expect($cleanRoom).toContainText('空房');
|
||||||
|
});
|
||||||
|
});
|
||||||
201
tests/zhb/zhb.csv
Normal file
201
tests/zhb/zhb.csv
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
name,phone
|
||||||
|
郸志国,12334502225
|
||||||
|
纵佳琪,12352301430
|
||||||
|
马熙瑶,12350424001
|
||||||
|
应国平,12314501244
|
||||||
|
委强,12322301255
|
||||||
|
吕苡沫,12314440133
|
||||||
|
柴沐辰,12311131155
|
||||||
|
史国香,12333211154
|
||||||
|
易天娇,12351430503
|
||||||
|
靖敬彪,12321535101
|
||||||
|
贡秀珍,12352123355
|
||||||
|
悉艺涵,12311403141
|
||||||
|
丁国芳,12343515153
|
||||||
|
喻芳,12311322132
|
||||||
|
析晨阳,12344201554
|
||||||
|
酒建国,12332133555
|
||||||
|
窦智杰,12304133243
|
||||||
|
玉子豪,12314500535
|
||||||
|
渠建军,12314142045
|
||||||
|
甲婷婷,12340453445
|
||||||
|
巫娟,12320023214
|
||||||
|
扈斌,12324211053
|
||||||
|
位杰,12311524133
|
||||||
|
斛沐阳,12311151435
|
||||||
|
驹志国,12305534111
|
||||||
|
盘美方,12322214351
|
||||||
|
柯婷,12314322025
|
||||||
|
马涛,12340204331
|
||||||
|
东政君,12332111030
|
||||||
|
梁玉兰,12355420144
|
||||||
|
安丽,12302350005
|
||||||
|
赫俊杰,12341541431
|
||||||
|
尉迟海燕,12313530222
|
||||||
|
礼国珍,12321141225
|
||||||
|
行梓豪,12343224431
|
||||||
|
拉国荣,12351411412
|
||||||
|
练国栋,12312010324
|
||||||
|
戎沐宸,12343432310
|
||||||
|
翟宇,12344114011
|
||||||
|
桂梓晨,12340344054
|
||||||
|
斋志明,12305321102
|
||||||
|
及万佳,12335454335
|
||||||
|
前雪,12345534331
|
||||||
|
伦英,12321322045
|
||||||
|
柏立伟,12345251522
|
||||||
|
招欣怡,12324401040
|
||||||
|
首茗泽,12323330351
|
||||||
|
计乙萍,12303514002
|
||||||
|
线婷方,12324501502
|
||||||
|
九秀珍,12344040353
|
||||||
|
茂蒙,12312210221
|
||||||
|
红婷方,12340215445
|
||||||
|
扈倩,12354532031
|
||||||
|
原立伟,12342524245
|
||||||
|
祖丽芳,12322124425
|
||||||
|
蓬雨欣,12340321430
|
||||||
|
定瑜,12350252355
|
||||||
|
望丽萍,12311313430
|
||||||
|
铁家豪,12352502012
|
||||||
|
闳雅鑫,12313242150
|
||||||
|
单于燕,12314042132
|
||||||
|
杜奕泽,12345103503
|
||||||
|
尉丽芳,12323404415
|
||||||
|
徭国平,12321014220
|
||||||
|
羽志国,12311511234
|
||||||
|
弥安琪,12322541510
|
||||||
|
阮梓玥,12302200542
|
||||||
|
呼波,12351535225
|
||||||
|
玉呈轩,12304451524
|
||||||
|
针熙瑶,12354523544
|
||||||
|
帖国平,12305535553
|
||||||
|
班天娇,12330411042
|
||||||
|
藏秀珍,12304203153
|
||||||
|
计国琴,12351531450
|
||||||
|
鄢国珍,12343500300
|
||||||
|
屈国兰,12313202405
|
||||||
|
齐子欣,12355341152
|
||||||
|
曹安琪,12355140413
|
||||||
|
甫建华,12354544421
|
||||||
|
苗丽芬,12311142041
|
||||||
|
完倩,12324441204
|
||||||
|
綦雯静,12304221302
|
||||||
|
蔺志明,12322530542
|
||||||
|
磨晨阳,12315334001
|
||||||
|
友秀珍,12312034423
|
||||||
|
历燕,12330435540
|
||||||
|
飞文昊,12315150424
|
||||||
|
萧鹏,12333512443
|
||||||
|
用中海,12334505210
|
||||||
|
竭智杰,12312530202
|
||||||
|
次国琴,12331300513
|
||||||
|
乙一诺,12304041145
|
||||||
|
析志明,12340411012
|
||||||
|
曲红,12320421131
|
||||||
|
闫馨羽,12332235531
|
||||||
|
卷语桐,12305350101
|
||||||
|
旷丹,12351401021
|
||||||
|
植玉梅,12340034300
|
||||||
|
祖国栋,12310142153
|
||||||
|
乙艺涵,12301532402
|
||||||
|
海芳,12313345003
|
||||||
|
枝敬彪,12324501125
|
||||||
|
雍国秀,12340243412
|
||||||
|
章佳紫林,12320333352
|
||||||
|
充丽萍,12322423001
|
||||||
|
百雅鑫,12333040513
|
||||||
|
鹿治涛,12324533401
|
||||||
|
慎文韬,12350423141
|
||||||
|
谯梓涵,12301052044
|
||||||
|
针振东,12353344501
|
||||||
|
绍奕辰,12350005540
|
||||||
|
仉文昊,12332320502
|
||||||
|
元梓玥,12335424410
|
||||||
|
祝浩宇,12311335301
|
||||||
|
来斌,12300325534
|
||||||
|
刁志明,12320244541
|
||||||
|
首兰英,12311150011
|
||||||
|
练安琪,12342301055
|
||||||
|
唐雯静,12312505520
|
||||||
|
郝天娇,12312520301
|
||||||
|
庄丽芳,12353444410
|
||||||
|
源依诺,12342341501
|
||||||
|
诸丽芬,12312415203
|
||||||
|
朱慧,12344511420
|
||||||
|
绍国辉,12341315304
|
||||||
|
肥志明,12304445132
|
||||||
|
包文韬,12330305102
|
||||||
|
钱倩,12350342140
|
||||||
|
樊丽芳,12332020302
|
||||||
|
钱雨欣,12304114004
|
||||||
|
鱼静,12331411232
|
||||||
|
速宇泽,12331502245
|
||||||
|
叔沐宸,12335305514
|
||||||
|
进国英,12314454234
|
||||||
|
费慧,12304155020
|
||||||
|
漆治文,12352421501
|
||||||
|
示雪,12353154301
|
||||||
|
劳颖,12343235112
|
||||||
|
谈馥君,12343113130
|
||||||
|
兆呈轩,12320135205
|
||||||
|
萧文韬,12304320034
|
||||||
|
漫军,12321552123
|
||||||
|
施国珍,12330141235
|
||||||
|
纳静怡,12341035053
|
||||||
|
贰阳,12305451142
|
||||||
|
呼义轩,12315402403
|
||||||
|
植语桐,12335354425
|
||||||
|
路国荣,12304330054
|
||||||
|
支梓豪,12333434504
|
||||||
|
蔚宇航,12321411124
|
||||||
|
第宇航,12342053534
|
||||||
|
校海燕,12301142130
|
||||||
|
纳喇诗雨,12323221524
|
||||||
|
浑呈轩,12351243530
|
||||||
|
弓梓馨,12353030231
|
||||||
|
常玉梅,12352425540
|
||||||
|
冀丽萍,12343501540
|
||||||
|
北民,12321312355
|
||||||
|
栋勇,12321145441
|
||||||
|
原桂兰,12352325455
|
||||||
|
陈榕融,12315235050
|
||||||
|
况伟,12353031413
|
||||||
|
丁浩辰,12345310354
|
||||||
|
郭斌,12352334430
|
||||||
|
巴蒙,12344251134
|
||||||
|
可艳,12310255512
|
||||||
|
玄浩辰,12331503043
|
||||||
|
沙呈轩,12302013431
|
||||||
|
荤成,12344214445
|
||||||
|
林熙瑶,12305423343
|
||||||
|
葛梓睿,12314114055
|
||||||
|
湛斌,12345150514
|
||||||
|
由静,12300130254
|
||||||
|
侯振东,12324015213
|
||||||
|
贺单,12301145101
|
||||||
|
所宇轩,12331420152
|
||||||
|
颜颖,12300005420
|
||||||
|
咎玉梅,12352454144
|
||||||
|
占俊杰,12324402343
|
||||||
|
觉罗秀珍,12311240034
|
||||||
|
范姜丽,12330542141
|
||||||
|
弘梓浩,12343343451
|
||||||
|
通雨欣,12331513024
|
||||||
|
丘梓诚,12344112043
|
||||||
|
贵梓晨,12311414030
|
||||||
|
狄悦,12332305454
|
||||||
|
穆凤英,12335205455
|
||||||
|
金智杰,12301542505
|
||||||
|
蒙癸霖,12305252022
|
||||||
|
诺兰英,12303005354
|
||||||
|
帛娟,12304243114
|
||||||
|
在国英,12355121223
|
||||||
|
严芳,12355412233
|
||||||
|
狄治文,12320503352
|
||||||
|
律雨欣,12345523042
|
||||||
|
偶敬彪,12332433431
|
||||||
|
求佳琪,12300144202
|
||||||
|
唐中海,12351305521
|
||||||
|
第治涛,12300442432
|
||||||
|
壬家明,12335343552
|
||||||
|
Reference in New Issue
Block a user