Commit 6462c2171aa5a0352f27029fd592627663cf0b04

Authored by 李玉霞
1 parent 900f1141

解冲突

fixtures/testFixture.ts
@@ -5,12 +5,9 @@ import { ProductCategoryPage } from '../pages/productCategoryPage'; @@ -5,12 +5,9 @@ import { ProductCategoryPage } from '../pages/productCategoryPage';
5 import { SalePage } from '../pages/salePage'; 5 import { SalePage } from '../pages/salePage';
6 import { ConsignmentPage } from '../pages/consignmentPage'; 6 import { ConsignmentPage } from '../pages/consignmentPage';
7 import { CustomerPage } from '../pages/customerPage'; 7 import { CustomerPage } from '../pages/customerPage';
8 -<<<<<<< HEAD  
9 import { PurchasePage } from '../pages/purchasePage'; 8 import { PurchasePage } from '../pages/purchasePage';
10 -=======  
11 import { SupplierPage } from '../pages/supplierPage'; 9 import { SupplierPage } from '../pages/supplierPage';
12 import { SupplierGroupingPage } from '../pages/supplierGroupingPage'; 10 import { SupplierGroupingPage } from '../pages/supplierGroupingPage';
13 ->>>>>>> 75680a318acf8a2fac1855dedb6aca403f6d4ab7  
14 11
15 /** 12 /**
16 * 页面对象夹具类型定义 13 * 页面对象夹具类型定义
@@ -20,38 +17,38 @@ export type PageFixtures = { @@ -20,38 +17,38 @@ export type PageFixtures = {
20 * 登录页面 17 * 登录页面
21 */ 18 */
22 loginPage: LoginPage; 19 loginPage: LoginPage;
23 - 20 +
24 /** 21 /**
25 * 商品管理页面 22 * 商品管理页面
26 */ 23 */
27 productPage: ProductPage; 24 productPage: ProductPage;
28 - 25 +
29 /** 26 /**
30 * 商品分类页面 27 * 商品分类页面
31 */ 28 */
32 - // productCategoryPage: ProductCategoryPage;  
33 - 29 + productCategoryPage: ProductCategoryPage;
  30 +
