Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WP Acceptance Fixes #2352

Merged
merged 5 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 14 additions & 27 deletions tests/wpa/BasicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,16 @@ public function testDashboardSyncComplete() {

$I->loginAs( 'wpsnapshots' );

$I->moveTo( 'wp-admin/admin.php?page=elasticpress' );
$this->moveTo( $I, 'wp-admin/admin.php?page=elasticpress' );

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

$I->waitUntilElementContainsText( 'Sync complete', '.sync-status' );

try {
$I->moveTo( 'wp-admin/admin.php?page=elasticpress-health' );
$this->moveTo( $I, 'wp-admin/admin.php?page=elasticpress-health' );

foreach ( $this->indexes as $index_name ) {
$I->seeText( $index_name );
}
} catch (\Throwable $th) {
// If failed for some other reason, it is a real failure.
if ( false === strpos( $th->getMessage(), 'Page crashed' ) ) {
throw $th;
}

$cli_result = $this->runCommand( 'wp elasticpress stats' )['stdout'];

foreach ( $this->indexes as $index_name ) {
$this->assertStringContainsString( $index_name, $cli_result );
}
foreach ( $this->indexes as $index_name ) {
$I->seeText( $index_name );
}
}

Expand All @@ -65,7 +52,7 @@ public function testSearch() {

$I->loginAs( 'wpsnapshots' );

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

$I->click( '#wp-admin-bar-debug-bar' );

Expand Down Expand Up @@ -99,24 +86,24 @@ public function testWeightingOnOff() {

sleep( 2 );

$I->moveTo( '/?s=Test+ElasticPress+1' );
$this->moveTo( $I, '/?s=Test+ElasticPress+1' );

$I->seeText( 'Test ElasticPress 1', '.hentry' );

$I->moveTo( 'wp-admin/admin.php?page=elasticpress-weighting' );
$this->moveTo( $I, 'wp-admin/admin.php?page=elasticpress-weighting' );

$I->click( '#post-post_title-enabled' );

$I->click( '#submit' );

$I->waitUntilElementContainsText( 'Changes Saved', '.notice-success' );

$I->moveTo( '/?s=Test+ElasticPress+1' );
$this->moveTo( $I, '/?s=Test+ElasticPress+1' );

$I->dontSeeText( 'Test ElasticPress 1', '.hentry' );

// Reset Changed Settings.
$I->moveTo( 'wp-admin/admin.php?page=elasticpress-weighting' );
$this->moveTo( $I, 'wp-admin/admin.php?page=elasticpress-weighting' );

$I->click( '#post-post_title-enabled' );

Expand Down Expand Up @@ -151,23 +138,23 @@ public function testTitleContentWeighting() {

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

$I->moveTo( '/?s=findme' );
$this->moveTo( $I, '/?s=findme' );

$posts = $I->getElements( '.post' );

$first_post = $posts[0];

$I->seeText( 'test weighting content', $first_post );

$I->moveTo( 'wp-admin/admin.php?page=elasticpress-weighting' );
$this->moveTo( $I, 'wp-admin/admin.php?page=elasticpress-weighting' );

$I->setElementProperty( 'input[name="weighting[post][post_title][weight]"]', 'value', 20 );

$I->click( '#submit' );

$I->waitUntilElementContainsText( 'Changes Saved', '.notice-success' );

$I->moveTo( '/?s=findme' );
$this->moveTo( $I, '/?s=findme' );

$posts = $I->getElements( '.post' );

Expand All @@ -176,7 +163,7 @@ public function testTitleContentWeighting() {
$I->seeText( 'test weighting title findme', $first_post );

// Reset Changed Settings.
$I->moveTo( 'wp-admin/admin.php?page=elasticpress-weighting' );
$this->moveTo( $I, 'wp-admin/admin.php?page=elasticpress-weighting' );

$I->setElementProperty( 'input[name="weighting[post][post_title][weight]"]', 'value', 1 );

Expand All @@ -193,7 +180,7 @@ public function testAutosuggestDropdownShows() {

$I = $this->openBrowserPage();

$I->moveTo( '/' );
$this->moveTo( $I, '/' );

$I->waitUntilElementVisible( '.search-toggle' );

Expand Down
30 changes: 15 additions & 15 deletions tests/wpa/DashboardSyncTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ public function testClickSyncButtonSinglesite() {

$this->runCommand( 'wp elasticpress delete-index --yes' );

$I->moveTo( 'wp-admin/admin.php?page=elasticpress-health' );
$this->moveTo( $I, 'wp-admin/admin.php?page=elasticpress-health' );

$I->seeText( 'We could not find any data for your Elasticsearch indices.' );

$I->moveTo( 'wp-admin/admin.php?page=elasticpress' );
$this->moveTo( $I, 'wp-admin/admin.php?page=elasticpress' );

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

$I->waitUntilElementContainsText( 'Sync complete', '.sync-status' );

$I->moveTo( 'wp-admin/admin.php?page=elasticpress-health' );
$this->moveTo( $I, 'wp-admin/admin.php?page=elasticpress-health' );

$I->dontSeeText( 'We could not find any data for your Elasticsearch indices.' );

Expand All @@ -59,21 +59,21 @@ public function testClickSyncButtonMultisite() {

$this->runCommand( 'wp elasticpress delete-index --network-wide --yes' );

$I->moveTo( 'wp-admin/network/sites.php' );
$this->moveTo( $I, 'wp-admin/network/sites.php' );

$I->checkOptions( '.index-toggle' );

$I->moveTo( 'wp-admin/network/admin.php?page=elasticpress-health' );
$this->moveTo( $I, 'wp-admin/network/admin.php?page=elasticpress-health' );

$I->seeText( 'We could not find any data for your Elasticsearch indices.' );

$I->moveTo( 'wp-admin/network/admin.php?page=elasticpress' );
$this->moveTo( $I, 'wp-admin/network/admin.php?page=elasticpress' );

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

$I->waitUntilElementContainsText( 'Sync complete', '.sync-status' );

$I->moveTo( 'wp-admin/network/admin.php?page=elasticpress-health' );
$this->moveTo( $I, 'wp-admin/network/admin.php?page=elasticpress-health' );

$I->dontSeeText( 'We could not find any data for your Elasticsearch indices.' );

Expand All @@ -95,29 +95,29 @@ public function testResumeSync() {

$this->runCommand( 'wp elasticpress delete-index --yes' );

$I->moveTo( 'wp-admin/admin.php?page=elasticpress-health' );
$this->moveTo( $I, 'wp-admin/admin.php?page=elasticpress-health' );

$I->seeText( 'We could not find any data for your Elasticsearch indices.' );

$I->moveTo( 'wp-admin/admin.php?page=elasticpress' );
$this->moveTo( $I, 'wp-admin/admin.php?page=elasticpress' );

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

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

sleep( 1 );

$I->moveTo( 'wp-admin/index.php' );
$this->moveTo( $I, 'wp-admin/index.php' );

$I->moveTo( 'wp-admin/admin.php?page=elasticpress' );
$this->moveTo( $I, 'wp-admin/admin.php?page=elasticpress' );

$I->seeText( 'Sync paused', '.sync-status' );

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

$I->waitUntilElementContainsText( 'Sync complete', '.sync-status' );

$I->moveTo( 'wp-admin/admin.php?page=elasticpress-health' );
$this->moveTo( $I, 'wp-admin/admin.php?page=elasticpress-health' );

$I->dontSeeText( 'We could not find any data for your Elasticsearch indices.' );

Expand All @@ -134,7 +134,7 @@ public function testPreventFeaturesActivationDuringSync() {

$I->loginAs( 'wpsnapshots' );

$I->moveTo( 'wp-admin/admin.php?page=elasticpress' );
$this->moveTo( $I, 'wp-admin/admin.php?page=elasticpress' );

$this->runCommand( 'wp elasticpress index --setup --yes' );

Expand Down Expand Up @@ -166,7 +166,7 @@ public function testWpCliSyncDuringDashboardSync() {
// Slowing the index process a bit.
$old_value = $this->setPerIndexCycle( 10, $I );

$I->moveTo( 'wp-admin/admin.php?page=elasticpress' );
$this->moveTo( $I, 'wp-admin/admin.php?page=elasticpress' );

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

Expand All @@ -184,7 +184,7 @@ public function testWpCliSyncDuringDashboardSync() {

$cli_result = $this->runCommand( 'wp elasticpress index' )['stdout'];

$this->assertStringContainsString( 'An index is already occuring', $cli_result );
$this->assertStringContainsString( 'An index is already occurring', $cli_result );

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

Expand Down
8 changes: 4 additions & 4 deletions tests/wpa/GeneralTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function testFirstTimeActivation() {

$this->activatePlugin();

$I->moveTo( '/wp-admin/plugins.php' );
$this->moveTo( $I, '/wp-admin/plugins.php' );

$I->seeText( 'ElasticPress is almost ready to go.' );

Expand All @@ -57,7 +57,7 @@ public function testFirstSetup() {

$this->activatePlugin();

$I->moveTo( '/wp-admin/admin.php?page=elasticpress' );
$this->moveTo( $I, '/wp-admin/admin.php?page=elasticpress' );

$I->seeText( 'Index Your Content', '.setup-button' );

Expand All @@ -78,7 +78,7 @@ public function testSyncUpdatedPostData() {

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

$I->moveTo( '/?s=Test+ElasticPress+1' );
$this->moveTo( $I, '/?s=Test+ElasticPress+1' );

$I->seeText( 'Test ElasticPress 1', '.hentry' );
}
Expand All @@ -103,7 +103,7 @@ public function testUnsupportedElasticsearchVersion() {

$this->activatePlugin();

$I->moveTo( '/wp-admin/plugins.php' );
$this->moveTo( $I, '/wp-admin/plugins.php' );

$I->seeText( 'ElasticPress may or may not work properly.' );

Expand Down
4 changes: 2 additions & 2 deletions tests/wpa/HighlightingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testHighlightingColor() {

$I->loginAs( 'wpsnapshots' );

$I->moveTo( '/wp-admin/admin.php?page=elasticpress' );
$this->moveTo( $I, '/wp-admin/admin.php?page=elasticpress' );

$I->executeJavaScript( 'document.querySelector( ".ep-feature-search .settings-button" ).click();' );

Expand All @@ -44,7 +44,7 @@ public function testHighlightingColor() {

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

$I->moveTo( '/?s=findme' );
$this->moveTo( $I, '/?s=findme' );

$I->seeElement( '.ep-highlight' );
}
Expand Down
14 changes: 7 additions & 7 deletions tests/wpa/WpCliTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ public function testIndexCommandWithNetworkWide() {

$this->activatePlugin( null, 'elasticpress', true );

$I->moveTo( 'wp-admin/network/sites.php' );
$this->moveTo( $I, 'wp-admin/network/sites.php' );

$I->checkOptions( '.index-toggle' );

$I->moveTo( 'wp-admin/network/admin.php?page=elasticpress-health' );
$this->moveTo( $I, 'wp-admin/network/admin.php?page=elasticpress-health' );

$cli_result = $this->runCommand( 'wp elasticpress index --network-wide' )['stdout'];

$this->assertStringContainsString( 'Indexing posts on site', $cli_result );

$this->assertStringContainsString( 'Number of posts indexed on site', $cli_result );

$I->moveTo( 'wp-admin/network/admin.php?page=elasticpress-health' );
$this->moveTo( $I, 'wp-admin/network/admin.php?page=elasticpress-health' );

$I->dontSeeText( 'We could not find any data for your Elasticsearch indices.' );

Expand Down Expand Up @@ -187,17 +187,17 @@ public function testDeleteIndexCommandWithNetworkWide() {

$this->activatePlugin( $I, 'elasticpress', true );

$I->moveTo( 'wp-admin/network/sites.php' );
$this->moveTo( $I, 'wp-admin/network/sites.php' );

$I->checkOptions( '.index-toggle' );

$I->moveTo( 'wp-admin/network/admin.php?page=elasticpress-health' );
$this->moveTo( $I, 'wp-admin/network/admin.php?page=elasticpress-health' );

$cli_result = $this->runCommand( 'wp elasticpress delete-index --network-wide --yes' )['stdout'];

$this->assertStringContainsString( 'Index deleted', $cli_result );

$I->moveTo( 'wp-admin/network/admin.php?page=elasticpress-health' );
$this->moveTo( $I, 'wp-admin/network/admin.php?page=elasticpress-health' );

$I->seeText( 'We could not find any data for your Elasticsearch indices.' );

Expand Down Expand Up @@ -229,7 +229,7 @@ public function testPutMappingCommandWithNetworkWide() {

$this->activatePlugin( $I, 'elasticpress', true );

$I->moveTo( 'wp-admin/network/sites.php' );
$this->moveTo( $I, 'wp-admin/network/sites.php' );

$I->checkOptions( '.index-toggle' );

Expand Down
8 changes: 4 additions & 4 deletions tests/wpa/features/AutosuggestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function testSeeAutosuggestDropdown() {

$I = $this->openBrowserPage();

$I->moveTo( '/' );
$this->moveTo( $I, '/' );

$I->waitUntilElementVisible( '.search-toggle' );

Expand All @@ -42,7 +42,7 @@ public function testSeeTypedPostTitleInDropdown() {

$I = $this->openBrowserPage();

$I->moveTo( '/' );
$this->moveTo( $I, '/' );

$I->waitUntilElementVisible( '.search-toggle' );

Expand Down Expand Up @@ -79,7 +79,7 @@ public function testSearchForPostByCategory() {

$I = $this->openBrowserPage();

$I->moveTo( '/' );
$this->moveTo( $I, '/' );

$I->waitUntilElementVisible( '.search-toggle' );

Expand All @@ -104,7 +104,7 @@ public function testClickSuggestionGoToPost() {

$I = $this->openBrowserPage();

$I->moveTo( '/' );
$this->moveTo( $I, '/' );

$I->waitUntilElementVisible( '.search-toggle' );

Expand Down
Loading