diff --git a/tests/e2e/Services/GraphQL/FunctionsClientTest.php b/tests/e2e/Services/GraphQL/FunctionsClientTest.php index 72ff73fb7b..bb077f47fe 100644 --- a/tests/e2e/Services/GraphQL/FunctionsClientTest.php +++ b/tests/e2e/Services/GraphQL/FunctionsClientTest.php @@ -107,9 +107,43 @@ class FunctionsClientTest extends Scope $this->assertIsArray($deployment['body']['data']); $this->assertArrayNotHasKey('errors', $deployment['body']); - sleep(15); + // Poll get deployment until an error, or status is either 'ready' or 'failed' + $deployment = $deployment['body']['data']['functionsCreateDeployment']; + $deploymentId = $deployment['_id']; - return $deployment['body']['data']['functionsCreateDeployment']; + $query = $this->getQuery(self::$GET_DEPLOYMENT); + $gqlPayload = [ + 'query' => $query, + 'variables' => [ + 'functionId' => $function['_id'], + 'deploymentId' => $deploymentId, + ] + ]; + + while (true) { + $deployment = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), $gqlPayload); + + $this->assertIsArray($deployment['body']['data']); + $this->assertArrayNotHasKey('errors', $deployment['body']); + + $deployment = $deployment['body']['data']['functionsGetDeployment']; + + if ( + $deployment['status'] === 'ready' + || $deployment['status'] === 'failed' + ) { + break; + } + + \sleep(1); + } + + $this->assertEquals('ready', $deployment['status']); + + return $deployment; } /** diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index dea7b21dd9..ff3f8e8e94 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -593,7 +593,7 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals('Account Verification', $response['body']['subject']); - $this->assertEquals('team@appwrite.io', $response['body']['senderEmail']); + $this->assertEquals('', $response['body']['senderEmail']); $this->assertEquals('verification', $response['body']['type']); $this->assertEquals('en-us', $response['body']['locale']); diff --git a/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php b/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php index 4b44a7a38e..9c91ac4a52 100644 --- a/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php +++ b/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php @@ -451,7 +451,6 @@ class RealtimeConsoleClientTest extends Scope $this->assertEquals(201, $response1['headers']['status-code']); - $projectId = 'console'; $client = $this->getWebsocket(['console'], [ diff --git a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php index 5f3d478031..01aa00cd84 100644 --- a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php +++ b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php @@ -416,18 +416,10 @@ class WebhooksCustomServerTest extends Scope $this->assertEquals($webhook['method'], 'POST'); $this->assertEquals($webhook['headers']['Content-Type'], 'application/json'); $this->assertEquals($webhook['headers']['User-Agent'], 'Appwrite-Server vdev. Please report abuse at security@appwrite.io'); - // $this->assertStringContainsString('functions.*', $webhook['headers']['X-Appwrite-Webhook-Events']); - // $this->assertStringContainsString('functions.*.create', $webhook['headers']['X-Appwrite-Webhook-Events']); - // $this->assertStringContainsString("functions.{$id}", $webhook['headers']['X-Appwrite-Webhook-Events']); - // $this->assertStringContainsString("functions.{$id}.create", $webhook['headers']['X-Appwrite-Webhook-Events']); TODO @christyjacob4 : enable test once we allow functions.* events $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Signature'], $signatureExpected); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Id'] ?? '', $this->getProject()['webhookId']); $this->assertEquals($webhook['headers']['X-Appwrite-Webhook-Project-Id'] ?? '', $this->getProject()['$id']); - /** - * Test for FAILURE - */ - return [ 'functionId' => $id, ];