@@ -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