Skip to content

Commit 1e8d37a

Browse files
committed
Functional Tests : Enable feature flag "Tax rule groups"
1 parent 0cb565e commit 1e8d37a

7 files changed

Lines changed: 72 additions & 17 deletions

File tree

src/pages/BO/international/taxes/taxRules/create.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
import {type BOTaxRulesCreatePageInterface} from '@interfaces/BO/international/taxes/taxRules/create';
2+
import testContext from '@utils/test';
3+
import semver from 'semver';
4+
5+
const psVersion = testContext.getPSVersion();
26

37
/* eslint-disable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
48
function requirePage(): BOTaxRulesCreatePageInterface {
5-
return require('@versions/develop/pages/BO/international/taxes/taxRules/create');
9+
if (semver.lt(psVersion, '9.2.0')) {
10+
return require('@versions/9.1/pages/BO/international/taxes/taxRules/create').boTaxRulesCreatePage;
11+
}
12+
return require('@versions/develop/pages/BO/international/taxes/taxRules/create').boTaxRulesCreatePage;
613
}
714
/* eslint-enable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
815

src/pages/BO/international/taxes/taxRules/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
import {type BOTaxRulesPageInterface} from '@interfaces/BO/international/taxes/taxRules';
2+
import testContext from '@utils/test';
3+
import semver from 'semver';
4+
5+
const psVersion = testContext.getPSVersion();
26

37
/* eslint-disable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
48
function requirePage(): BOTaxRulesPageInterface {
5-
return require('@versions/develop/pages/BO/international/taxes/taxRules');
9+
if (semver.lt(psVersion, '9.2.0')) {
10+
return require('@versions/9.1/pages/BO/international/taxes/taxRules').boTaxRulesPage;
11+
}
12+
return require('@versions/develop/pages/BO/international/taxes/taxRules').boTaxRulesPage;
613
}
714
/* eslint-enable global-require, @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires */
815

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {type BOTaxRulesCreatePageInterface} from '@interfaces/BO/international/taxes/taxRules/create';
2+
import {BOTaxRulesCreatePage as BOTaxRulesCreatePageVersion} from '@versions/develop/pages/BO/international/taxes/taxRules/create';
3+
4+
class BOTaxRulesCreatePage extends BOTaxRulesCreatePageVersion implements BOTaxRulesCreatePageInterface {
5+
6+
constructor() {
7+
super();
8+
9+
this.pageTitleCreate = 'Tax Rules > Add new';
10+
this.pageTitleEdit = 'Tax Rules > Edit';
11+
}
12+
}
13+
14+
const boTaxRulesCreatePage = new BOTaxRulesCreatePage();
15+
export {boTaxRulesCreatePage, BOTaxRulesCreatePage}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import {type BOTaxRulesPageInterface} from '@interfaces/BO/international/taxes/taxRules';
2+
import {BOTaxRulesPage as BOTaxRulesPageVersion} from '@versions/develop/pages/BO/international/taxes/taxRules';
3+
4+
class BOTaxRulesPage extends BOTaxRulesPageVersion implements BOTaxRulesPageInterface {
5+
6+
constructor() {
7+
super();
8+
9+
// Selectors
10+
// HEADER buttons
11+
this.addNewTaxRulesGroupLink = 'a[data-role=page-header-desc-tax_rules_group-link]';
12+
13+
// Form selectors
14+
this.gridTable = '#table-tax_rules_group';
15+
16+
// Table rows and columns
17+
this.tableBody = `${this.gridTable} tbody`;
18+
this.tableRow = (row: number) => `${this.tableBody} tr:nth-child(${row})`;
19+
this.editRowLink = (row: number) => `${this.tableRow(row)} a.edit`;
20+
}
21+
}
22+
23+
const boTaxRulesPage = new BOTaxRulesPage();
24+
export {boTaxRulesPage, BOTaxRulesPage}

