feat(commodity): 新增商品分类和商品列表页面的测试用例

- 添加了商品分类页面的测试用例,包括验证表格头和新增分类功能
- 添加了商品列表页面的测试用例,验证页面元素和功能
- 新增了 CommondityCategoryPage 和 CommondityCreateCategoryPage 两个页面对象
- 更新了环境变量和配置文件,为测试用例做准备
This commit is contained in:
LingandRX 2025-05-12 23:13:32 +08:00
parent 625e91254f
commit bd1296062b
8 changed files with 502 additions and 4 deletions

4
.env
View File

@ -1,2 +1,2 @@
BASE_URL=https://hg.meiguanjia.net/web/test/#/
# BASE_URL=https://px.meiguanjia.net/prestg/web/#/
BASE_URL=https://hg.meiguanjia.net/web/test/
# BASE_URL=https://px.meiguanjia.net/prestg/web/

View File

@ -0,0 +1,48 @@
import { expect, type Locator, type Page } from '@playwright/test';
export class CommondityCategoryPage {
readonly page: Page;
readonly commondity_category_search_input: Locator;
readonly commondity_category_search_button: Locator;
readonly commondity_create_category_button: Locator;
readonly table_headers: Locator;
readonly table_rows: Locator;
constructor(page: Page) {
this.page = page;
this.commondity_category_search_input = page.getByRole('textbox', { name: '请输入分类名称' });
this.commondity_category_search_button = page.getByRole('button', { name: /查\s询/ });
this.commondity_create_category_button = page.getByRole('button', { name: '新增分类' });
this.table_headers = page.locator('.m-table__header-wrapper thead th');
this.table_rows = page.locator('.m-table__body-wrapper tbody tr');
}
async verify_table_headers() {
const expected_headers = [
'分类名称',
'父分类',
'品类编码',
'分类排序',
'创建时间',
'更新时间',
'操作',
];
const actual_headers = await this.table_headers.all();
for (let i = 0; i < expected_headers.length; i++) {
await expect(actual_headers[i]).toHaveText(expected_headers[i]);
}
}
async get_table_row_content(rowIndex: number): Promise<string[]> {
const table_rows = await this.table_rows.nth(rowIndex).locator('td').all();
const cell_content: string[] = [];
for (const cell of table_rows) {
cell_content.push(await cell.textContent() ?? '-');
}
return cell_content;
}
}

View File

@ -0,0 +1,46 @@
import { expect, type Locator, type Page } from '@playwright/test';
export class CommondityCreateCategoryPage {
readonly page: Page;
readonly create_category_page_header: Locator;
readonly create_category_button: Locator;
readonly category_level_select: (level: 1 | 2) => Locator;
readonly category_name_input: Locator;
readonly category_code_input: Locator;
readonly category_sort_input: Locator;
constructor(page: Page) {
this.page = page;
this.create_category_page_header = page.locator('.popup_content').getByText('新增分类', { exact: true });
this.create_category_button = page.getByRole('button', { name: /保\s存/ });
this.category_level_select = (level: 1 | 2) => {
const radioList = [
page.getByRole('radio', { name: '一级分类' }),
page.getByRole('radio', { name: '二级分类' }),
];
return radioList[level - 1];
};
this.category_name_input = page
.locator('div')
.filter({ hasText: /^分类名称\*$/ })
.getByPlaceholder('请输入分类名称');
this.category_code_input = page.locator('span').filter({ hasText: '请选择' }).locator('span').nth(1);
this.category_sort_input = page.getByPlaceholder('请输入分类排序');
}
async create_category(
categoryName: string,
categoryCode: string,
categorySort: string,
categoryLevel: 1 | 2
) {
await this.category_level_select(categoryLevel).click();
await this.category_name_input.fill(categoryName);
await this.category_code_input.fill(categoryCode);
await this.category_sort_input.fill(categorySort);
await this.create_category_button.click();
}
async open_create_category_page_success() {
await expect(this.create_category_page_header).toBeVisible();
}
}

View File

@ -42,7 +42,7 @@ export default defineConfig({
},
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
use: { ...devices['Desktop Chrome'], storageState: 'state.json' },
dependencies: ['setup'],
},
],

350
state.json Normal file
View File

