Skip to content

Commit

Permalink
ci: fix env creation and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
justlevine committed Oct 20, 2024
1 parent d6e3c19 commit 042eb60
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 25 deletions.
2 changes: 1 addition & 1 deletion bin/install-test-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)")"
}
Expand Down
9 changes: 0 additions & 9 deletions tests/acceptance/PluginActivatedCest.php

This file was deleted.

10 changes: 0 additions & 10 deletions tests/acceptance/PluginSettingsTabCest.php

This file was deleted.

7 changes: 4 additions & 3 deletions tests/functional/AuthenticatedQueryCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function testQueryWithHeaders( FunctionalTester $I ) {
'shouldBlockUnauthorizedDomains' => true,
'hasSiteAddressInOrigin' => true,
'additionalAuthorizedDomains' => [
'example.com',
'https://example.com',
],
'customHeaders' => [
'X-Custom-Header',
Expand Down Expand Up @@ -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',
]
);

Expand Down
16 changes: 16 additions & 0 deletions tests/functional/PluginActivationCest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

class PluginActivationCest {
public function seePluginActivated( FunctionalTester $I ) {
$I->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' );
}
}
2 changes: 0 additions & 2 deletions tests/functional/SiteTokenAuthenticationCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ public function testLoginWithSiteToken( FunctionalTester $I ) {
);
$I->reset_utils_properties();

$I->haveHttpHeader( 'Origin', 'https://example.com' );

$response = $I->sendGraphQLRequest(
$query,
$variables,
Expand Down

0 comments on commit 042eb60

Please sign in to comment.