Skip to content

Commit e41f96f

Browse files
author
Myron van Velsen
committed
Merge branch '264-create-user-account-na-het-toevoegen-search-filter-verwijderen' into 'main'
Resolve "Create user account: na het toevoegen search filter verwijderen" See merge request elgentos/magento2-playwright!56
2 parents 532583a + 60595b1 commit e41f96f

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

tests/config/element-identifiers.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
},
2121
"adminGeneral": {
2222
"tableSearchFieldLabel": "Search by keyword",
23+
"tableFilterResetLabel": "Clear All",
2324
"loadingSpinnerLocator": "#container .spinner",
2425
"searchButtonLabel": "Search"
2526
},

tests/config/outcome-markers.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"newAddressAddedNotifcation": "You saved the address."
1616
},
1717
"adminGeneral": {
18-
"searchResultsFoundText": "records found"
18+
"searchResultsFoundText": "records found",
19+
"activeFiltersText": "Active filters"
1920
},
2021
"cart": {
2122
"discountAppliedNotification": "You used coupon code",

tests/poms/adminhtml/customers.page.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class AdminCustomers {
1818
* @when the admin navigates to Customers > All Customers
1919
* @and the customer table is fully loaded
2020
* @and the admin searches for a specific email address
21+
* @then reset the table filter
2122
* @then the system returns whether a customer with that email exists in the customer list
2223
*/
2324
async checkIfCustomerExists(email: string){
@@ -43,18 +44,34 @@ class AdminCustomers {
4344
await customersSearchField.fill(email);
4445
await this.page.getByRole('button', {name: UIReference.general.searchButtonLabel}).click();
4546

46-
47+
// Wait for the loader spinner to be hidden
4748
if (await this.page.locator(UIReference.general.loadingSpinnerLocator).isVisible()) {
4849
await this.page.locator(UIReference.general.loadingSpinnerLocator).waitFor({state: 'hidden'});
4950
}
5051

5152
// Loop to ensure the 'results found' text is visible
52-
await expect(async() =>{
53-
await this.page.getByText(outcomeMarker.customerOverviewPage.searchResultsFoundText).first();
54-
}).toPass();
53+
await expect(
54+
this.page.getByText(outcomeMarker.adminGeneral.activeFiltersText).first(),
55+
"There are active filters."
56+
).toBeVisible();
5557

5658
// Return true (email found) or false (email not found)
57-
return await this.page.getByRole('cell', {name:email}).locator('div').isVisible();
59+
const emailIsFound = await this.page.getByRole('cell', {name:email}).locator('div').isVisible();
60+
61+
// Click 'Clear all' button on filtered table to reset the table state.
62+
await this.page.getByRole('button', {name: UIReference.adminGeneral.tableFilterResetLabel}).click();
63+
64+
// Wait for the loader spinner to be hidden
65+
if (await this.page.locator(UIReference.general.loadingSpinnerLocator).isVisible()) {
66+
await this.page.locator(UIReference.general.loadingSpinnerLocator).waitFor({state: 'hidden'});
67+
}
68+
69+
await expect(
70+
this.page.getByText(outcomeMarker.adminGeneral.activeFiltersText).first(),
71+
"There are no filters active."
72+
).toBeHidden();
73+
74+
return emailIsFound;
5875
}
5976

6077
/**

0 commit comments

Comments
 (0)