@ -0,0 +1,350 @@
{
"cookies": [
{
"name": "Authorization",
"value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOiJUT0tFTjE0MjU3IiwiZGV2aWNlIjoiSExLX0VNUExPWUVFX0FQUF9TSURFQVBQIiwiZWZmIjoxNzQ3OTE1MTY3NjI3LCJyblN0ciI6ImlVdmJkY2ZxWEhzbENhdTBxRlJFb0RtT0twT3JBWXdPIiwiYWNjb3VudCI6eyJpZCI6MTQyNTcsImJ1c2luZXNzU2lkZSI6IkhMS19FTVBMT1lFRV9BUFBfU0lERSIsIm5hbWUiOiIxNzcwMDAwMDAwMyIsIm1vYmlsZSI6IjE3NzAwMDAwMDAzIiwiYWNjb3VudExvZ2luVHlwZSI6IkxPR0lOX0FDQ09VTlQiLCJ0aW1lc3RhbXAiOjE3NDcwNTExNjY2MjcsInRva2VuVHlwZSI6IlRPS0VOIiwiYWNjb3VudFJvbGVMaXN0IjpbeyJpZCI6NjE5MzUsInN5c3RlbUlkIjoxMSwic3lzdGVtQ29kZSI6IkhHIiwibWVyY2hhbnRJZCI6MzQxLCJhcHBJZCI6ImFjY291bnQyNTA0MjNTRUVuMUQwVGEzUFZ2NVkiLCJ1c2VySWQiOiIzMzc2NSIsInJvbGVDb2RlIjoiIn1dLCJ1c2VyUm9sZSI6eyJpZCI6NjE5MzUsInN5c3RlbUlkIjoxMSwic3lzdGVtQ29kZSI6IkhHIiwibWVyY2hhbnRJZCI6MzQxLCJhcHBJZCI6ImFjY291bnQyNTA0MjNTRUVuMUQwVGEzUFZ2NVkiLCJ1c2VySWQiOiIzMzc2NSIsInJvbGVDb2RlIjoiIiwiYXV0aG9yaXR5Ijoie30ifSwiZGV2aWNlVHlwZSI6IkFQUCIsImV4dCI6eyJleHQiOiJ7XCJjcmVhdGVUc1wiOjE3NDU0NjIxODAwMDAsXCJpZFwiOjMzNzY1LFwibW9iaWxlXCI6XCIxNzcwMDAwMDAwM1wiLFwibmFtZVwiOlwi5rWL6K-VM1wiLFwibm9cIjpcIjRcIn0iLCJjbHVzdGVyIjoiREVGQVVMVCIsImRldmljZV90eXBlIjoid2luZG93cyIsIm1lcmNoYW50X2lkIjoiMzQxIiwidXNlcklkZW50aXR5IjoiUk9PVCIsInBsYXRmb3JtSWQiOiIxIiwiY2xpZW50X2lkIjoidG91Y2giLCJwYXNzd29yZCI6ImExMjM0NTYiLCJhcHBJZCI6ImhnMjUwNDIzTk9LaW1rVmdKa1pldXJKIiwiaWQiOiIzNTQiLCJ1c2VybmFtZSI6IjE3NzAwMDAwMDAzIiwidGltZXN0YW1wIjoiMTc0NzA1MTE2NjMzMCJ9LCJ0aW1lb3V0Ijo4NjQwMDEsInJlZnJlc2hUaW1lb3V0IjoxNzI4MDAxfX0.lEKMbNJX45RjSTXnZK0B8ul2MNIJAZhSJmdhffEaYsQ",
"domain": "hg.meiguanjia.net",
"path": "/",
"expires": 1747310364.985502,
"httpOnly": false,
"secure": false,
"sameSite": "Lax"
},
{
"name": "JSESSIONID",
"value": "62A4C2642431FEE88EDBB78509FCB334",
"domain": "hg.meiguanjia.net",
"path": "/",
"expires": -1,
"httpOnly": true,
"secure": false,
"sameSite": "Lax"
}
],
"origins": [
{
"origin": "https://hg.meiguanjia.net",
"localStorage": [
{
"name": "fljs_uuid",
"value": "a12759d9-fccb-4b2f-8161-834a629a8382"
},
{
"name": "pixiu_pc_token",
"value": "{\"val\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOiJUT0tFTjE0MjU3IiwiZGV2aWNlIjoiSExLX0VNUExPWUVFX0FQUF9TSURFQVBQIiwiZWZmIjoxNzQ3OTE1MTY3NjI3LCJyblN0ciI6ImlVdmJkY2ZxWEhzbENhdTBxRlJFb0RtT0twT3JBWXdPIiwiYWNjb3VudCI6eyJpZCI6MTQyNTcsImJ1c2luZXNzU2lkZSI6IkhMS19FTVBMT1lFRV9BUFBfU0lERSIsIm5hbWUiOiIxNzcwMDAwMDAwMyIsIm1vYmlsZSI6IjE3NzAwMDAwMDAzIiwiYWNjb3VudExvZ2luVHlwZSI6IkxPR0lOX0FDQ09VTlQiLCJ0aW1lc3RhbXAiOjE3NDcwNTExNjY2MjcsInRva2VuVHlwZSI6IlRPS0VOIiwiYWNjb3VudFJvbGVMaXN0IjpbeyJpZCI6NjE5MzUsInN5c3RlbUlkIjoxMSwic3lzdGVtQ29kZSI6IkhHIiwibWVyY2hhbnRJZCI6MzQxLCJhcHBJZCI6ImFjY291bnQyNTA0MjNTRUVuMUQwVGEzUFZ2NVkiLCJ1c2VySWQiOiIzMzc2NSIsInJvbGVDb2RlIjoiIn1dLCJ1c2VyUm9sZSI6eyJpZCI6NjE5MzUsInN5c3RlbUlkIjoxMSwic3lzdGVtQ29kZSI6IkhHIiwibWVyY2hhbnRJZCI6MzQxLCJhcHBJZCI6ImFjY291bnQyNTA0MjNTRUVuMUQwVGEzUFZ2NVkiLCJ1c2VySWQiOiIzMzc2NSIsInJvbGVDb2RlIjoiIiwiYXV0aG9yaXR5Ijoie30ifSwiZGV2aWNlVHlwZSI6IkFQUCIsImV4dCI6eyJleHQiOiJ7XCJjcmVhdGVUc1wiOjE3NDU0NjIxODAwMDAsXCJpZFwiOjMzNzY1LFwibW9iaWxlXCI6XCIxNzcwMDAwMDAwM1wiLFwibmFtZVwiOlwi5rWL6K-VM1wiLFwibm9cIjpcIjRcIn0iLCJjbHVzdGVyIjoiREVGQVVMVCIsImRldmljZV90eXBlIjoid2luZG93cyIsIm1lcmNoYW50X2lkIjoiMzQxIiwidXNlcklkZW50aXR5IjoiUk9PVCIsInBsYXRmb3JtSWQiOiIxIiwiY2xpZW50X2lkIjoidG91Y2giLCJwYXNzd29yZCI6ImExMjM0NTYiLCJhcHBJZCI6ImhnMjUwNDIzTk9LaW1rVmdKa1pldXJKIiwiaWQiOiIzNTQiLCJ1c2VybmFtZSI6IjE3NzAwMDAwMDAzIiwidGltZXN0YW1wIjoiMTc0NzA1MTE2NjMzMCJ9LCJ0aW1lb3V0Ijo4NjQwMDEsInJlZnJlc2hUaW1lb3V0IjoxNzI4MDAxfX0.lEKMbNJX45RjSTXnZK0B8ul2MNIJAZhSJmdhffEaYsQ\",\"timer\":1747310364987}"
},
{
"name": "theme",
"value": "{\"colorPrimary\":\"#3469e7\"}"
},
{
"name": "pixiu_pc_dpr",
"value": "{\"val\":1,\"timer\":1749643163338}"
},
{
"name": "pixiu_pc_mobile",
"value": "{\"val\":\"17700000003\",\"timer\":1772971164987}"
},
{
"name": "pixiu_pc_clientId",
"value": "{\"val\":\"touch\",\"timer\":1772971164987}"
},
{
"name": "pixiu_pc_AUTHORITY_CONFIG",
"value": "{\"val\":{\"MPX_OYYHD_TGMDTX\":true,\"MPX_MYYHD_TGSY_MDTX\":true,\"MPX_OGKGL_QFDX\":true,\"MPX_OSPGL_MBSC\":true,\"MPX_MSCZX_ZYZX_YMLB\":true,\"SPX_SJFX\":true,\"MPX_OSPGL_MBBJ\":true,\"MPX_OSCZX_SZYY\":true,\"MPX_MYYHD_JF_JFSZ\":true,\"MPX_OYYZS_QMYQ\":true,\"MPX_MYYHD_YHQ_YQ\":true,\"MPX_MSJFX_SKJL\":true,\"MPX_MDDGL\":true,\"MPX_MSZ_TSSZ\":true,\"MPX_MDDGL_TKLB\":true,\"SPX_WLGL\":true,\"MPX_MSCZX\":true,\"MPX_MSCZX_PPXXGL\":true,\"MPX_MSZ_TSSZ_DXGL\":true,\"MPX_MSZ_YGSZ\":true,\"MPX_MDDGL_KPJL\":true,\"SPX_SCZX\":true,\"MPX_OSCZX_MDPX\":true,\"MPX_OSPGL_SPSJ\":true,\"MPX_OYYHD_CLEAR\":true,\"MPX_MSZ_WXSZ\":true,\"MPX_OGKGL_XGDJ\":true,\"MPX_MSPGL_SPLB\":true,\"MPX_OSZ_SZTGFXHS\":true,\"MPX_MSCZX_ZYZX_ZYZX\":true,\"MPX_MGKGL_GKLB\":true,\"MPX_MSZ_YYSZ_YYSZ\":true,\"MPX_MSCSY\":true,\"MPX_OYYHD_XZXSMS\":true,\"MPX_OYY_QXYY\":true,\"MPX_ODDGL_GQDDTK\":true,\"MPX_ODDGL_QXDD\":true,\"MPX_MYYHD_YHQ_LQHD\":true,\"MPX_MYYHD_YHQ\":true,\"SPX_SCSY\":true,\"MPX_OYYZS_SMYQ\":true,\"MPX_OSCZX_SCSJDT\":true,\"MPX_MYYHD_TGSY_MDSZ\":true,\"MPX_MYYHD_YHQ_SJTJ\":true,\"MPX_ODDGL_TYTKSQ\":true,\"MPX_MSZ_MDSZ_MDGL\":true,\"MPX_ODDGL_WQMHX\":true,\"SPX_YY\":true,\"MPX_MYYHD_JF_JFSC\":true,\"MPX_MSPGL_SPLB_MDMB\":true,\"MPX_MYYHD_JF\":true,\"MPX_MSZ_QXSZ\":true,\"MPX_OSCZX_YGPX\":true,\"MPX_MGKGL\":true,\"MPX_OGKGL_SFYHQ\":true,\"MPX_OYYHD_XZPTMS\":true,\"MPX_OYYHD_CHYHQ\":true,\"MPX_MSZ_ZFSZ\":true,\"MPX_MSZ\":true,\"MPX_MYYHD_TGSY_CJJL\":true,\"MPX_OSPGL_TJZMD\":true,\"SPX_GKGL\":true,\"MPX_OSPGL_TJZMB\":true,\"MPX_OYY_XGYY\":true,\"MPX_MWLGL_SCTK\":true,\"MPX_OGKGL_QFYHQ\":true,\"MPX_OYYHD_XZXSTH\":true,\"MPX_OYYZS_HXMX\":true,\"MPX_MYYHD\":true,\"MPX_ODDGL_CEHX\":true,\"GK113\":true,\"SPX_SPGL\":true,\"MPX_MYYHD_MTHK_YQ\":true,\"MPX_OYYHD_XZYHQ\":true,\"MPX_MSZ_MDSZ_QYGL\":true,\"MPX_MYYHD_TGSY_BDJL\":true,\"MPX_OGKGL_CKYZM\":true,\"MPX_ODDGL_DDTK\":true,\"MPX_OSCZX_PPZYZX\":true,\"MPX_MYYHD_MTHK_QT\":true,\"MPX_MYYHD_XSYX\":true,\"SPX_SZ\":true,\"MPX_OGKGL_CKLS\":true,\"MPX_ODDGL_CEHX_hour\":48,\"MPX_MSZ_SPSZ\":true,\"MPX_MSPGL\":true,\"MPX_MYYHD_MTHK_YY\":true,\"MPX_MSCZX_PPXXGL_PPSZ\":true,\"MPX_ODDGL_DDGQHX\":true,\"SPX_YYHD\":true,\"MPX_MSPGL_SPLB_ZBMB\":true,\"MPX_OGKGL_ZSJF\":true,\"MPX_MSCZX_ZYZX\":true,\"MPX_MSZ_TSSZ_TSSZ\":true,\"MPX_OYYZS\":true,\"MPX_OSCZX_HYZXZX\":true,\"MPX_MSZ_MDSZ\":true,\"MPX_MYYHD_XSPT\":true,\"MPX_OYYHD_TGYGTX\":true,\"MPX_OYYHD_BJYHQ\":true,\"MPX_OYYZS_SJGL\":true,\"MPX_OGKGL_SZWXK\":true,\"MPX_MDDGL_DDLB\":true,\"MPX_OGKGL_GKZL\":true,\"MPX_MDDGL_HXYQ_YQZX\":true,\"MPX_MSZ_YYSZ_XMSZ\":true,\"MPX_MYYHD_TGSY_TXZX\":true,\"MPX_MYYHD_TGSY_TGYJ\":true,\"MPX_MSZ_SPSZ_TYSZ\":true,\"MPX_OYYHD_XZLQHD\":true,\"MPX_MSCZX_PPXXGL_MDZX\":true,\"MPX_MDDGL_HXYQ\":true,\"MPX_OYYZS_SMMX\":true,\"SPX_DDGL\":true,\"MPX_MYYHD_MTHK_SY\":true,\"MPX_MYYHD_YHQ_LB\":true,\"MPX_OGKGL_CHYHQ\":true,\"MPX_MDDGL_TKSQ\":true,\"MPX_MYYHD_TGSY\":true,\"MPX_MDDGL_HXYQ_YQSZ\":true,\"MPX_MYYHD_MTHK_SZ\":true,\"SPX_YYZS\":true},\"timer\":0}"
},
{
"name": "pixiu_pc_SHOP_ASSIGNED",
"value": "{\"val\":[],\"timer\":0}"
},
{
"name": "pixiu_pc_USER",
"value": "{\"val\":{\"id\":33765,\"merchantId\":341,\"shopId\":null,\"no\":\"4\",\"name\":\"测试3\",\"birthday\":null,\"mobile\":\"17700000003\",\"gender\":null,\"avatar\":\"\",\"departmentNo\":null,\"isServing\":null,\"levels\":null,\"level\":null,\"groupNo\":null,\"group\":null,\"remark\":null,\"ext\":{\"shopAssigned\":[],\"regionAssigned\":[],\"voiceBroadcast\":{\"mallOrderEnable\":\"Y\",\"reservationEnable\":\"Y\",\"staticCodeEnable\":\"Y\"},\"userIdentity\":\"ROOT\"},\"status\":\"NORMAL\",\"createTs\":1745462180000,\"isReservation\":\"N\",\"isAppEnable\":\"Y\",\"shopAssigned\":[],\"regionAssigned\":[],\"disabledDate\":null,\"groupSubNo\":null,\"groupSub\":null,\"groupUserNos\":null,\"groupSubUserNos\":null,\"roleCode\":\"\",\"initRoleCode\":\"MERCHANT_ADMIN\",\"appCheckSn\":null,\"label\":null,\"introduction\":null,\"openId\":null,\"authority\":null,\"isReservationMall\":\"N\",\"isKpiEnable\":\"Y\",\"isLogAuditEnable\":\"Y\",\"mpOpenid\":null,\"unionid\":null,\"wxOpenid\":null,\"crmSn\":null,\"userIdentity\":\"ROOT\",\"managerRole\":\"MERCHANT\",\"userId\":33765,\"userNo\":\"4\",\"userName\":\"测试3\",\"positionNos\":null,\"cluster\":\"DEFAULT\",\"unlockLeftSecond\":null,\"lastLoginIp\":\"127.0.0.1\",\"accountId\":354},\"timer\":0}"
},
{
"name": "last_login_info",
"value": "{\"mobile\":\"17700000003\",\"userId\":33765,\"shopId\":null,\"merchantId\":341,\"timer\":1747051164992}"
},
{
"name": "pixiu_pc_pushTokenSn",
"value": "d8bbf9d0-8bfe-4487-b0a8-f6fd839ebc70"
},
{
"name": "dbmerchantid",
"value": "{\"val\":341,\"timer\":0}"
},
{
"name": "pixiu_pc_refresh_token",
"value": "{\"val\":\"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOiJSRUZSRVNIX1RPS0VOMTQyNTciLCJkZXZpY2UiOiJITEtfRU1QTE9ZRUVfQVBQX1NJREVBUFAiLCJlZmYiOjE3NDg3NzkxNjc2MjgsInJuU3RyIjoiRUZsSTZXQW9NdjFsd2RpNFFrZWxiWlFWV2JYS2VSRTMiLCJhY2NvdW50Ijp7ImlkIjoxNDI1NywiYnVzaW5lc3NTaWRlIjoiSExLX0VNUExPWUVFX0FQUF9TSURFIiwibmFtZSI6IjE3NzAwMDAwMDAzIiwibW9iaWxlIjoiMTc3MDAwMDAwMDMiLCJhY2NvdW50TG9naW5UeXBlIjoiTE9HSU5fQUNDT1VOVCIsInRpbWVzdGFtcCI6MTc0NzA1MTE2NjYyNywidG9rZW5UeXBlIjoiUkVGUkVTSF9UT0tFTiIsImFjY291bnRSb2xlTGlzdCI6W3siaWQiOjYxOTM1LCJzeXN0ZW1JZCI6MTEsInN5c3RlbUNvZGUiOiJIRyIsIm1lcmNoYW50SWQiOjM0MSwiYXBwSWQiOiJhY2NvdW50MjUwNDIzU0VFbjFEMFRhM1BWdjVZIiwidXNlcklkIjoiMzM3NjUiLCJyb2xlQ29kZSI6IiJ9XSwidXNlclJvbGUiOnsiaWQiOjYxOTM1LCJzeXN0ZW1JZCI6MTEsInN5c3RlbUNvZGUiOiJIRyIsIm1lcmNoYW50SWQiOjM0MSwiYXBwSWQiOiJhY2NvdW50MjUwNDIzU0VFbjFEMFRhM1BWdjVZIiwidXNlcklkIjoiMzM3NjUiLCJyb2xlQ29kZSI6IiIsImF1dGhvcml0eSI6Int9In0sInRpbWVvdXQiOjg2NDAwMSwicmVmcmVzaFRpbWVvdXQiOjB9fQ.g3GnEY0TH2AVDsIBObQovWut-ReavCt129Eq3em-ecg\",\"timer\":1772971164987}"
}
],
"indexedDB": [
{
"name": "pixiu_pc_test_341",
"version": 2,
"stores": [
{
"name": "keyvaluepairs",
"autoIncrement": false,
"records": [
{
"key": "pixiu_pc_account_mobile",
"value": "17700000003"
},
{
"key": "pixiu_pc_currentShop",
"value": {
"341": {}
}
},
{
"key": "pixiu_pc_metadata",
"value": {
"metadata": {
"merchantConfig": [],
"shop": [
{
"id": 1000055,
"merchantId": 341,
"name": "惠购一店",
"address": "广东省深圳市天安云谷",
"contact": {
"name": "雨霖铃"
},
"phone": "17700000000",
"comment": "...",
"invalidDate": 1745399221000,
"status": "NORMAL",
"createTs": 1745399221000,
"lastUpdateTs": 1745917903000,
"openAdminWorkerTs": null,
"isAdminWorkerEnable": "Y",
"adminExt": {
"city": {
"name": "深圳",
"id": "0755"
},
"employee": {
"name": "深圳公司",
"id": "24"
},
"group": {
"name": "深圳_深圳公司",
"id": "10"
}
},
"photos": null
},
{
"id": 1000058,
"merchantId": 341,
"name": "惠购二店",
"address": "广东省深圳市南山区",
"contact": {
"name": "wp"
},
"phone": "17700000000",
"comment": "...",
"invalidDate": 1745823984000,
"status": "NORMAL",
"createTs": 1745823984000,
"lastUpdateTs": 1745823984000,
"openAdminWorkerTs": null,
"isAdminWorkerEnable": "Y",
"adminExt": {
"city": {
"name": "长沙",
"id": "0731"
},
"employee": {
"name": "深圳公司",
"id": "24"
},
"provinceId": "12",
"group": {
"name": "深圳_深圳公司",
"id": "10"
}
},
"photos": null
}
],
"merchantRegion": [
{
"createTs": 1746759722000,
"lastUpdateTs": 1746759733000,
"id": 89,
"merchantId": 341,
"appId": "hg250423NOKimkVgJkZeurJ",
"platformId": 1,
"name": "自营",
"shopIds": [
1000055
],
"status": "NORMAL"
},
{
"createTs": 1746759743000,
"lastUpdateTs": 1746759743000,
"id": 90,
"merchantId": 341,
"appId": "hg250423NOKimkVgJkZeurJ",
"platformId": 1,
"name": "非自营",
"shopIds": [
1000058
],
"status": "NORMAL"
}
],
"merchantInterConfig": {
"merchantId": 341,
"languageCode": "zh",
"countryCode": "CN",
"zoneId": "UTC+08:00",
"mobileCode": "0086",
"currencyCode": "RMB",
"dateFormatter": "yyyy-MM-dd HH:mm:ss",
"isLimitMobile": "Y"
}
},
"lastMetaTs": {
"shopModule": 0,
"merchantInterConfig": 1745462607538,
"merchantConfig": 1745461181175,
"shop": 1747046628259,
"merchantRegion": 1746759742733
},
"nowMetaTs": {
"propertyUnit": 1747051166985,
"mallConfig": 1745906578361,
"mallUserConfig": 1747051166985,
"merchantConfig": 1745461181175,
"userReport": 1747051166985,
"goods": 1746503140614,
"source": 1745566422174,
"mallNavigation": 1746778299148,
"systemApplication": 1745821307946,
"mallItemClassCode": 1745743839566,
"mallItemTemp": 1747039398684,
"queryConfig": 1747051166985,
"billRemark": 1746512122608,
"tag": 1745566422174,
"logTpl": 1745566516967,
"reservationConfig": 1745399192118,
"customerGlobalConfig": 1745462599381,
"reportKpi": 1747051166985,
"mallItemClass": 1747021497785,
"stockProperty": 1747051166985,
"customerInvitationConfig": 1745566428774,
"mallTheme": 1746603934265,
"mallItemSeries": 1747051166985,
"serviceAssessments": 1747051166985,
"merchant": 1747050088127,
"propertyDiscountRule": 1747051166985,
"mallShop": 1747038774181,
"weComTagGroup": 1747051166986,
"pack": 1746684501765,
"initWechatConfig": 1746603934266,
"vocationSchedule": 1747051166985,
"commonWechatConfig": 1746330905458,
"shiftConfig": 1747051166985,
"doymetMerchant": 1745399399557,
"kpiType": 1747051166985,
"stockPropertyCapacityUnit": 1747051166985,
"stockSupplier": 1747051166986,
"cloudPrintConfig": 1747051166985,
"userKpiConfig": 1747051166985,
"position": 1746606766856,
"mallItem": 1747046628259,
"mallPage": 1747035545725,
"mallItemCategory": 1746520065367,
"stockPropertyFormula": 1747051166985,
"merchantInterConfig": 1745462607538,
"profileSet": 1745399192061,
"mallItemTag": 1745566292162,
"classify": 1745566422174,
"helpUser": 1747051166985,
"pointConfig": 1746005104207,
"mallBarrage": 1747051166985,
"shop": 1747046628259,
"role": 1747030141967,
"wechatConfig": 1746603934268,
"weComUser": 1747051166986,
"cashierConfig": 1747051166985,
"userManageConfig": 1747051166985,
"platform": 1747051166985,
"mallOrderConfig": 1746339824054,
"paymentType": 1747051166985,
"paymentConfig": 1745898654335,
"doymetShop": 1745899102867,
"customerConfig": 1745399192059,
"userLevel": 1746339359488,
"reservationProperty": 1745399192120,
"shopModule": 1746606766856,
"propertyType": 1746341284422,
"merchantPushConfig": 1747051166986,
"tagType": 1745566422174,
"userRankingConfig": 1747051166985,
"profitConfig": 1747051166985,
"stockConfig": 1747051166986,
"department": 1746341282549,
"expenseType": 1747051166985,
"customerRemark": 1746502503918,
"weComTag": 1747051166986,
"channelCommissionConfig": 1747051166985,
"stockType": 1747051166986,
"cardType": 1746341284422,
"weComGroup": 1747051166986,
"classifyType": 1745566439945,
"mallBrand": 1746756758284,
"stockFactory": 1747051166986,
"thdApplication": 1745399232751,
"merchantRegion": 1746759742733,
"customerGradeConfig": 1745566422174,
"room": 1747051166985,
"thdPaymentConfig": 1745898654335,
"simpleWechatConfig": 1746603934266,
"mallItemShop": 1747046628259,
"application": 1745399220897,
"service": 1746341284422,
"report": 1747051166985,
"propertyDiscountRuleScheme": 1747051166985,
"user": 1747031922994,
"mallUser": 1746688858942
}
}
}
],
"indexes": []
},
{
"name": "local-forage-detect-blob-support",
"autoIncrement": false,
"records": [],
"indexes": []
}
]
},
{
"name": "pixiu_pc_test_init",
"version": 2,
"stores": [
{
"name": "keyvaluepairs",
"autoIncrement": false,
"records": [],
"indexes": []
},
{
"name": "local-forage-detect-blob-support",
"autoIncrement": false,
"records": [],
"indexes": []
}
]
}
]
}
]
}

