From 26060e32917a569733839a5d2d4d3f7788097eed Mon Sep 17 00:00:00 2001 From: eug-L Date: Tue, 21 Jan 2025 14:13:22 +0800 Subject: [PATCH 1/4] update to handle oauth login --- tests/TestFiles/Modules/Web.php | 45 ++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/tests/TestFiles/Modules/Web.php b/tests/TestFiles/Modules/Web.php index d4a049f..9f6bb8a 100644 --- a/tests/TestFiles/Modules/Web.php +++ b/tests/TestFiles/Modules/Web.php @@ -184,13 +184,46 @@ public function goto_widget_selection() { // driver currently on tawk-iframe frame // incase the current session hasn't logged in to the plugin yet. - $login_form_id = '#loginForm'; - $login_form = $this->driver->find_and_check_element( $login_form_id ); - if ( false === is_null( $login_form ) ) { - $this->driver->find_element_and_input( '#email', $this->tawk->username ); - $this->driver->find_element_and_input( '#password', $this->tawk->password ); - $this->driver->find_element_and_click( '#login-button' ); + $login_button_id = '#login-button'; + $login_button = $this->driver->find_and_check_element( $login_button_id ); + if ( true === is_null( $login_button ) ) { + return; + } + + $this->driver->find_element_and_click( '#login-button' ); + + $window_handles = $this->driver->get_driver()->getWindowHandles(); + $this->driver->get_driver()->switchTo()->window( end( $window_handles ) ); + + // driver currently on tawk.to OAuth login popout. + + // handle currently logged in page. + $allow_id = '#allow'; + $allow_button = $this->driver->find_and_check_element( $allow_id ); + if ( false === is_null( $allow_button ) ) { + $allow_button->click(); + $this->driver->get_driver()->switchTo()->window( reset( $window_handles ) ); + $this->driver->wait_for_frame_and_switch( '#tawk-iframe', 10 ); + return; } + + // handle login page. + $this->driver->find_element_and_input( '#email', $this->tawk->username ); + $this->driver->find_element_and_input( '#password', $this->tawk->password ); + $this->driver->find_element_and_click( 'button[type="submit"]' ); + + // handle consent page. + $this->driver->wait_for_seconds( 3 ); + $allow_id = '#allow'; + $allow_button = $this->driver->find_and_check_element( $allow_id ); + + if ( false === is_null( $allow_button ) ) { + $allow_button->click(); + } + + // go back to tawk-iframe frame. + $this->driver->get_driver()->switchTo()->window( reset( $window_handles ) ); + $this->driver->wait_for_frame_and_switch( '#tawk-iframe', 10 ); } public function goto_visibility_options() { From 62ca7d8c2c36bc2d2ca9a348d8a3ecd3d3b530c4 Mon Sep 17 00:00:00 2001 From: eug-L Date: Tue, 21 Jan 2025 14:14:07 +0800 Subject: [PATCH 2/4] fix woocommerce store visibility --- tests/docker/build/files/build-wordpress.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/docker/build/files/build-wordpress.sh b/tests/docker/build/files/build-wordpress.sh index bf3ee24..18d5a12 100755 --- a/tests/docker/build/files/build-wordpress.sh +++ b/tests/docker/build/files/build-wordpress.sh @@ -72,4 +72,5 @@ wp option set woocommerce_store_postalcode 'A1B2C3' && \ wp option set woocommerce_currency 'CAD' && \ wp option set woocommerce_product_type 'physical' && \ wp option set woocommerce_allow_tracking 'no' && \ +wp option set woocommerce_coming_soon 'no' && \ wp wc --user=admin tool run install_pages; From fe1e1a70835688fbb6ff1ed5269d953faa39265c Mon Sep 17 00:00:00 2001 From: eug-L Date: Fri, 11 Apr 2025 17:05:09 +0300 Subject: [PATCH 3/4] fix test driver failing to switch back to main window --- tests/TestFiles/Modules/Web.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/TestFiles/Modules/Web.php b/tests/TestFiles/Modules/Web.php index 9f6bb8a..c7c2332 100644 --- a/tests/TestFiles/Modules/Web.php +++ b/tests/TestFiles/Modules/Web.php @@ -213,7 +213,6 @@ public function goto_widget_selection() { $this->driver->find_element_and_click( 'button[type="submit"]' ); // handle consent page. - $this->driver->wait_for_seconds( 3 ); $allow_id = '#allow'; $allow_button = $this->driver->find_and_check_element( $allow_id ); From d103ca3bc3f9c2b9aa093639457a6796db2f7ce6 Mon Sep 17 00:00:00 2001 From: eug-L Date: Fri, 11 Apr 2025 17:18:55 +0300 Subject: [PATCH 4/4] Update GitHub Actions cache action from v2 to v3 for UI tests workflow --- .github/workflows/ui-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index 15ac356..21f931a 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -19,7 +19,7 @@ jobs: ref: ${{ github.event.workflow_run.head_sha }} - name: cached dependencies - uses: actions/cache@v2 + uses: actions/cache@v3 id: cached-dependencies with: path: |