diff --git a/tests/e2e/Services/Databases/Tables/DatabasesBase.php b/tests/e2e/Services/Databases/Tables/DatabasesBase.php index 12426d78b2..29f92cc58a 100644 --- a/tests/e2e/Services/Databases/Tables/DatabasesBase.php +++ b/tests/e2e/Services/Databases/Tables/DatabasesBase.php @@ -4572,7 +4572,11 @@ trait DatabasesBase $response = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/tables/' . $personCollection . '/rows/' . $person2['body']['$id'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); + ], $this->getHeaders()), [ + 'queries' => [ + Query::select(['*', 'libraries.*'])->toString() + ] + ]); $this->assertEquals(200, $response['headers']['status-code']); $this->assertArrayNotHasKey('$table', $response['body']); @@ -4582,7 +4586,11 @@ trait DatabasesBase $response = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/tables/' . $libraryCollection . '/rows/library11', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); + ], $this->getHeaders()), [ + 'queries' => [ + Query::select(['person_one_to_many.$id'])->toString() + ] + ]); $this->assertEquals(200, $response['headers']['status-code']); $this->assertArrayHasKey('person_one_to_many', $response['body']); @@ -4732,7 +4740,11 @@ trait DatabasesBase $album = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/tables/' . $albums['body']['$id'] . '/rows/album1', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); + ], $this->getHeaders()), [ + 'queries' => [ + Query::select(['*', 'artist.name', 'artist.$permissions'])->toString() + ] + ]); $this->assertEquals(200, $album['headers']['status-code']); $this->assertEquals('album1', $album['body']['$id']); @@ -4744,7 +4756,11 @@ trait DatabasesBase $artist = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/tables/' . $artists['body']['$id'] . '/rows/' . $album['body']['artist']['$id'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); + ], $this->getHeaders()), [ + 'queries' => [ + Query::select(['*', 'albums.$id', 'albums.name', 'albums.$permissions'])->toString() + ] + ]); $this->assertEquals(200, $artist['headers']['status-code']); $this->assertEquals('Artist 1', $artist['body']['name']); @@ -4885,7 +4901,11 @@ trait DatabasesBase $sport = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/tables/' . $sports['body']['$id'] . '/rows/sport1', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); + ], $this->getHeaders()), [ + 'queries' => [ + Query::select(['*', 'players.name', 'players.$permissions'])->toString() + ] + ]); $this->assertEquals(200, $sport['headers']['status-code']); $this->assertEquals('sport1', $sport['body']['$id']); @@ -4899,7 +4919,11 @@ trait DatabasesBase $player = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/tables/' . $players['body']['$id'] . '/rows/' . $sport['body']['players'][0]['$id'], array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders())); + ], $this->getHeaders()), [ + 'queries' => [ + Query::select(['*', 'sports.$id', 'sports.name', 'sports.$permissions'])->toString() + ] + ]); $this->assertEquals(200, $player['headers']['status-code']); $this->assertEquals('Player 1', $player['body']['name']); @@ -4927,6 +4951,7 @@ trait DatabasesBase ], $this->getHeaders()), [ 'queries' => [ Query::isNotNull('$id')->toString(), + Query::select(['*', 'libraries.*'])->toString(), Query::startsWith('fullName', 'Stevie')->toString(), Query::endsWith('fullName', 'Wonder')->toString(), Query::between('$createdAt', '1975-12-06', '2050-12-01')->toString(), diff --git a/tests/e2e/Services/Databases/Tables/DatabasesCustomServerTest.php b/tests/e2e/Services/Databases/Tables/DatabasesCustomServerTest.php index 710b167b64..99f1b58c01 100644 --- a/tests/e2e/Services/Databases/Tables/DatabasesCustomServerTest.php +++ b/tests/e2e/Services/Databases/Tables/DatabasesCustomServerTest.php @@ -3740,7 +3740,11 @@ class DatabasesCustomServerTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] - ])); + ]), [ + 'queries' => [ + Query::select(['new_level_2.*'])->toString() + ] + ]); $this->assertArrayHasKey('new_level_2', $newRow['body']); $this->assertEquals(1, count($newRow['body']['new_level_2'])); @@ -3850,7 +3854,11 @@ class DatabasesCustomServerTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] - ])); + ]), [ + 'queries' => [ + Query::select(['new_level_2.*'])->toString() + ] + ]); $this->assertArrayHasKey('new_level_2', $newRow['body']); $this->assertNotEmpty($newRow['body']['new_level_2']); @@ -3960,7 +3968,11 @@ class DatabasesCustomServerTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] - ])); + ]), [ + 'queries' => [ + Query::select(['new_level_2.*'])->toString() + ] + ]); $this->assertArrayHasKey('new_level_2', $newRow['body']); $this->assertNotEmpty($newRow['body']['new_level_2']); @@ -3971,7 +3983,11 @@ class DatabasesCustomServerTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] - ])); + ]), [ + 'queries' => [ + Query::select(['*', 'level1.*'])->toString() + ] + ]); $this->assertArrayHasKey('level1', $level2Row['body']); $this->assertNotEmpty($level2Row['body']['level1']); @@ -4070,7 +4086,11 @@ class DatabasesCustomServerTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] - ])); + ]), [ + 'queries' => [ + Query::select(['new_level_2.*'])->toString() + ] + ]); $this->assertArrayHasKey('new_level_2', $newRow['body']); $this->assertNotEmpty($newRow['body']['new_level_2']); @@ -4081,7 +4101,11 @@ class DatabasesCustomServerTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] - ])); + ]), [ + 'queries' => [ + Query::select(['*', 'level1.*'])->toString() + ] + ]); $this->assertArrayHasKey('level1', $level2Row['body']); $this->assertNotEmpty($level2Row['body']['level1']); @@ -4426,6 +4450,14 @@ class DatabasesCustomServerTest extends Scope $createBulkRows(); + /** + * Wait for database to purge cache... + * + * This test specifically failed on 1.6.x response format, + * could be due to the slow or overworked machine, but being safe here! + */ + sleep(5); + // TEST: Update all rows $response = $this->client->call(Client::METHOD_PATCH, '/databases/' . $data['databaseId'] . '/tables/' . $data['$id'] . '/rows', array_merge([ 'content-type' => 'application/json', @@ -4444,6 +4476,14 @@ class DatabasesCustomServerTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertCount(10, $response['body']['rows']); + /** + * Wait for database to purge cache... + * + * This test specifically failed on 1.6.x response format, + * could be due to the slow or overworked machine, but being safe here! + */ + sleep(5); + $rows = $this->client->call(Client::METHOD_GET, '/databases/' . $data['databaseId'] . '/tables/' . $data['$id'] . '/rows', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'],