Files
Harrison HealeyandGitHub daec1283e5 MM-69003 Mostly share ESLint config between web app and E2E tests (#36767)
* Switch Cypress to use shared ESLint config

* Run --fix in Cypress

* Manually fix remaining lint issues in Cypress

* Switch Playwright to use shared ESLint config

* Run --fix in Playwright

* Manually fix remaining lint issues in Playwright

* Install and cache web app deps during Cypress CI builds

This also caches the types and client package. That isn't needed currently
since it uses prepackaged versions of those, but I imagine we might change
that at some point.

* Run e2e-tests-check when ESLint plugin is updated

* Change E2E test GHA caching to cache all of web app node_modules

* Fix mismatch between cache save and restore

* Try bumping cache keys

* Copy step to install dependencies to server.run_cypress.sh

I don't know how this must've worked before, but if this fixes the issue,
it seems like neither Cypress nor Playwright actually use the cached
depenendencies.

* Try disabling caching entirely for Cypress tests

* Try bypassing makefile?

* Try also manually building dependencies in run_specs.sh

I don't know why this appears to duplicate run_cypress.sh and
run_playwright.sh, both of which are called run_test.sh which
might not be used any more as best I can tell.

* Try installing the web app dependencies in yet another place

* Disable the extra steps in server.prepare.sh specifically for Cypress

* Revert changes to update cache key and disable web app depenedency cache on Cypress builds
2026-06-09 20:50:58 +00:00

52 lines
1.6 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import type {Page} from '@playwright/test';
import {expect, test} from '@mattermost/playwright-lib';
// Helper function to intercept API request and modify the response
async function interceptConfigWithLandingPage(page: Page, enabled: boolean) {
const apiUrl = '**/api/v4/config/client?format=old**';
await page.route(apiUrl, (route) => {
route.fulfill({
status: 200,
body: JSON.stringify({
EnableDesktopLandingPage: enabled,
EnableSignInWithUsername: 'true',
}),
headers: {'Content-Type': 'application/json'},
});
});
}
test('MM-T5640_1 should not see landing page ', async ({pw, page}) => {
await interceptConfigWithLandingPage(page, false);
// Navigate to your starting URL
await page.goto('/');
// Wait until the URL contains '/login'
await page.waitForURL(/.*\/login.*/);
// At this point, the URL should contain '/login'
expect(page.url()).toContain('/login');
// Verify the login page is visible
await pw.loginPage.toBeVisible();
});
test('MM-T5640_2 should see landing page', async ({pw, page}) => {
// Navigate to your starting URL
await page.goto('/');
// Wait until the URL contains '/landing'
await page.waitForURL(/.*\/landing.*/, {timeout: pw.duration.ten_sec});
// At this point, the URL should contain '/landing'
expect(page.url()).toContain('/landing');
// Verify the landing page is visible
await pw.landingLoginPage.toBeVisible();
});