34 /** 31 /**
35 * 销售开单页面 32 * 销售开单页面
36 */ 33 */
37 salePage: SalePage; 34 salePage: SalePage;
38 - 35 +
39 /** 36 /**
40 * 代销入库页面 37 * 代销入库页面
41 */ 38 */
42 consignmentPage: ConsignmentPage; 39 consignmentPage: ConsignmentPage;
43 - 40 +
44 /** 41 /**
45 * 客户管理页面 42 * 客户管理页面
46 */ 43 */
47 customerPage: CustomerPage; 44 customerPage: CustomerPage;
48 - 45 +
49 /** 46 /**
50 -<<<<<<< HEAD  
51 * 采购入库页面 47 * 采购入库页面
52 */ 48 */
53 purchasePage: PurchasePage; 49 purchasePage: PurchasePage;
54 -======= 50 +
  51 + /**
55 * 供应商管理页面 52 * 供应商管理页面
56 */ 53 */
57 supplierPage: SupplierPage; 54 supplierPage: SupplierPage;
@@ -60,7 +57,6 @@ export type PageFixtures = { @@ -60,7 +57,6 @@ export type PageFixtures = {
60 * 供应商分组页面 57 * 供应商分组页面
61 */ 58 */
62 supplierGroupingPage: SupplierGroupingPage; 59 supplierGroupingPage: SupplierGroupingPage;
63 ->>>>>>> 75680a318acf8a2fac1855dedb6aca403f6d4ab7  
64 }; 60 };
65 61
66 /** 62 /**
@@ -71,37 +67,37 @@ export const test = base.extend&lt;PageFixtures&gt;({ @@ -71,37 +67,37 @@ export const test = base.extend&lt;PageFixtures&gt;({
71 loginPage: async ({ page }, use) => { 67 loginPage: async ({ page }, use) => {
72 await use(new LoginPage(page)); 68 await use(new LoginPage(page));
73 }, 69 },
74 - 70 +
75 // 商品管理页面 71 // 商品管理页面
76 productPage: async ({ page }, use) => { 72 productPage: async ({ page }, use) => {
77 await use(new ProductPage(page)); 73 await use(new ProductPage(page));
78 }, 74 },
79 -  
80 - // // 商品分类页面  
81 - // productCategoryPage: async ({ page }, use) => {  
82 - // await use(new ProductCategoryPage(page));  
83 - // },  
84 - 75 +
  76 + // 商品分类页面
  77 + productCategoryPage: async ({ page }, use) => {
  78 + await use(new ProductCategoryPage(page));
  79 + },
  80 +
85 // 销售开单页面 81 // 销售开单页面
86 salePage: async ({ page }, use) => { 82 salePage: async ({ page }, use) => {
87 await use(new SalePage(page)); 83 await use(new SalePage(page));
88 }, 84 },
89 - 85 +
90 // 代销入库页面 86 // 代销入库页面
91 consignmentPage: async ({ page }, use) => { 87 consignmentPage: async ({ page }, use) => {
92 await use(new ConsignmentPage(page)); 88 await use(new ConsignmentPage(page));
93 }, 89 },
94 - 90 +
95 // 客户管理页面 91 // 客户管理页面
96 customerPage: async ({ page }, use) => { 92 customerPage: async ({ page }, use) => {
97 await use(new CustomerPage(page)); 93 await use(new CustomerPage(page));
98 }, 94 },
99 -  
100 -<<<<<<< HEAD 95 +
101 // 采购入库页面 96 // 采购入库页面
102 purchasePage: async ({ page }, use) => { 97 purchasePage: async ({ page }, use) => {
103 await use(new PurchasePage(page)); 98 await use(new PurchasePage(page));
104 -======= 99 + },
  100 +
105 // 供应商管理页面 101 // 供应商管理页面
106 supplierPage: async ({ page }, use) => { 102 supplierPage: async ({ page }, use) => {
107 await use(new SupplierPage(page)); 103 await use(new SupplierPage(page));
@@ -110,7 +106,6 @@ export const test = base.extend&lt;PageFixtures&gt;({ @@ -110,7 +106,6 @@ export const test = base.extend&lt;PageFixtures&gt;({
110 // 供应商分组页面 106 // 供应商分组页面
111 supplierGroupingPage: async ({ page }, use) => { 107 supplierGroupingPage: async ({ page }, use) => {
112 await use(new SupplierGroupingPage(page)); 108 await use(new SupplierGroupingPage(page));
113 ->>>>>>> 75680a318acf8a2fac1855dedb6aca403f6d4ab7  
114 }, 109 },
115 }); 110 });
116 111
@@ -133,28 +128,36 @@ export const fullTest = authTest.extend&lt;PageFixtures&gt;({ @@ -133,28 +128,36 @@ export const fullTest = authTest.extend&lt;PageFixtures&gt;({
133 loginPage: async ({ authenticatedPage }, use) => { 128 loginPage: async ({ authenticatedPage }, use) => {
134 await use(new LoginPage(authenticatedPage)); 129 await use(new LoginPage(authenticatedPage));
135 }, 130 },
136 - 131 +
137 productPage: async ({ authenticatedPage }, use) => { 132 productPage: async ({ authenticatedPage }, use) => {
138 await use(new ProductPage(authenticatedPage)); 133 await use(new ProductPage(authenticatedPage));
139 }, 134 },
140 - 135 +
  136 + productCategoryPage: async ({ authenticatedPage }, use) => {
  137 + await use(new ProductCategoryPage(authenticatedPage));
  138 + },
  139 +
141 salePage: async ({ authenticatedPage }, use) => { 140 salePage: async ({ authenticatedPage }, use) => {
142 await use(new SalePage(authenticatedPage)); 141 await use(new SalePage(authenticatedPage));
143 }, 142 },
144 - 143 +
145 consignmentPage: async ({ authenticatedPage }, use) => { 144 consignmentPage: async ({ authenticatedPage }, use) => {
146 await use(new ConsignmentPage(authenticatedPage)); 145 await use(new ConsignmentPage(authenticatedPage));
147 }, 146 },
148 - customerPage: async ({authenticatedPage }, use) =>{ 147 +
  148 + customerPage: async ({ authenticatedPage }, use) => {
149 await use(new CustomerPage(authenticatedPage)); 149 await use(new CustomerPage(authenticatedPage));
150 }, 150 },
151 -  
152 - supplierPage: async ({authenticatedPage }, use) => { 151 +
  152 + purchasePage: async ({ authenticatedPage }, use) => {
  153 + await use(new PurchasePage(authenticatedPage));
  154 + },
  155 +
  156 + supplierPage: async ({ authenticatedPage }, use) => {
153 await use(new SupplierPage(authenticatedPage)); 157 await use(new SupplierPage(authenticatedPage));
154 }, 158 },
155 159
156 - supplierGroupingPage: async ({authenticatedPage }, use) => { 160 + supplierGroupingPage: async ({ authenticatedPage }, use) => {
157 await use(new SupplierGroupingPage(authenticatedPage)); 161 await use(new SupplierGroupingPage(authenticatedPage));
158 }, 162 },
159 -  
160 - });  
161 \ No newline at end of file 163 \ No newline at end of file
  164 +});
tests/account.spec.ts
1 -<<<<<<< HEAD  
2 -// import { test, expect } from '@playwright/test';  
3 -// import * as allure from 'allure-js-commons';  
4 -  
5 -// /**  
6 -// * 账目管理测试  
7 -// */  
8 -// test.describe('账目管理', () => {  
9 -// // 使用已保存的认证状态  
10 -// test.use({ storageState: 'auth.json' });  
11 -  
12 -// // 强制测试串行执行  
13 -// test.describe.configure({ mode: 'serial' });  
14 -  
15 -// /**  
16 -// * 生成随机账目名称(三个字+"费",带时间戳后缀防止重复)  
17 -// */  
18 -// function generateAccountName(): string {  
19 -// const prefixes = ['管理', '维护', '看管', '保管', '仓储', '代理', '服务', '咨询', '技术', '运营'];  
20 -// const prefix = prefixes[Math.floor(Math.random() * prefixes.length)];  
21 -// const timestamp = Date.now().toString().slice(-4);  
22 -// return `${prefix}费${timestamp}`;  
23 -// }  
24 -  
25 -// /**  
26 -// * 生成随机收支类型  
27 -// */  
28 -// function generateIncomeType(): '收入' | '支出' {  
29 -// return Math.random() > 0.5 ? '收入' : '支出';  
30 -// }  
31 -  
32 -// /**  
33 -// * 生成包含"自动化"的备注  
34 -// */  
35 -// function generateRemark(): string {  
36 -// const timestamp = Date.now().toString().slice(-6);  
37 -// return `自动化测试备注${timestamp}`;  
38 -// }  
39 -  
40 -// test('新增账目', async ({ page }, testInfo) => {  
41 -// // 添加allure元素  
42 -// await allure.epic('账目管理');  
43 -// await allure.feature('账目信息');  
44 -// await allure.story('新增账目');  
45 -  
46 -// // 生成随机账目数据  
47 -// const accountName = generateAccountName();  
48 -// const incomeType = generateIncomeType();  
49 -// const remark = generateRemark();  
50 -  
51 -// console.log('账目名称:', accountName);  
52 -// console.log('收支类型:', incomeType);  
53 -// console.log('备注:', remark);  
54 -  
55 -// // 步骤1:进入账目管理页面  
56 -// await allure.step('进入账目管理页面', async () => {  
57 -// await page.goto('/');  
58 -// await page.waitForLoadState('networkidle', { timeout: 30000 });  
59 -// await page.getByText('更多 >').click();  
60 -// await page.waitForTimeout(500);  
61 -// await page.getByText('账目管理').first().click();  
62 -// await page.waitForLoadState('networkidle', { timeout: 30000 });  
63 -// });  
64 -  
65 -// // 步骤2:点击新增按钮  
66 -// await allure.step('点击新增按钮', async () => {  
67 -// await page.getByText('新增', { exact: true }).click();  
68 -// await page.waitForTimeout(500);  
69 -// });  
70 -  
71 -// // 步骤3:填写账目表单  
72 -// await allure.step('填写账目表单', async () => {  
73 -// // 填写账目名称  
74 -// await page.locator('uni-input').filter({ hasText: '账目名称' }).getByRole('textbox').click();  
75 -// await page.locator('uni-input').filter({ hasText: '账目名称' }).getByRole('textbox').fill(accountName);  
76 -  
77 -// // 选择收支类型  
78 -// if (incomeType === '支出') {  
79 -// await page.locator('.nut-radio-group > uni-view:nth-child(2) > .nut-icon').click();  
80 -// }  
81 -// // 收入是默认选项,无需选择  
82 -  
83 -// // 填写备注  
84 -// await page.locator('uni-scroll-view').filter({ hasText: '账目名称*科目名称收支类别 收入 支出 启用状态备注请输入' }).locator('textarea').click();  
85 -// await page.locator('uni-scroll-view').filter({ hasText: '账目名称*科目名称收支类别 收入 支出 启用状态备注请输入' }).locator('textarea').fill(remark);  
86 -// });  
87 -  
88 -// // 步骤4:保存账目  
89 -// await allure.step('保存账目', async () => {  
90 -// await page.getByText('保存').click();  
91 -// await page.waitForTimeout(1000);  
92 -// });  
93 -  
94 -// // 步骤5:验证账目创建成功  
95 -// await allure.step('验证账目创建成功', async () => {  
96 -// await page.locator('uni-input').filter({ hasText: '账目名称' }).getByRole('textbox').click();  
97 -// await page.locator('uni-input').filter({ hasText: '账目名称' }).getByRole('textbox').fill(accountName);  
98 -// await page.waitForTimeout(1000);  
99 -  
100 -// // 验证账目名称出现在列表中  
101 -// const accountVisible = await page.locator(`uni-view:has-text("${accountName}")`).isVisible().catch(() => false);  
102 -// expect(accountVisible).toBeTruthy();  
103 -// });  
104 -// });  
105 -// });  
106 -=======  
107 import { test, expect } from '@playwright/test'; 1 import { test, expect } from '@playwright/test';
108 import * as allure from 'allure-js-commons'; 2 import * as allure from 'allure-js-commons';
109 import { AccountPage } from '../pages/accountPage'; 3 import { AccountPage } from '../pages/accountPage';
@@ -265,4 +159,3 @@ test.describe(&#39;账目管理&#39;, () =&gt; { @@ -265,4 +159,3 @@ test.describe(&#39;账目管理&#39;, () =&gt; {
265 }); 159 });
266 }); 160 });
267 }); 161 });
268 ->>>>>>> xfbhzxt  
tests/supplier.spec.ts
@@ -129,14 +129,12 @@ test.describe(&#39;供应商管理&#39;, () =&gt; { @@ -129,14 +129,12 @@ test.describe(&#39;供应商管理&#39;, () =&gt; {
129 const debtAmount = '100'; 129 const debtAmount = '100';
130 const remark = '测试录入欠款'; 130 const remark = '测试录入欠款';
131 131
132 - // 步骤1:进入供应商管理页面并选择第2个供应商,记录原始应付金额和供应商名称  
133 - let supplierName = ''; 132 + // 步骤1:进入供应商管理页面并选择第2个供应商,记录原始应付金额
134 const originalAmount = await allure.step('记录原始应付金额', async () => { 133 const originalAmount = await allure.step('记录原始应付金额', async () => {
135 await supplierPage.navigateToSupplierManagement(); 134 await supplierPage.navigateToSupplierManagement();
136 await supplierPage.clickSupplierItemByIndex(1); 135 await supplierPage.clickSupplierItemByIndex(1);
137 await supplierPage.waitForPageLoad(); 136 await supplierPage.waitForPageLoad();
138 await supplierPage.wait(300); 137 await supplierPage.wait(300);
139 - supplierName = await supplierPage.getSupplierName();  
140 return await supplierPage.parsePayableAmount(); 138 return await supplierPage.parsePayableAmount();
141 }); 139 });
142 console.log('录入前应付金额:', originalAmount); 140 console.log('录入前应付金额:', originalAmount);
@@ -171,12 +169,12 @@ test.describe(&#39;供应商管理&#39;, () =&gt; { @@ -171,12 +169,12 @@ test.describe(&#39;供应商管理&#39;, () =&gt; {
171 await supplierPage.saveDebt(); 169 await supplierPage.saveDebt();
172 }); 170 });
173 171
174 - // 步骤8:验证欠款录入成功 - 搜索同一供应商查看应付金额 172 + // 步骤8:验证欠款录入成功 - 选择同一供应商查看应付金额
175 const currentAmount = await allure.step('验证欠款录入成功', async () => { 173 const currentAmount = await allure.step('验证欠款录入成功', async () => {
176 await supplierPage.navigateToSupplierManagement(); 174 await supplierPage.navigateToSupplierManagement();
177 await supplierPage.clickSupplierItemByIndex(1); 175 await supplierPage.clickSupplierItemByIndex(1);
178 - await supplierPage.page.waitForLoadState('networkidle');  
179 - await supplierPage.page.waitForTimeout(300); 176 + await supplierPage.waitForPageLoad();
  177 + await supplierPage.wait(300);
180 const amount = await supplierPage.parsePayableAmount(); 178 const amount = await supplierPage.parsePayableAmount();
181 console.log('录入后应付金额:', amount); 179 console.log('录入后应付金额:', amount);
182 return amount; 180 return amount;