diff --git a/tests/e2e/Services/Project/PoliciesSessionLimitIntegrationTest.php b/tests/e2e/Services/Project/PoliciesSessionLimitIntegrationTest.php index fdce21073b..0fe92c5232 100644 --- a/tests/e2e/Services/Project/PoliciesSessionLimitIntegrationTest.php +++ b/tests/e2e/Services/Project/PoliciesSessionLimitIntegrationTest.php @@ -73,6 +73,12 @@ final class PoliciesSessionLimitIntegrationTest extends Scope $this->assertSame(200, $response['headers']['status-code']); }; + $trySetSessionLimit = function (?int $total) use ($serverHeaders): array { + return $this->client->call(Client::METHOD_PATCH, '/project/policies/session-limit', $serverHeaders, [ + 'total' => $total, + ]); + }; + // Step 1: Session limit = 1 $setSessionLimit(1); @@ -109,16 +115,8 @@ final class PoliciesSessionLimitIntegrationTest extends Scope $this->assertSame(200, $getAccount($session3)['headers']['status-code']); $this->assertSame(401, $getAccount($session2)['headers']['status-code']); - // Step 4: Disable session limit, create 5 new sessions, all should remain usable - $setSessionLimit(null); - - $newSessions = []; - for ($i = 0; $i < 5; $i++) { - $newSessions[] = $login(); - } - - foreach ($newSessions as $index => $sessionCookie) { - $this->assertSame(200, $getAccount($sessionCookie)['headers']['status-code'], 'Session #' . ($index + 1) . ' should remain valid when limit is disabled'); - } + // Step 4: Session limit does not support being disabled (unlimited sessions) + $response = $trySetSessionLimit(null); + $this->assertSame(400, $response['headers']['status-code']); } } diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index 82eb9c5bba..22d04d45d7 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -2092,7 +2092,7 @@ final class ProjectsConsoleClientTest extends Scope 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-response-format' => '1.9.1', ], $this->getHeaders()), [ - 'duration' => 10, // Set session duration to 10 seconds + 'duration' => 60, // Set session duration to 60 seconds (the policy minimum) ]); $this->assertEquals(200, $response['headers']['status-code']); @@ -2101,7 +2101,7 @@ final class ProjectsConsoleClientTest extends Scope $this->assertArrayHasKey('platforms', $response['body']); $this->assertArrayHasKey('webhooks', $response['body']); $this->assertArrayHasKey('keys', $response['body']); - $this->assertEquals(10, $response['body']['authDuration']); + $this->assertEquals(60, $response['body']['authDuration']); $projectId = $response['body']['$id']; @@ -2142,7 +2142,7 @@ final class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); - // Eventually session expires, within 15 seconds (10+variance) + // Eventually session expires, within 75 seconds (60+variance) $this->assertEventually(function () use ($projectId, $sessionCookie) { // Get User $response = $this->client->call(Client::METHOD_GET, '/account', array_merge([ @@ -2152,7 +2152,7 @@ final class ProjectsConsoleClientTest extends Scope ])); $this->assertEquals(401, $response['headers']['status-code']); - }, timeoutMs: 15 * 1000); + }, timeoutMs: 75 * 1000); // Set session duration to 10min $response = $this->client->call(Client::METHOD_PATCH, '/projects/' . $id . '/auth/duration', array_merge([