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
playwright-report
test-results
results

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

@@ -3,3 +3,5 @@ package.json
package-lock.json
playwright-report
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"
// 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,

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

@@ -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();
});