diff --git a/tests/e2e/Services/Account/AccountCustomClientTest.php b/tests/e2e/Services/Account/AccountCustomClientTest.php index daa5bcbff8..88ee1df26b 100644 --- a/tests/e2e/Services/Account/AccountCustomClientTest.php +++ b/tests/e2e/Services/Account/AccountCustomClientTest.php @@ -1862,10 +1862,11 @@ class AccountCustomClientTest extends Scope 'failure' => 'http://localhost/v1/mock/tests/general/oauth2/failure', ]); - $session = $response['cookies']['a_session_' . $this->getProject()['$id']]; - $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals('success', $response['body']['result']); + $this->assertArrayHasKey('a_session_' . $this->getProject()['$id'], $response['cookies']); + + $session = $response['cookies']['a_session_' . $this->getProject()['$id']]; $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ 'origin' => 'http://localhost', diff --git a/tests/e2e/Services/Storage/StorageCustomServerTest.php b/tests/e2e/Services/Storage/StorageCustomServerTest.php index 1dafd8ca06..b1857acad3 100644 --- a/tests/e2e/Services/Storage/StorageCustomServerTest.php +++ b/tests/e2e/Services/Storage/StorageCustomServerTest.php @@ -2,6 +2,7 @@ namespace Tests\E2E\Services\Storage; +use Appwrite\Tests\Async; use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; @@ -16,6 +17,7 @@ class StorageCustomServerTest extends Scope use StorageBase; use ProjectCustom; use SideServer; + use Async; public function testCreateBucket(): array { @@ -286,18 +288,21 @@ class StorageCustomServerTest extends Scope $this->assertEquals(204, $response['headers']['status-code']); $this->assertEmpty($response['body']); - $response = $this->client->call( - Client::METHOD_GET, - '/storage/buckets/' . $id, - array_merge( - [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], - $this->getHeaders() - ) - ); - $this->assertEquals(404, $response['headers']['status-code']); + $this->assertEventually(function () use ($id) { + $response = $this->client->call( + Client::METHOD_GET, + '/storage/buckets/' . $id, + array_merge( + [ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], + $this->getHeaders() + ) + ); + + $this->assertEquals(404, $response['headers']['status-code']); + }); return $data; } diff --git a/tests/e2e/Services/Teams/TeamsBase.php b/tests/e2e/Services/Teams/TeamsBase.php index 2328e4cdbf..52190b23a5 100644 --- a/tests/e2e/Services/Teams/TeamsBase.php +++ b/tests/e2e/Services/Teams/TeamsBase.php @@ -2,6 +2,7 @@ namespace Tests\E2E\Services\Teams; +use Appwrite\Tests\Async; use Tests\E2E\Client; use Utopia\Database\Document; use Utopia\Database\Helpers\ID; @@ -10,6 +11,8 @@ use Utopia\Database\Validator\Datetime as DatetimeValidator; trait TeamsBase { + use Async; + public function testCreateTeam(): array { /** @@ -379,12 +382,15 @@ trait TeamsBase /** * Test for FAILURE */ - $response = $this->client->call(Client::METHOD_GET, '/teams/' . $teamUid, array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); + $this->assertEventually(function () use ($teamUid) { + $response = $this->client->call(Client::METHOD_GET, '/teams/' . $teamUid, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals(404, $response['headers']['status-code']); + }); - $this->assertEquals(404, $response['headers']['status-code']); return []; }