View File

@ -0,0 +1,27 @@
import { test, expect } from '@playwright/test';
import { CommondityCategoryPage } from '../../pages/commodity/commondityCategoryPage';
import { CommondityCreateCategoryPage } from '../../pages/commodity/commondityCreateCategoryPage';
test('商品分类', async ({ page }) => {
const commondityCategoryPage = new CommondityCategoryPage(page);
await page.goto('#/mall/goodsClass/goodsClassList');
await page.getByText('概况').waitFor();
await expect(page.locator('.lv3_loading')).toBeHidden();
await commondityCategoryPage.verify_table_headers();
const content = await commondityCategoryPage.get_table_row_content(1);
console.log(content);
});
test('新增商品分类', async ({ page }) => {
const commondityCategoryPage = new CommondityCategoryPage(page);
const commondityCreateCategoryPage = new CommondityCreateCategoryPage(page);
await page.goto('#/mall/goodsClass/goodsClassList');
await page.getByText('概况').waitFor();
await expect(page.locator('.lv3_loading')).toBeHidden();
await commondityCategoryPage.commondity_create_category_button.click();
await commondityCreateCategoryPage.open_create_category_page_success();
await commondityCreateCategoryPage.create_category('测试分类', 'test', '1', 1);
});

View File

@ -0,0 +1,27 @@
import { test, expect } from '@playwright/test';
test.describe('商品列表页面', () => {
test('商品列表页面', async ({ page, baseURL }) => {
console.log(baseURL);
await page.goto('#/mall/waresList/merchantList');
await page.getByText('概况').waitFor();
await expect(page.locator('.lv3_loading')).toBeHidden();
const table_header_name_list = ['商品名称', '品牌', '分类', '已上架门店', '实际销量'];
// 验证表格头
for (let i = 0; i < table_header_name_list.length; i++) {
await expect(
page.locator('.m-table__header-wrapper').getByRole('cell', { name: table_header_name_list[i] })
).toBeVisible();
}
await expect(page.getByRole('cell', { name: '操作' })).toBeVisible();
await expect(page.getByRole('textbox', { name: '关键字搜索' })).toBeVisible();
await expect(page.getByRole('combobox').getByTitle('全部品牌')).toBeVisible();
await expect(page.locator('span').filter({ hasText: '全部分类' })).toBeVisible();
await expect(page.getByRole('button', { name: /查\s询/ })).toBeVisible();
await expect(page.getByRole('button', { name: '新增商品' })).toBeVisible();
await expect(page.locator('.batch').getByText('批量操作', { exact: true })).toBeVisible();
});
});

View File

@ -4,7 +4,7 @@ import { LoginPage } from '../pages/auth/loginPage';
setup('state setup', async ({ page }) => {
await page.goto(process.env.BASE_URL || 'http://localhost:3000');
const loginPage = new LoginPage(page);
await loginPage.user_login('17700000002', 'a123456');
await loginPage.user_login('17700000003', 'a123456');
await page.pause();
await loginPage.user_login_success().waitFor();
await page.context().storageState({ path: 'state.json', indexedDB: true });