Skip to content

Commit

Permalink
Small improvements in the WPA tests
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeelia committed Mar 4, 2021
1 parent 85be03c commit 59010bc
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 20 deletions.
22 changes: 14 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,36 @@ on:
- develop

jobs:
wpa:
wpa_local:
name: WP Acceptance - Local
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.2'
coverage: none
tools: composer:v1

- name: Install dependencies
run: composer install

- name: Test Local
run: ./run-wpacceptance.sh -l --attempts=3

wpa_epio:
name: WP Acceptance - ElasticPress.io
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install dependencies
run: composer install

- name: Test EP.io
run: ./run-wpacceptance.sh --ep-host=${{ secrets.EPIO_HOST }} --es-shield='${{ secrets.EPIO_SHIELD }}' --ep-index-prefix=${{ secrets.EPIO_INDEX_PREFIX }} --attempts=3

phpunit:
name: PHP Unit
runs-on: ubuntu-latest

steps:
Expand Down
9 changes: 0 additions & 9 deletions tests/wpa/BasicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,6 @@ public function testSearch() {

$I->loginAs( 'wpsnapshots' );

/**
* While using autosuggest and EP.io, there is a chance we cache a request while
* the index didn't exist yet. Although it doesn't affect any plugin functionality
* it will interfere with this test.
*/
if ( $this->isElasticPressIo( $I ) ) {
$this->runCommand( 'wp transient delete ep_autosuggest_query_request_cache' );
}

$I->moveTo( '/?s=test' );

$I->click( '#wp-admin-bar-debug-bar' );
Expand Down
6 changes: 3 additions & 3 deletions tests/wpa/DashboardSyncTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ public function testWpCliSyncDuringDashboardSync() {

$I->waitUntilElementVisible( '.pause-sync' );

// Specially when requesting an external server, e.g. EP.io, we
// have to wait a bit for the AJAX requests.
sleep( 5 );
sleep( 1 );

$I->executeJavaScript( 'document.querySelector( ".pause-sync" ).click();' );

$I->waitUntilElementVisible( '.resume-sync' );

// Specially when requesting an external server, e.g. EP.io, we
// have to wait a bit for the AJAX requests.
sleep( 5 );

$cli_result = $this->runCommand( 'wp elasticpress index' )['stdout'];
Expand Down
3 changes: 3 additions & 0 deletions tests/wpa/features/ProtectedContentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public function testProtectedContentPostsDraftsList() {

$this->publishPost( $data, $I );

// Give some time to the async request that indexes the post.
sleep( 5 );

$I->moveTo( 'wp-admin/edit.php?post_status=draft&post_type=post' );

$I->click( '#wp-admin-bar-debug-bar' );
Expand Down
2 changes: 2 additions & 0 deletions tests/wpa/test-mu-plugins/unique-index-name.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@
function get_docker_cid() {
return exec( 'cat /etc/hostname' );
}

add_filter( 'ep_es_info_cache_expiration', '__return_zero' );

0 comments on commit 59010bc

Please sign in to comment.