diff --git a/tests/e2e/Scopes/SchemaPolling.php b/tests/e2e/Scopes/SchemaPolling.php index 99aeb07773..4a8a79c070 100644 --- a/tests/e2e/Scopes/SchemaPolling.php +++ b/tests/e2e/Scopes/SchemaPolling.php @@ -19,7 +19,7 @@ trait SchemaPolling * @param int $timeoutMs Maximum time to wait in milliseconds * @param int $waitMs Time between polling attempts in milliseconds */ - protected function waitForAttribute(string $databaseId, string $containerId, string $attributeKey, int $timeoutMs = 600000, int $waitMs = 500): void + protected function waitForAttribute(string $databaseId, string $containerId, string $attributeKey, int $timeoutMs = 60000, int $waitMs = 500): void { $this->assertEventually(function () use ($databaseId, $containerId, $attributeKey) { $attribute = $this->client->call( @@ -46,7 +46,7 @@ trait SchemaPolling * @param int $timeoutMs Maximum time to wait in milliseconds * @param int $waitMs Time between polling attempts in milliseconds */ - protected function waitForAttributes(string $databaseId, string $containerId, array $attributeKeys, int $timeoutMs = 600000, int $waitMs = 500): void + protected function waitForAttributes(string $databaseId, string $containerId, array $attributeKeys, int $timeoutMs = 60000, int $waitMs = 500): void { $this->assertEventually(function () use ($databaseId, $containerId, $attributeKeys) { $container = $this->client->call( @@ -87,7 +87,7 @@ trait SchemaPolling * @param int $timeoutMs Maximum time to wait in milliseconds * @param int $waitMs Time between polling attempts in milliseconds */ - protected function waitForAttributeCount(string $databaseId, string $containerId, int $count, int $timeoutMs = 600000, int $waitMs = 500): void + protected function waitForAttributeCount(string $databaseId, string $containerId, int $count, int $timeoutMs = 60000, int $waitMs = 500): void { $this->assertEventually(function () use ($databaseId, $containerId, $count) { $container = $this->client->call( @@ -126,7 +126,7 @@ trait SchemaPolling * @param int $timeoutMs Maximum time to wait in milliseconds * @param int $waitMs Time between polling attempts in milliseconds */ - protected function waitForIndex(string $databaseId, string $containerId, string $indexKey, int $timeoutMs = 600000, int $waitMs = 500): void + protected function waitForIndex(string $databaseId, string $containerId, string $indexKey, int $timeoutMs = 60000, int $waitMs = 500): void { $this->assertEventually(function () use ($databaseId, $containerId, $indexKey) { $index = $this->client->call( @@ -154,7 +154,7 @@ trait SchemaPolling * @param int $timeoutMs Maximum time to wait in milliseconds * @param int $waitMs Time between polling attempts in milliseconds */ - protected function waitForAllIndexes(string $databaseId, string $containerId, int $timeoutMs = 600000, int $waitMs = 500): void + protected function waitForAllIndexes(string $databaseId, string $containerId, int $timeoutMs = 60000, int $waitMs = 500): void { $this->assertEventually(function () use ($databaseId, $containerId) { $container = $this->client->call( @@ -185,7 +185,7 @@ trait SchemaPolling * @param int $timeoutMs Maximum time to wait in milliseconds (default 10 minutes for CI stability under parallel load) * @param int $waitMs Time between polling attempts in milliseconds */ - protected function waitForAllAttributes(string $databaseId, string $containerId, int $timeoutMs = 600000, int $waitMs = 500): void + protected function waitForAllAttributes(string $databaseId, string $containerId, int $timeoutMs = 60000, int $waitMs = 500): void { $this->assertEventually(function () use ($databaseId, $containerId) { $container = $this->client->call( diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index 0dd592ba21..6c42a41859 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -1966,6 +1966,13 @@ trait DatabasesBase ]), ['key' => 'integers', 'required' => false, 'array' => true, 'min' => 10, 'max' => 99]); $this->assertEquals(202, $integers['headers']['status-code']); + $integers2 = $this->client->call(Client::METHOD_POST, $this->getSchemaUrl($databaseId, $collectionId) . '/integer', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), ['key' => 'integers2', 'required' => false, 'array' => true, 'min' => 10, 'max' => 99]); + $this->assertEquals(202, $integers2['headers']['status-code']); + // Wait for attributes to be ready $this->waitForAllAttributes($databaseId, $collectionId); @@ -2494,7 +2501,7 @@ trait DatabasesBase /** * Resubmit same document, nothing to update */ - $this->assertIsString($document1['body']['$sequence']); + $this->assertIsString($document['body']['$sequence']); $upsertData = [ 'title' => 'Thor: Ragnarok', 'releaseYear' => 2000, @@ -3156,7 +3163,7 @@ trait DatabasesBase $this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals($document['title'], $response['body']['title']); $this->assertEquals($document['releaseYear'], $response['body']['releaseYear']); - $this->assertArrayNotHasKey('birthDay', $response['body']); + $this->assertArrayHasKey('birthDay', $response['body']); $this->assertArrayHasKey('$sequence', $response['body']); // Query by sequence on get single document route @@ -5955,7 +5962,7 @@ trait DatabasesBase return; } - $data = $this->setupOneToOneRelationship(); + $data = $this->setupOneToManyRelationship(); $databaseId = $data['databaseId']; $personCollection = $data['personCollection']; $libraryCollection = $data['libraryCollection']; @@ -6642,11 +6649,9 @@ trait DatabasesBase return; } + $data = $this->setupDatabase(); $databaseId = $data['databaseId']; - $this->assertEquals(201, $database['headers']['status-code']); - $databaseId = $database['body']['$id']; - $collection1 = $this->client->call(Client::METHOD_POST, $this->getContainerUrl($databaseId), array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -6698,6 +6703,9 @@ trait DatabasesBase 'required' => true, ]); + $this->waitForAttribute($databaseId, $collection1, 'name'); + $this->waitForAttribute($databaseId, $collection2, 'name'); + $this->client->call(Client::METHOD_POST, $this->getSchemaUrl($databaseId, $collection1) . '/relationship', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], diff --git a/tests/e2e/Services/Realtime/RealtimeBase.php b/tests/e2e/Services/Realtime/RealtimeBase.php index c6286d3a50..9dab49951e 100644 --- a/tests/e2e/Services/Realtime/RealtimeBase.php +++ b/tests/e2e/Services/Realtime/RealtimeBase.php @@ -10,7 +10,7 @@ trait RealtimeBase private function getWebsocket( array $channels = [], array $headers = [], - string $projectId = null, + ?string $projectId = null, ?array $queries = null ): WebSocketClient { if (is_null($projectId)) { @@ -63,7 +63,7 @@ trait RealtimeBase "ws://appwrite.test/v1/realtime?" . $queryString, [ "headers" => $headers, - "timeout" => 120, + "timeout" => 30, ] ); } diff --git a/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php b/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php index 4f9b55676b..e0f9216b65 100644 --- a/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php +++ b/tests/e2e/Services/Realtime/RealtimeConsoleClientTest.php @@ -68,7 +68,7 @@ class RealtimeConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(200, $attribute['headers']['status-code']); $this->assertEquals('available', $attribute['body']['status']); - }, 120000, 500); + }, 30000, 500); return ['actorsId' => $actorsId, 'databaseId' => $databaseId]; } @@ -120,7 +120,7 @@ class RealtimeConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(200, $column['headers']['status-code']); $this->assertEquals('available', $column['body']['status']); - }, 120000, 500); + }, 30000, 500); return ['actorsId' => $actorsId, 'databaseId' => $databaseId]; } @@ -151,7 +151,7 @@ class RealtimeConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(200, $index['headers']['status-code'], 'Index polling returned ' . $index['headers']['status-code'] . ': ' . json_encode($index['body'] ?? '')); $this->assertEquals('available', $index['body']['status']); - }, 120000, 500); + }, 30000, 500); return $data; } @@ -182,7 +182,7 @@ class RealtimeConsoleClientTest extends Scope ], $this->getHeaders())); $this->assertEquals(200, $index['headers']['status-code'], 'Index polling returned ' . $index['headers']['status-code'] . ': ' . json_encode($index['body'] ?? '')); $this->assertEquals('available', $index['body']['status']); - }, 120000, 500); + }, 30000, 500); return $data; } diff --git a/tests/e2e/Services/Sites/SitesBase.php b/tests/e2e/Services/Sites/SitesBase.php index 5fc0d40fec..ae2c9c18f0 100644 --- a/tests/e2e/Services/Sites/SitesBase.php +++ b/tests/e2e/Services/Sites/SitesBase.php @@ -65,7 +65,7 @@ trait SitesBase } $this->assertEquals('ready', $deployment['body']['status'], 'Deployment status is not ready, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - }, 300000, 500); + }, 120000, 500); // Not === so multipart/form-data works fine too if (($params['activate'] ?? false) == true) { @@ -76,7 +76,7 @@ trait SitesBase 'x-appwrite-key' => $this->getProject()['apiKey'], ])); $this->assertEquals($deploymentId, $site['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($site['body'], JSON_PRETTY_PRINT)); - }, 200000, 500); + }, 60000, 500); } return $deploymentId; @@ -281,12 +281,12 @@ trait SitesBase $this->assertEventually(function () use ($siteId, $deploymentId) { $deployment = $this->getDeployment($siteId, $deploymentId); $this->assertEquals('ready', $deployment['body']['status'], 'Deployment status is not ready, deployment: ' . json_encode($deployment['body'], JSON_PRETTY_PRINT)); - }, 150000, 500); + }, 120000, 500); $this->assertEventually(function () use ($siteId, $deploymentId) { $site = $this->getSite($siteId); $this->assertEquals($deploymentId, $site['body']['deploymentId'], 'Deployment is not activated, deployment: ' . json_encode($site['body'], JSON_PRETTY_PRINT)); - }, 100000, 500); + }, 60000, 500); return $deploymentId; } diff --git a/tests/e2e/Services/Webhooks/WebhooksBase.php b/tests/e2e/Services/Webhooks/WebhooksBase.php index 398c79ba23..4932ad8c90 100644 --- a/tests/e2e/Services/Webhooks/WebhooksBase.php +++ b/tests/e2e/Services/Webhooks/WebhooksBase.php @@ -26,7 +26,7 @@ trait WebhooksBase $this->assertEquals(200, $deployment['headers']['status-code']); $this->assertEquals('ready', $deployment['body']['status'], \json_encode($deployment['body'])); - }); + }, 120000, 500); } public static function getWebhookSignature(array $webhook, string $signatureKey): string