follow up to MM-61126 desktop landing page (#28888)

Этот коммит содержится в:
Saturnino Abril
2024-10-24 05:10:18 +08:00
коммит произвёл GitHub
родитель 99a95508d2
Коммит c7aec8c5c5
5 изменённых файлов: 23 добавлений и 27 удалений

Просмотреть файл

@@ -1,3 +1,4 @@
node_modules node_modules
playwright-report playwright-report
test-results test-results
results

Просмотреть файл

@@ -3,3 +3,5 @@ package.json
package-lock.json package-lock.json
playwright-report playwright-report
storage_state storage_state
test-results
results

Просмотреть файл

@@ -81,7 +81,7 @@ const onPremServerConfig = (): Partial<TestAdminConfig> => {
}; };
// Should be based only from the generated default config from ./server via "make config-reset" // 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 = { const defaultServerConfig: AdminConfig = {
ServiceSettings: { ServiceSettings: {
SiteURL: '', SiteURL: '',
@@ -167,6 +167,7 @@ const defaultServerConfig: AdminConfig = {
EnableAPITriggerAdminNotifications: false, EnableAPITriggerAdminNotifications: false,
EnableAPIUserDeletion: false, EnableAPIUserDeletion: false,
EnableAPIPostDeletion: false, EnableAPIPostDeletion: false,
EnableDesktopLandingPage: true,
ExperimentalEnableHardenedMode: false, ExperimentalEnableHardenedMode: false,
ExperimentalStrictCSRFEnforcement: false, ExperimentalStrictCSRFEnforcement: false,
EnableEmailInvitations: false, EnableEmailInvitations: false,
@@ -548,12 +549,14 @@ const defaultServerConfig: AdminConfig = {
AppDownloadLink: 'https://mattermost.com/pl/download-apps', AppDownloadLink: 'https://mattermost.com/pl/download-apps',
AndroidAppDownloadLink: 'https://mattermost.com/pl/android-app/', AndroidAppDownloadLink: 'https://mattermost.com/pl/android-app/',
IosAppDownloadLink: 'https://mattermost.com/pl/ios-app/', IosAppDownloadLink: 'https://mattermost.com/pl/ios-app/',
MobileExternalBrowser: false,
}, },
CacheSettings: { CacheSettings: {
CacheType: 'lru', CacheType: 'lru',
RedisAddress: '', RedisAddress: '',
RedisPassword: '', RedisPassword: '',
RedisDB: -1, RedisDB: -1,
DisableClientCache: false,
}, },
ClusterSettings: { ClusterSettings: {
Enable: false, Enable: false,
@@ -731,7 +734,7 @@ const defaultServerConfig: AdminConfig = {
ConsumePostHook: false, ConsumePostHook: false,
CloudAnnualRenewals: false, CloudAnnualRenewals: false,
CloudDedicatedExportUI: false, CloudDedicatedExportUI: false,
ChannelBookmarks: false, ChannelBookmarks: true,
WebSocketEventScope: true, WebSocketEventScope: true,
NotificationMonitoring: true, NotificationMonitoring: true,
ExperimentalAuditSettingsSystemConsoleUI: false, ExperimentalAuditSettingsSystemConsoleUI: false,

Просмотреть файл

@@ -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 // Helper function to intercept API request and modify the response
async function interceptConfigWithLandingPage(page: Page, enabled: boolean) { 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 () => { test('MM-T5640_1 should not see landing page ', async ({pw, pages, page}) => {
const browser = await chromium.launch(); const {adminClient} = await pw.getAdminClient();
const context = await browser.newContext(); const adminConfig = await adminClient.getConfig();
const page = await context.newPage();
await interceptConfigWithLandingPage(page, false); await interceptConfigWithLandingPage(page, false);
// Navigate to your starting URL // 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' // At this point, the URL should contain '/login'
expect(page.url()).toContain('/login'); expect(page.url()).toContain('/login');
await page.waitForLoadState('networkidle'); // Verify the login page is visible
await page.waitForLoadState('domcontentloaded'); const loginPage = new pages.LoginPage(page, adminConfig);
await loginPage.toBeVisible();
page.locator('#saveSetting').waitFor();
const loginButton = page.locator('#saveSetting');
await expect(loginButton).toHaveText('Log in');
}); });
test('MM-T5640_2 should see landing page', async () => { test('MM-T5640_2 should see landing page', async ({pages, isMobile, page}) => {
const browser = await chromium.launch();
const context = await browser.newContext();
const page = await context.newPage();
// Navigate to your starting URL // Navigate to your starting URL
await page.goto('http://localhost:8065'); 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' // At this point, the URL should contain '/landing'
expect(page.url()).toContain('/landing'); expect(page.url()).toContain('/landing');
// Check the user agent // Verify the landing page is visible
const userAgent = await page.evaluate(() => navigator.userAgent); const landingLoginPage = new pages.LandingLoginPage(page, isMobile);
await landingLoginPage.toBeVisible();
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');
}); });

Просмотреть файл

@@ -396,6 +396,7 @@ export type ServiceSettings = {
RefreshPostStatsRunTime: string; RefreshPostStatsRunTime: string;
MaximumPayloadSizeBytes: number; MaximumPayloadSizeBytes: number;
EnableAPIPostDeletion: boolean; EnableAPIPostDeletion: boolean;
EnableDesktopLandingPage: boolean;
MaximumURLLength: number; MaximumURLLength: number;
}; };
@@ -760,6 +761,7 @@ export type NativeAppSettings = {
AppDownloadLink: string; AppDownloadLink: string;
AndroidAppDownloadLink: string; AndroidAppDownloadLink: string;
IosAppDownloadLink: string; IosAppDownloadLink: string;
MobileExternalBrowser: boolean;
}; };
export type ClusterSettings = { export type ClusterSettings = {
@@ -808,6 +810,7 @@ export type CacheSettings = {
RedisAddress: string; RedisAddress: string;
RedisPassword: string; RedisPassword: string;
RedisDB: number; RedisDB: number;
DisableClientCache: boolean;
}; };
export type ElasticsearchSettings = { export type ElasticsearchSettings = {