diff --git a/bin/install-test-env.sh b/bin/install-test-env.sh index f6bfcf35..8acd711f 100644 --- a/bin/install-test-env.sh +++ b/bin/install-test-env.sh @@ -89,7 +89,7 @@ configure_wordpress() { SITE_TITLE=${WORDPRESS_SITE_TITLE:-"Headless Login Tests"} - wp core install --title="$SITE_TITLE" --admin_user="$WORDPRESS_ADMIN_USER" --admin_password="$WORDPRESS_ADMIN_PASSWORD" --admin_email="$WORDPRESS_ADMIN_EMAIL" --skip-email --url="$WORDRESS_URL" --allow-root + wp core install --title="$SITE_TITLE" --admin_user="$WORDPRESS_ADMIN_USER" --admin_password="$WORDPRESS_ADMIN_PASSWORD" --admin_email="$WORDPRESS_ADMIN_EMAIL" --skip-email --url="$WORDPRESS_URL" --allow-root echo -e "$(status_message "Running WordPress version: $(wp core version --allow-root) at $(wp option get home --allow-root)")" } diff --git a/tests/acceptance/PluginActivatedCest.php b/tests/acceptance/PluginActivatedCest.php deleted file mode 100644 index 5e75cd22..00000000 --- a/tests/acceptance/PluginActivatedCest.php +++ /dev/null @@ -1,9 +0,0 @@ -loginAsAdmin(); - $I->amOnPluginsPage(); - $I->seePluginActivated( 'headless-login-for-wpgraphql' ); - } -} diff --git a/tests/acceptance/PluginSettingsTabCest.php b/tests/acceptance/PluginSettingsTabCest.php deleted file mode 100644 index 43fbc711..00000000 --- a/tests/acceptance/PluginSettingsTabCest.php +++ /dev/null @@ -1,10 +0,0 @@ -loginAsAdmin(); - $I->amOnPluginsPage(); - $I->amOnPage( '/wp-admin/admin.php?page=graphql-settings' ); - $I->see( 'Headless Login' ); - } -} diff --git a/tests/functional/AuthenticatedQueryCest.php b/tests/functional/AuthenticatedQueryCest.php index e683fdc1..9f7bad88 100644 --- a/tests/functional/AuthenticatedQueryCest.php +++ b/tests/functional/AuthenticatedQueryCest.php @@ -147,7 +147,7 @@ public function testQueryWithHeaders( FunctionalTester $I ) { 'shouldBlockUnauthorizedDomains' => true, 'hasSiteAddressInOrigin' => true, 'additionalAuthorizedDomains' => [ - 'example.com', + 'https://example.com', ], 'customHeaders' => [ 'X-Custom-Header', @@ -189,15 +189,16 @@ public function testQueryWithHeaders( FunctionalTester $I ) { $I->seeResponseCodeIs( 403 ); - $I->haveHttpHeader( 'Origin', 'https://example.com' ); - $I->reset_utils_properties(); + $I->haveHttpHeader( 'Origin', 'https://example.com' ); + $response = $I->sendGraphQLRequest( $query, null, [ 'Authorization' => 'Bearer ' . $expected_tokens['auth_token'], + 'Origin' => 'https://example.com', ] ); diff --git a/tests/functional/PluginActivationCest.php b/tests/functional/PluginActivationCest.php new file mode 100644 index 00000000..081fe0dd --- /dev/null +++ b/tests/functional/PluginActivationCest.php @@ -0,0 +1,16 @@ +loginAsAdmin(); + $I->amOnPluginsPage(); + $I->seePluginActivated( 'headless-login-for-wpgraphql' ); + } + + public function seeSettingsTab( FunctionalTester $I ) { + $I->loginAsAdmin(); + $I->amOnPluginsPage(); + $I->amOnPage( '/wp-admin/admin.php?page=graphql-settings' ); + $I->see( 'Headless Login', '#wpgraphql_login_settings-tab' ); + } +} diff --git a/tests/functional/SiteTokenAuthenticationCest.php b/tests/functional/SiteTokenAuthenticationCest.php index bcd9a1a3..f3ea6c52 100644 --- a/tests/functional/SiteTokenAuthenticationCest.php +++ b/tests/functional/SiteTokenAuthenticationCest.php @@ -89,8 +89,6 @@ public function testLoginWithSiteToken( FunctionalTester $I ) { ); $I->reset_utils_properties(); - $I->haveHttpHeader( 'Origin', 'https://example.com' ); - $response = $I->sendGraphQLRequest( $query, $variables,