From 2545977d4778d7d33187d1d12829854bce3903c1 Mon Sep 17 00:00:00 2001 From: Khushboo Verma Date: Fri, 4 Jul 2025 17:46:21 +0530 Subject: [PATCH] Fix site template test --- app/config/templates/site.php | 2 +- tests/e2e/Services/Sites/SitesCustomClientTest.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/config/templates/site.php b/app/config/templates/site.php index c6f0119ed9..4ae6f61607 100644 --- a/app/config/templates/site.php +++ b/app/config/templates/site.php @@ -7,7 +7,7 @@ use Utopia\System\System; */ $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; -$hostname = System::getEnv('_APP_CONSOLE_DOMAIN', System::getEnv('_APP_DOMAIN', '')); +$hostname = System::getEnv('_APP_DOMAIN', ''); $url = $protocol . '://' . $hostname; diff --git a/tests/e2e/Services/Sites/SitesCustomClientTest.php b/tests/e2e/Services/Sites/SitesCustomClientTest.php index 9bf389ea62..42fe26d216 100644 --- a/tests/e2e/Services/Sites/SitesCustomClientTest.php +++ b/tests/e2e/Services/Sites/SitesCustomClientTest.php @@ -6,6 +6,7 @@ use Tests\E2E\Client; use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideClient; +use Utopia\System\System; class SitesCustomClientTest extends Scope { @@ -121,6 +122,7 @@ class SitesCustomClientTest extends Scope * Test for SUCCESS */ $template = $this->getTemplate('starter-for-react'); + $hostname = System::getEnv('_APP_DOMAIN') ?: ''; $this->assertEquals(200, $template['headers']['status-code']); $this->assertIsArray($template['body']); $this->assertEquals('starter-for-react', $template['body']['key']); @@ -129,8 +131,8 @@ class SitesCustomClientTest extends Scope $this->assertEquals('github', $template['body']['vcsProvider']); $this->assertEquals('Simple React application integrated with Appwrite SDK.', $template['body']['tagline']); $this->assertIsArray($template['body']['frameworks']); - $this->assertEquals('http://localhost/images/sites/templates/starter-for-react-dark.png', $template['body']['screenshotDark']); - $this->assertEquals('http://localhost/images/sites/templates/starter-for-react-light.png', $template['body']['screenshotLight']); + $this->assertEquals('http://'. $hostname . '/images/sites/templates/starter-for-react-dark.png', $template['body']['screenshotDark']); + $this->assertEquals('http://' . $hostname . '/images/sites/templates/starter-for-react-light.png', $template['body']['screenshotLight']); /** * Test for FAILURE