src/versions/develop/pages/BO/international/taxes/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ class BOTaxesPage extends BOBasePage implements BOTaxesPageInterface {
449449
* @param page {Page} Browser tab
450450
* @return {Promise<string>}
451451
*/
452-
getPaginationLabel(page: Page): Promise<string> {
452+
async getPaginationLabel(page: Page): Promise<string> {
453453
return this.getTextContent(page, this.paginationLabel);
454454
}
455455

src/versions/develop/pages/BO/international/taxes/taxRules/create.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import {type Page} from '@playwright/test';
1010
* @extends BOBasePage
1111
*/
1212
class BOTaxRulesCreatePage extends BOBasePage implements BOTaxRulesCreatePageInterface {
13-
public readonly pageTitleCreate: string;
13+
public pageTitleCreate: string;
1414

15-
public readonly pageTitleEdit: string;
15+
public pageTitleEdit: string;
1616

1717
private readonly addNewTaxRuleButton: string;
1818

@@ -43,8 +43,8 @@ class BOTaxRulesCreatePage extends BOBasePage implements BOTaxRulesCreatePageInt
4343
constructor() {
4444
super();
4545

46-
this.pageTitleCreate = 'Tax Rules > Add new';
47-
this.pageTitleEdit = 'Tax Rules > Edit';
46+
this.pageTitleCreate = `New tax rule • ${global.INSTALL.SHOP_NAME}`;
47+
this.pageTitleEdit = 'Editing tax rule ';
4848

4949
// Selectors
5050
// Header buttons
@@ -111,4 +111,5 @@ class BOTaxRulesCreatePage extends BOBasePage implements BOTaxRulesCreatePageInt
111111
}
112112
}
113113

114-
module.exports = new BOTaxRulesCreatePage();
114+
const boTaxRulesCreatePage = new BOTaxRulesCreatePage();
115+
export {boTaxRulesCreatePage, BOTaxRulesCreatePage}

src/versions/develop/pages/BO/international/taxes/taxRules/index.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ class BOTaxRulesPage extends BOBasePage implements BOTaxRulesPageInterface {
1212

1313
public readonly successfulUpdateStatusMessage: string;
1414

15-
private readonly addNewTaxRulesGroupLink: string;
15+
protected addNewTaxRulesGroupLink: string;
1616

1717
private readonly gridForm: string;
1818

1919
private readonly gridTableHeaderTitle: string;
2020

2121
private readonly gridTableNumberOfTitlesSpan: string;
2222

23-
private readonly gridTable: string;
23+
protected gridTable: string;
2424

2525
private readonly filterRow: string;
2626

@@ -30,11 +30,11 @@ class BOTaxRulesPage extends BOBasePage implements BOTaxRulesPageInterface {
3030

3131
private readonly filterResetButton: string;
3232

33-
private readonly tableBody: string;
33+
protected tableBody: string;
3434

35-
private readonly tableRow: (row: number) => string;
35+
protected tableRow: (row: number) => string;
3636

37-
private readonly editRowLink: (row: number) => string;
37+
protected editRowLink: (row: number) => string;
3838

3939
private readonly tableBodyColumn: (row: number) => string;
4040

@@ -96,13 +96,13 @@ class BOTaxRulesPage extends BOBasePage implements BOTaxRulesPageInterface {
9696

9797
// Selectors
9898
// HEADER buttons
99-
this.addNewTaxRulesGroupLink = 'a[data-role=page-header-desc-tax_rules_group-link]';
99+
this.addNewTaxRulesGroupLink = 'a#page-header-desc-configuration-add';
100100

101101
// Form selectors
102102
this.gridForm = '#form-tax_rules_group';
103103
this.gridTableHeaderTitle = `${this.gridForm} .panel-heading`;
104104
this.gridTableNumberOfTitlesSpan = `${this.gridTableHeaderTitle} span.badge`;
105-
this.gridTable = '#table-tax_rules_group';
105+
this.gridTable = '#tax_rules_group_grid_table';
106106

107107
// Filter selectors
108108
this.filterRow = `${this.gridTable} tr.filter`;
@@ -113,7 +113,7 @@ class BOTaxRulesPage extends BOBasePage implements BOTaxRulesPageInterface {
113113
// Table rows and columns
114114
this.tableBody = `${this.gridTable} tbody`;
115115
this.tableRow = (row: number) => `${this.tableBody} tr:nth-child(${row})`;
116-
this.editRowLink = (row: number) => `${this.tableRow(row)} a.edit`;
116+
this.editRowLink = (row: number) => `${this.tableRow(row)} a.grid-edit-row-link`;
117117
this.tableBodyColumn = (row: number) => `${this.tableRow(row)} td`;
118118

119119
// Columns selectors
@@ -459,4 +459,5 @@ class BOTaxRulesPage extends BOBasePage implements BOTaxRulesPageInterface {
459459
}
460460
}
461461

462-
module.exports = new BOTaxRulesPage();
462+
const boTaxRulesPage = new BOTaxRulesPage();
463+
export {boTaxRulesPage, BOTaxRulesPage}

0 commit comments

Comments
 (0)