snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
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
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
This commit is contained in:
140
apps/meteor/tests/e2e/iframe-authentication.spec.ts
Normal file
140
apps/meteor/tests/e2e/iframe-authentication.spec.ts
Normal file
@@ -0,0 +1,140 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
import { Users } from './fixtures/userStates';
|
||||
import { Authenticated, Login } from './page-objects';
|
||||
import { test, expect } from './utils/test';
|
||||
|
||||
const IFRAME_URL = 'http://iframe.rocket.chat';
|
||||
const API_URL = 'http://auth.rocket.chat/api/login';
|
||||
|
||||
test.describe('iframe-authentication', () => {
|
||||
let poLogin: Login;
|
||||
let poAuth: Authenticated;
|
||||
|
||||
test.beforeAll(async ({ api }) => {
|
||||
await api.post('/settings/Accounts_iframe_enabled', { value: true });
|
||||
await api.post('/settings/Accounts_iframe_url', { value: IFRAME_URL });
|
||||
await api.post('/settings/Accounts_Iframe_api_url', { value: API_URL });
|
||||
await api.post('/settings/Accounts_Iframe_api_method', { value: 'POST' });
|
||||
});
|
||||
|
||||
test.afterAll(async ({ api }) => {
|
||||
await api.post('/settings/Accounts_iframe_enabled', { value: false });
|
||||
await api.post('/settings/Accounts_iframe_url', { value: '' });
|
||||
await api.post('/settings/Accounts_Iframe_api_url', { value: '' });
|
||||
await api.post('/settings/Accounts_Iframe_api_method', { value: '' });
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
poLogin = new Login(page);
|
||||
poAuth = new Authenticated(page);
|
||||
|
||||
await page.route(API_URL, async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
});
|
||||
});
|
||||
|
||||
const htmlContent = fs
|
||||
.readFileSync(path.resolve(__dirname, 'fixtures/files/iframe-login.html'), 'utf-8')
|
||||
.replace('REPLACE_WITH_TOKEN', Users.user1.data.loginToken);
|
||||
|
||||
await page.route(IFRAME_URL, async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'text/html',
|
||||
body: htmlContent,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('should render iframe instead of login page', async () => {
|
||||
await poLogin.goto('/home', poLogin.loginIframeForm);
|
||||
});
|
||||
|
||||
test('should render iframe login page if API returns error', async ({ page }) => {
|
||||
await page.route(API_URL, async (route) => {
|
||||
await route.fulfill({
|
||||
status: 500,
|
||||
});
|
||||
});
|
||||
|
||||
await poLogin.goto('/home', poLogin.loginIframeForm);
|
||||
});
|
||||
|
||||
test('should login with token when API returns valid token', async ({ page }) => {
|
||||
await page.route(API_URL, async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ loginToken: Users.user1.data.loginToken }),
|
||||
});
|
||||
});
|
||||
|
||||
await poAuth.goto();
|
||||
});
|
||||
|
||||
test('should show login page when API returns invalid token', async ({ page }) => {
|
||||
await page.route(API_URL, async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ loginToken: 'invalid-token' }),
|
||||
});
|
||||
});
|
||||
|
||||
await poLogin.goto('/home', poLogin.loginIframeForm);
|
||||
});
|
||||
|
||||
test('should login through iframe', async () => {
|
||||
await poLogin.goto('/home', poLogin.loginIframeForm);
|
||||
|
||||
await poLogin.loginIframeSubmitButton.click();
|
||||
|
||||
await poAuth.waitForDisplay();
|
||||
});
|
||||
|
||||
test('should return error to iframe when login fails', async ({ page }) => {
|
||||
const htmlContent = fs.readFileSync(path.resolve(__dirname, 'fixtures/files/iframe-login.html'), 'utf-8');
|
||||
|
||||
await page.route(IFRAME_URL, async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'text/html',
|
||||
body: htmlContent,
|
||||
});
|
||||
});
|
||||
|
||||
await poLogin.goto('/home', poLogin.loginIframeForm);
|
||||
|
||||
await poLogin.loginIframeSubmitButton.click();
|
||||
|
||||
await expect(poLogin.loginIframeError).toBeVisible();
|
||||
});
|
||||
|
||||
test.describe('incomplete settings', () => {
|
||||
test.beforeAll(async ({ api }) => {
|
||||
await api.post('/settings/Accounts_Iframe_api_url', { value: '' });
|
||||
});
|
||||
|
||||
test.afterAll(async ({ api }) => {
|
||||
await api.post('/settings/Accounts_Iframe_api_url', { value: API_URL });
|
||||
});
|
||||
|
||||
test('should render default login page, if settings are incomplete', async ({ page }) => {
|
||||
const htmlContent = fs.readFileSync(path.resolve(__dirname, 'fixtures/files/iframe-login.html'), 'utf-8');
|
||||
|
||||
await page.route(IFRAME_URL, async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'text/html',
|
||||
body: htmlContent,
|
||||
});
|
||||
});
|
||||
|
||||
await poLogin.goto();
|
||||
await expect(poLogin.loginIframeForm).not.toBeVisible();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user