diff --git a/e2e-tests/playwright/.eslintignore b/e2e-tests/playwright/.eslintignore index 169a2afd8a..96b43a07c6 100644 --- a/e2e-tests/playwright/.eslintignore +++ b/e2e-tests/playwright/.eslintignore @@ -1,3 +1,4 @@ node_modules playwright-report test-results +results diff --git a/e2e-tests/playwright/.prettierignore b/e2e-tests/playwright/.prettierignore index 1d6a96bc22..fe7502a4c6 100644 --- a/e2e-tests/playwright/.prettierignore +++ b/e2e-tests/playwright/.prettierignore @@ -3,3 +3,5 @@ package.json package-lock.json playwright-report storage_state +test-results +results diff --git a/e2e-tests/playwright/support/server/default_config.ts b/e2e-tests/playwright/support/server/default_config.ts index 474d6141c8..4a008a81e2 100644 --- a/e2e-tests/playwright/support/server/default_config.ts +++ b/e2e-tests/playwright/support/server/default_config.ts @@ -81,7 +81,7 @@ const onPremServerConfig = (): Partial => { }; // Should be based only from the generated default config from ./server via "make config-reset" -// Based on v10.0 server +// Based on v10.2 server const defaultServerConfig: AdminConfig = { ServiceSettings: { SiteURL: '', @@ -167,6 +167,7 @@ const defaultServerConfig: AdminConfig = { EnableAPITriggerAdminNotifications: false, EnableAPIUserDeletion: false, EnableAPIPostDeletion: false, + EnableDesktopLandingPage: true, ExperimentalEnableHardenedMode: false, ExperimentalStrictCSRFEnforcement: false, EnableEmailInvitations: false, @@ -548,12 +549,14 @@ const defaultServerConfig: AdminConfig = { AppDownloadLink: 'https://mattermost.com/pl/download-apps', AndroidAppDownloadLink: 'https://mattermost.com/pl/android-app/', IosAppDownloadLink: 'https://mattermost.com/pl/ios-app/', + MobileExternalBrowser: false, }, CacheSettings: { CacheType: 'lru', RedisAddress: '', RedisPassword: '', RedisDB: -1, + DisableClientCache: false, }, ClusterSettings: { Enable: false, @@ -731,7 +734,7 @@ const defaultServerConfig: AdminConfig = { ConsumePostHook: false, CloudAnnualRenewals: false, CloudDedicatedExportUI: false, - ChannelBookmarks: false, + ChannelBookmarks: true, WebSocketEventScope: true, NotificationMonitoring: true, ExperimentalAuditSettingsSystemConsoleUI: false, diff --git a/e2e-tests/playwright/tests/functional/system_console/desktop_landing.spec.ts b/e2e-tests/playwright/tests/functional/system_console/desktop_landing.spec.ts index f84682f43c..e496c348b7 100644 --- a/e2e-tests/playwright/tests/functional/system_console/desktop_landing.spec.ts +++ b/e2e-tests/playwright/tests/functional/system_console/desktop_landing.spec.ts @@ -1,4 +1,5 @@ -import {test, expect, chromium, Page} from '@playwright/test'; +import {Page} from '@playwright/test'; +import {expect, test} from '@e2e-support/test_fixture'; // Helper function to intercept API request and modify the response async function interceptConfigWithLandingPage(page: Page, enabled: boolean) { @@ -22,10 +23,9 @@ async function interceptConfigWithLandingPage(page: Page, enabled: boolean) { }); } -test('MM-T5640_1 should not see landing page ', async () => { - const browser = await chromium.launch(); - const context = await browser.newContext(); - const page = await context.newPage(); +test('MM-T5640_1 should not see landing page ', async ({pw, pages, page}) => { + const {adminClient} = await pw.getAdminClient(); + const adminConfig = await adminClient.getConfig(); await interceptConfigWithLandingPage(page, false); // Navigate to your starting URL @@ -37,19 +37,12 @@ test('MM-T5640_1 should not see landing page ', async () => { // At this point, the URL should contain '/login' expect(page.url()).toContain('/login'); - await page.waitForLoadState('networkidle'); - await page.waitForLoadState('domcontentloaded'); - - page.locator('#saveSetting').waitFor(); - const loginButton = page.locator('#saveSetting'); - await expect(loginButton).toHaveText('Log in'); + // Verify the login page is visible + const loginPage = new pages.LoginPage(page, adminConfig); + await loginPage.toBeVisible(); }); -test('MM-T5640_2 should see landing page', async () => { - const browser = await chromium.launch(); - const context = await browser.newContext(); - const page = await context.newPage(); - +test('MM-T5640_2 should see landing page', async ({pages, isMobile, page}) => { // Navigate to your starting URL await page.goto('http://localhost:8065'); @@ -63,13 +56,7 @@ test('MM-T5640_2 should see landing page', async () => { // At this point, the URL should contain '/landing' expect(page.url()).toContain('/landing'); - // Check the user agent - const userAgent = await page.evaluate(() => navigator.userAgent); - - const viewInAppButton = page.locator('a.btn-primary'); - await expect(viewInAppButton).toBeVisible(); - await expect(viewInAppButton).toHaveText(userAgent.includes('iPad') ? 'View in App' : 'View in Desktop App'); - - const viewInBrowser = page.locator('a.btn-tertiary'); - await expect(viewInBrowser).toHaveText('View in Browser'); + // Verify the landing page is visible + const landingLoginPage = new pages.LandingLoginPage(page, isMobile); + await landingLoginPage.toBeVisible(); }); diff --git a/webapp/platform/types/src/config.ts b/webapp/platform/types/src/config.ts index 9f2b606ff0..860c7d9310 100644 --- a/webapp/platform/types/src/config.ts +++ b/webapp/platform/types/src/config.ts @@ -396,6 +396,7 @@ export type ServiceSettings = { RefreshPostStatsRunTime: string; MaximumPayloadSizeBytes: number; EnableAPIPostDeletion: boolean; + EnableDesktopLandingPage: boolean; MaximumURLLength: number; }; @@ -760,6 +761,7 @@ export type NativeAppSettings = { AppDownloadLink: string; AndroidAppDownloadLink: string; IosAppDownloadLink: string; + MobileExternalBrowser: boolean; }; export type ClusterSettings = { @@ -808,6 +810,7 @@ export type CacheSettings = { RedisAddress: string; RedisPassword: string; RedisDB: number; + DisableClientCache: boolean; }; export type ElasticsearchSettings = {