From bd2bee6ee6cf954206fef91f48caf55b380b3a7a Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 30 Jul 2026 12:16:07 +0530 Subject: [PATCH] fix: stabilize flaky GraphQL avatars getImage test Use the same appwrite.io image URL as REST and retry with assertEventually so transient remote fetch failures do not flake CI. Co-authored-by: Cursor --- tests/e2e/Services/GraphQL/AvatarsTest.php | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/tests/e2e/Services/GraphQL/AvatarsTest.php b/tests/e2e/Services/GraphQL/AvatarsTest.php index 716c2267d3..c73edd3595 100644 --- a/tests/e2e/Services/GraphQL/AvatarsTest.php +++ b/tests/e2e/Services/GraphQL/AvatarsTest.php @@ -91,18 +91,25 @@ final class AvatarsTest extends Scope $graphQLPayload = [ 'query' => $query, 'variables' => [ - 'url' => 'https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png', + // Same URL as REST AvatarsBase::testGetImage (Google logo fetches flake in CI) + 'url' => 'https://appwrite.io/images/open-graph/website.avif', ], ]; - $image = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([ - 'content-type' => 'application/json', - 'x-appwrite-project' => $projectId, - ], $this->getHeaders()), $graphQLPayload); + /** + * Wrapped in assertEventually to handle transient external URL failures + */ + $image = null; + $this->assertEventually(function () use ($projectId, $graphQLPayload, &$image) { + $image = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $projectId, + ], $this->getHeaders()), $graphQLPayload); - $this->assertEquals(200, $image['headers']['status-code']); - $this->assertNotEmpty($image['body']); - $this->assertStringContainsString('image/', (string) $image['headers']['content-type']); + $this->assertEquals(200, $image['headers']['status-code']); + $this->assertNotEmpty($image['body']); + $this->assertStringContainsString('image/', (string) $image['headers']['content-type']); + }, 30_000, 2_000); return $image['body']; }