Skip to content

Commit 4ac1211

Browse files
committed
Update constructor
1 parent 3e65679 commit 4ac1211

File tree

5 files changed

+59
-122
lines changed

5 files changed

+59
-122
lines changed

test/End-To-End/.gemini/commands/page-model.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import { Page } from '@playwright/test';
5959
import { PageBase } from '@models/PageBase';
6060
6161
export class HomePage extends PageBase {
62-
62+
readonly titleField = this.page.locator('#Title');
6363
constructor(page: Page) {
6464
super(page);
6565
}
@@ -76,7 +76,7 @@ import { Page } from '@playwright/test';
7676
import { AdminPageBase } from "@models/AdminPageBase";
7777
7878
export class ArticleManagementPage extends AdminPageBase {
79-
79+
readonly titleField = this.page.locator('#Title');
8080
constructor(page: Page) {
8181
super(page);
8282
}

test/End-To-End/.qwen/commands/page-model.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import { Page } from '@playwright/test';
5959
import { PageBase } from '@models/PageBase';
6060
6161
export class HomePage extends PageBase {
62-
62+
readonly titleField = this.page.locator('#Title');
6363
constructor(page: Page) {
6464
super(page);
6565
}
@@ -76,7 +76,7 @@ import { Page } from '@playwright/test';
7676
import { AdminPageBase } from "@models/AdminPageBase";
7777
7878
export class ArticleManagementPage extends AdminPageBase {
79-
79+
readonly titleField = this.page.locator('#Title');
8080
constructor(page: Page) {
8181
super(page);
8282
}

test/End-To-End/src/admin/ArticleFormPage.ts

Lines changed: 19 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,32 @@ import { AdminPageBase } from '@models/AdminPageBase';
33

44
export class ArticleFormPage extends AdminPageBase {
55
// Form fields
6-
readonly titleField: Locator;
7-
readonly urlField: Locator;
8-
readonly summaryField: Locator;
9-
readonly metaKeywordsField: Locator;
10-
readonly metaDescriptionField: Locator;
11-
readonly counterField: Locator;
12-
readonly contentFrame: Locator;
13-
readonly imageThumbUrlField: Locator;
14-
readonly imageUrlField: Locator;
15-
readonly articleTypeField: Locator;
16-
readonly publishDateField: Locator;
17-
readonly statusDropdown: Locator;
18-
readonly descriptionField: Locator;
6+
readonly titleField = this.page.locator('#Title');
7+
readonly urlField = this.page.locator('#Url');
8+
readonly summaryField = this.page.locator('#Summary');
9+
readonly metaKeywordsField = this.page.locator('#MetaKeyWords');
10+
readonly metaDescriptionField = this.page.locator('#MetaDescription');
11+
readonly counterField = this.page.locator('#Counter');
12+
readonly contentFrame = this.page.locator('#ArticleContent');
13+
readonly imageThumbUrlField = this.page.locator('#ImageThumbUrl');
14+
readonly imageUrlField = this.page.locator('#ImageUrl');
15+
readonly articleTypeField = this.page.locator('#ArticleTypeID');
16+
readonly publishDateField = this.page.locator('#PublishDate');
17+
readonly statusDropdown = this.page.locator('#Status');
18+
readonly descriptionField = this.page.locator('#Description');
1919

2020
// Buttons
21-
readonly saveButton: Locator;
22-
readonly saveAndExitButton: Locator;
23-
readonly publishButton: Locator;
24-
readonly cancelButton: Locator;
25-
readonly randomUrlButton: Locator;
21+
readonly saveButton = this.page.locator('input[data-value="Create"]');
22+
readonly saveAndExitButton = this.page.locator('input[data-value="CreateAndExit"]');
23+
readonly publishButton = this.page.locator('input[data-value="Publish"]');
24+
readonly cancelButton = this.page.getByRole('link', { name: '取消' });
25+
readonly randomUrlButton = this.page.locator('#Url').locator('..').getByRole('link');
2626

2727
// Article type dropdown elements
28-
readonly articleTypeDropdown: Locator;
28+
readonly articleTypeDropdown = this.page.locator('#dropdown-tree-ArticleTypeID > .form-control');
2929

3030
constructor(page: Page) {
3131
super(page);
32-
// Form fields locators
33-
this.titleField = page.locator('#Title');
34-
this.urlField = page.locator('#Url');
35-
this.summaryField = page.locator('#Summary');
36-
this.metaKeywordsField = page.locator('#MetaKeyWords');
37-
this.metaDescriptionField = page.locator('#MetaDescription');
38-
this.counterField = page.locator('#Counter');
39-
this.contentFrame = page.locator('#ArticleContent');
40-
this.imageThumbUrlField = page.locator('#ImageThumbUrl');
41-
this.imageUrlField = page.locator('#ImageUrl');
42-
this.articleTypeField = page.locator('#ArticleTypeID');
43-
this.publishDateField = page.locator('#PublishDate');
44-
this.statusDropdown = page.locator('#Status');
45-
this.descriptionField = page.locator('#Description');
46-
47-
// Button locators
48-
this.saveButton = page.locator('input[data-value="Create"]');
49-
this.saveAndExitButton = page.locator('input[data-value="CreateAndExit"]');
50-
this.publishButton = page.locator('input[data-value="Publish"]');
51-
this.cancelButton = page.getByRole('link', { name: '取消' });
52-
this.randomUrlButton = page.locator('#Url').locator('..').getByRole('link');
53-
54-
// Article type dropdown elements
55-
this.articleTypeDropdown = page.locator('#dropdown-tree-ArticleTypeID > .form-control');
5632
}
5733

5834
/**

test/End-To-End/src/admin/NavigationFormPage.ts

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,21 @@ export interface NavigationFormData {
1212

1313
export class NavigationFormPage extends AdminPageBase {
1414
// Form fields
15-
readonly titleInput: Locator;
16-
readonly urlInput: Locator;
17-
readonly isMobileCheckbox: Locator;
18-
readonly htmlTextarea: Locator;
19-
readonly statusSelect: Locator;
20-
readonly descriptionTextarea: Locator;
15+
readonly titleInput = this.page.locator('#Title');
16+
readonly urlInput = this.page.locator('#Url');
17+
readonly isMobileCheckbox = this.page.locator('#IsMobile');
18+
readonly htmlTextarea = this.page.locator('#Html');
19+
readonly statusSelect = this.page.locator('#Status');
20+
readonly descriptionTextarea = this.page.locator('#Description');
2121

2222
// Action buttons
23-
readonly saveButton: Locator;
24-
readonly saveAndExitButton: Locator;
25-
readonly convertToStaticPathButton: Locator;
26-
readonly cancelButton: Locator;
23+
readonly saveButton = this.page.locator('input[value="保存"]');
24+
readonly saveAndExitButton = this.page.locator('input[value="保存并退出"]');
25+
readonly convertToStaticPathButton = this.page.locator('input[value="转为伪静态路径"]');
26+
readonly cancelButton = this.page.locator('a:has-text("取消")');
2727

2828
constructor(page: Page) {
2929
super(page);
30-
// Form fields locators
31-
this.titleInput = page.locator('#Title');
32-
this.urlInput = page.locator('#Url');
33-
this.isMobileCheckbox = page.locator('#IsMobile');
34-
this.htmlTextarea = page.locator('#Html');
35-
this.statusSelect = page.locator('#Status');
36-
this.descriptionTextarea = page.locator('#Description');
37-
38-
// Action buttons locators
39-
this.saveButton = page.locator('input[value="保存"]');
40-
this.saveAndExitButton = page.locator('input[value="保存并退出"]');
41-
this.convertToStaticPathButton = page.locator('input[value="转为伪静态路径"]');
42-
this.cancelButton = page.locator('a:has-text("取消")');
4330
}
4431

4532
/**

test/End-To-End/src/admin/ProductFormPage.ts

Lines changed: 26 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,35 @@ import { Page, Locator, FrameLocator } from '@playwright/test';
22
import { AdminPageBase } from "@models/AdminPageBase";
33

44
export class ProductFormPage extends AdminPageBase {
5-
public readonly titleInput: Locator;
6-
public readonly englishNameInput: Locator;
7-
public readonly imageInput: Locator;
8-
public readonly thumbnailInput: Locator;
9-
public readonly productCategoryDropdownTree: Locator;
10-
public readonly modelInput: Locator;
11-
public readonly colorInput: Locator;
12-
public readonly priceInput: Locator;
13-
public readonly discountPriceInput: Locator;
14-
public readonly costPriceInput: Locator;
15-
public readonly specificationInput: Locator;
16-
public readonly warrantyInput: Locator;
17-
public readonly detailedContentFrame: Locator;
18-
public readonly seoTitleInput: Locator;
19-
public readonly seoKeywordsInput: Locator;
20-
public readonly seoDescriptionInput: Locator;
21-
public readonly sortInput: Locator;
22-
public readonly sourceInput: Locator;
23-
public readonly publishDateInput: Locator;
24-
public readonly descriptionInput: Locator;
25-
public readonly statusDropdown: Locator;
26-
public readonly saveButton: Locator;
27-
public readonly saveAndExitButton: Locator;
28-
public readonly publishButton: Locator;
29-
public readonly cancelButton: Locator;
30-
public readonly addImageButton: Locator;
5+
public readonly titleInput = this.page.locator('#Title');
6+
public readonly englishNameInput = this.page.locator('#Url');
7+
public readonly imageInput = this.page.locator('#ImageUrl');
8+
public readonly thumbnailInput = this.page.locator('#ImageThumbUrl');
9+
public readonly productCategoryDropdownTree = this.page.locator('#dropdown-tree-ProductCategoryID > .form-control');
10+
public readonly modelInput = this.page.locator('#PartNumber');
11+
public readonly colorInput = this.page.locator('#Color');
12+
public readonly priceInput = this.page.locator('#Price');
13+
public readonly discountPriceInput = this.page.locator('#RebatePrice');
14+
public readonly costPriceInput = this.page.locator('#PurchasePrice');
15+
public readonly specificationInput = this.page.locator('#Norm');
16+
public readonly warrantyInput = this.page.locator('#ShelfLife');
17+
public readonly detailedContentFrame = this.page.locator('#ProductContent_ifr');
18+
public readonly seoTitleInput = this.page.locator('#SEOTitle');
19+
public readonly seoKeywordsInput = this.page.locator('#SEOKeyWord');
20+
public readonly seoDescriptionInput = this.page.locator('#SEODescription');
21+
public readonly sortInput = this.page.locator('#OrderIndex');
22+
public readonly sourceInput = this.page.locator('#SourceFrom');
23+
public readonly publishDateInput = this.page.locator('#PublishDate');
24+
public readonly descriptionInput = this.page.locator('#Description');
25+
public readonly statusDropdown = this.page.locator('#Status');
26+
public readonly saveButton = this.page.locator('input[value="保存"]');
27+
public readonly saveAndExitButton = this.page.locator('input[value="保存并退出"]');
28+
public readonly publishButton = this.page.locator('input[value="发布"]');
29+
public readonly cancelButton = this.page.locator('a.btn-default');
30+
public readonly addImageButton = this.page.locator('.btn-xs.add');
3131

3232
constructor(page: Page) {
3333
super(page);
34-
this.titleInput = page.locator('#Title');
35-
this.englishNameInput = page.locator('#Url');
36-
this.imageInput = page.locator('#ImageUrl');
37-
this.thumbnailInput = page.locator('#ImageThumbUrl');
38-
this.productCategoryDropdownTree = page.locator('#dropdown-tree-ProductCategoryID > .form-control');
39-
this.modelInput = page.locator('#PartNumber');
40-
this.colorInput = page.locator('#Color');
41-
this.priceInput = page.locator('#Price');
42-
this.discountPriceInput = page.locator('#RebatePrice');
43-
this.costPriceInput = page.locator('#PurchasePrice');
44-
this.specificationInput = page.locator('#Norm');
45-
this.warrantyInput = page.locator('#ShelfLife');
46-
this.detailedContentFrame = page.locator('#ProductContent_ifr');
47-
this.seoTitleInput = page.locator('#SEOTitle');
48-
this.seoKeywordsInput = page.locator('#SEOKeyWord');
49-
this.seoDescriptionInput = page.locator('#SEODescription');
50-
this.sortInput = page.locator('#OrderIndex');
51-
this.sourceInput = page.locator('#SourceFrom');
52-
this.publishDateInput = page.locator('#PublishDate');
53-
this.descriptionInput = page.locator('#Description');
54-
this.statusDropdown = page.locator('#Status');
55-
this.saveButton = page.locator('input[value="保存"]');
56-
this.saveAndExitButton = page.locator('input[value="保存并退出"]');
57-
this.publishButton = page.locator('input[value="发布"]');
58-
this.cancelButton = page.locator('a.btn-default');
59-
this.addImageButton = page.locator('.btn-xs.add');
6034
}
6135

6236
async navigateTo(): Promise<void> {

0 commit comments

Comments
 (0)