Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s
111 lines
4.2 KiB
TypeScript
111 lines
4.2 KiB
TypeScript
import { DEFAULT_USER_CREDENTIALS } from './config/constants';
|
|
import { AccountSecurity, HomeChannel, Login } from './page-objects';
|
|
import { test, expect } from './utils/test';
|
|
import { createTestUser, type ITestUser } from './utils/user-helpers';
|
|
|
|
test.describe.serial('Forget session on window close setting', () => {
|
|
let poLogin: Login;
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
poLogin = new Login(page);
|
|
|
|
await poLogin.goto();
|
|
});
|
|
|
|
test.describe('Setting off', async () => {
|
|
test.beforeAll(async ({ api }) => {
|
|
await api.post('/settings/Accounts_ForgetUserSessionOnWindowClose', { value: false });
|
|
});
|
|
|
|
test('Login using credentials and reload to stay logged in', async ({ page, context }) => {
|
|
await poLogin.login('user1', DEFAULT_USER_CREDENTIALS.password);
|
|
|
|
await expect(page.locator('role=heading[name="Welcome to Rocket.Chat"]')).toBeVisible();
|
|
|
|
const newPage = await context.newPage();
|
|
await new HomeChannel(newPage).goto();
|
|
|
|
await expect(newPage.locator('role=heading[name="Welcome to Rocket.Chat"]')).toBeVisible();
|
|
});
|
|
});
|
|
|
|
test.describe('Setting on', async () => {
|
|
test.beforeAll(async ({ api }) => {
|
|
await api.post('/settings/Accounts_ForgetUserSessionOnWindowClose', { value: true });
|
|
});
|
|
|
|
test.afterAll(async ({ api }) => {
|
|
await api.post('/settings/Accounts_ForgetUserSessionOnWindowClose', { value: false });
|
|
});
|
|
|
|
test('Login using credentials and reload to stay logged in', async ({ page }) => {
|
|
await poLogin.login('user1', DEFAULT_USER_CREDENTIALS.password);
|
|
|
|
await expect(page.locator('role=heading[name="Welcome to Rocket.Chat"]')).toBeVisible();
|
|
|
|
await page.reload();
|
|
|
|
await expect(page.locator('role=heading[name="Welcome to Rocket.Chat"]')).toBeVisible();
|
|
});
|
|
|
|
test('Login using credentials in a new tab after first tab logged in', async ({ page, context }) => {
|
|
await poLogin.login('user1', DEFAULT_USER_CREDENTIALS.password);
|
|
|
|
await expect(page.locator('role=heading[name="Welcome to Rocket.Chat"]')).toBeVisible();
|
|
|
|
const newPage = await context.newPage();
|
|
const newPoLogin = new Login(newPage);
|
|
await newPoLogin.goto();
|
|
|
|
await newPoLogin.login('user1', DEFAULT_USER_CREDENTIALS.password);
|
|
|
|
await expect(newPage.locator('role=heading[name="Welcome to Rocket.Chat"]')).toBeVisible();
|
|
});
|
|
|
|
test.describe('E2EE save password flow', () => {
|
|
// Dedicated throwaway user: resetE2EEPassword() calls Users.unsetLoginTokens(),
|
|
// which would invalidate the shared admin login token the `api` fixture
|
|
// authenticates with — breaking every subsequent admin-authenticated request
|
|
// in the worker (e.g. the next spec's beforeAll settings changes silently 401).
|
|
let e2eeUser: ITestUser;
|
|
|
|
test.beforeAll(async ({ api }) => {
|
|
await api.post('/settings/E2E_Enable', { value: true });
|
|
await api.post('/settings/E2E_Allow_Unencrypted_Messages', { value: false });
|
|
|
|
e2eeUser = await createTestUser(api);
|
|
});
|
|
|
|
test.afterAll(async ({ api }) => {
|
|
await e2eeUser?.delete();
|
|
await api.post('/settings/E2E_Allow_Unencrypted_Messages', { value: true });
|
|
await api.post('/settings/E2E_Enable', { value: false });
|
|
});
|
|
|
|
test('E2EE save password button opens modal in SAVE_PASSWORD state', async ({ page }) => {
|
|
const poHomeChannel = new HomeChannel(page);
|
|
const poAccountSecurity = new AccountSecurity(page);
|
|
|
|
await poLogin.login(e2eeUser.data.username, DEFAULT_USER_CREDENTIALS.password);
|
|
await expect(page.locator('role=heading[name="Welcome to Rocket.Chat"]')).toBeVisible();
|
|
|
|
await poAccountSecurity.goto();
|
|
await poAccountSecurity.resetE2EEPassword();
|
|
|
|
await page.locator('role=button[name="Login"]').waitFor();
|
|
|
|
await poLogin.login(e2eeUser.data.username, DEFAULT_USER_CREDENTIALS.password);
|
|
await expect(page.locator('role=heading[name="Welcome to Rocket.Chat"]')).toBeVisible();
|
|
await expect(poHomeChannel.bannerSaveEncryptionPassword).toBeVisible();
|
|
await poHomeChannel.bannerSaveEncryptionPassword.click();
|
|
|
|
const randomPassword = await page.evaluate(() => window.sessionStorage.getItem('e2e.randomPassword') ?? '');
|
|
expect(randomPassword).toBeTruthy();
|
|
|
|
await expect(poHomeChannel.dialogSaveE2EEPassword).toBeVisible();
|
|
await expect(poHomeChannel.dialogSaveE2EEPassword).toContainText(randomPassword);
|
|
});
|
|
});
|
|
});
|
|
});
|