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:
118
apps/meteor/tests/e2e/admin-device-management.spec.ts
Normal file
118
apps/meteor/tests/e2e/admin-device-management.spec.ts
Normal file
@@ -0,0 +1,118 @@
|
||||
import type { Page } from 'playwright-core';
|
||||
|
||||
import { IS_EE } from './config/constants';
|
||||
import { createAuxContext } from './fixtures/createAuxContext';
|
||||
import injectInitialData from './fixtures/inject-initial-data';
|
||||
import { Users } from './fixtures/userStates';
|
||||
import { Authenticated, HomeChannel, Login, Registration } from './page-objects';
|
||||
import { AdminDeviceManagement } from './page-objects/admin-device-management';
|
||||
import { test, expect } from './utils/test';
|
||||
|
||||
test.describe('Admin Device Management Page', () => {
|
||||
test.skip(!IS_EE);
|
||||
test.use({ storageState: Users.admin.state });
|
||||
|
||||
let page: Page;
|
||||
let adminDeviceManagement: AdminDeviceManagement;
|
||||
let poLogin: Login;
|
||||
|
||||
test.beforeEach(async ({ browser }) => {
|
||||
({ page } = await createAuxContext(browser, Users.admin));
|
||||
adminDeviceManagement = new AdminDeviceManagement(page);
|
||||
poLogin = new Login(page);
|
||||
await adminDeviceManagement.goto();
|
||||
});
|
||||
|
||||
test.afterEach(async () => {
|
||||
await page.close();
|
||||
await injectInitialData();
|
||||
});
|
||||
|
||||
test('should show Device management page', async () => {
|
||||
await expect(adminDeviceManagement.pageContent).toBeVisible();
|
||||
});
|
||||
|
||||
test('should logout current device and redirect to login page', async () => {
|
||||
const deviceId = await adminDeviceManagement.getUsersDeviceId('rocketchat.internal.admin.test');
|
||||
await adminDeviceManagement.logoutDeviceById(deviceId);
|
||||
await poLogin.waitForDisplay();
|
||||
});
|
||||
|
||||
test('should logout current device from device info tab and redirect to login page', async () => {
|
||||
const deviceId = await adminDeviceManagement.getUsersDeviceId('rocketchat.internal.admin.test');
|
||||
await adminDeviceManagement.searchUserDevice('rocketchat.internal.admin.test');
|
||||
await adminDeviceManagement.table.getDeviceRowById(deviceId).click();
|
||||
|
||||
await expect(adminDeviceManagement.deviceInfo.getDeviceInfoId(deviceId)).toBeVisible();
|
||||
await adminDeviceManagement.deviceInfo.btnLogoutDevice.click();
|
||||
await adminDeviceManagement.logoutModal.confirmLogout();
|
||||
await poLogin.waitForDisplay();
|
||||
});
|
||||
|
||||
test('should logout other device successfully', async ({ browser }) => {
|
||||
const user2Page = await browser.newPage({ storageState: Users.user2.state });
|
||||
const loginPage2 = new Registration(user2Page);
|
||||
await new Authenticated(user2Page).goto();
|
||||
|
||||
const user2DeviceId = await adminDeviceManagement.getUsersDeviceId('user2');
|
||||
|
||||
await test.step('should logout user2 and redirect to login page', async () => {
|
||||
await adminDeviceManagement.logoutDeviceById(user2DeviceId);
|
||||
await loginPage2.waitForDisplay();
|
||||
});
|
||||
|
||||
await test.step('should no longer show user2 device in admin device management page', async () => {
|
||||
await adminDeviceManagement.searchUserDevice('user2');
|
||||
await expect(adminDeviceManagement.table.getDeviceRowById(user2DeviceId)).not.toBeVisible();
|
||||
});
|
||||
|
||||
await user2Page.close();
|
||||
});
|
||||
|
||||
test('should remove user2 from device list when user2 logs out from their own session', async ({ browser }) => {
|
||||
const user2Page = await browser.newPage({ storageState: Users.user2.state });
|
||||
const loginPage2 = new Registration(user2Page);
|
||||
const poUser2Home = new HomeChannel(user2Page);
|
||||
|
||||
await poUser2Home.goto();
|
||||
|
||||
await test.step('should list user2 device while user2 is logged in', async () => {
|
||||
await expect(adminDeviceManagement.pageContent).toBeVisible();
|
||||
await adminDeviceManagement.searchUserDevice('user2');
|
||||
await expect(adminDeviceManagement.table.getRowsForUsername('user2')).toHaveCount(1);
|
||||
});
|
||||
|
||||
await test.step('should log user2 out from the app and redirect to login page', async () => {
|
||||
await poUser2Home.navbar.logout();
|
||||
await loginPage2.waitForDisplay();
|
||||
});
|
||||
|
||||
await test.step('should no longer show user2 device in admin device management page', async () => {
|
||||
await page.reload();
|
||||
await expect(adminDeviceManagement.pageContent).toBeVisible();
|
||||
await adminDeviceManagement.searchUserDevice('user2');
|
||||
await expect(adminDeviceManagement.table.getRowsForUsername('user2')).toHaveCount(0);
|
||||
});
|
||||
|
||||
await user2Page.close();
|
||||
});
|
||||
|
||||
test('Should show empty state when searching for user without result', async () => {
|
||||
const noResultQuery = 'nonexistentuser';
|
||||
await adminDeviceManagement.searchUserDevice('noResultQuery');
|
||||
await expect(adminDeviceManagement.table.getRowsForUsername(noResultQuery)).toHaveCount(0);
|
||||
await expect(adminDeviceManagement.emptyState).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Admin Device Management Page - unauthorized access', () => {
|
||||
test.skip(!IS_EE);
|
||||
test.use({ storageState: Users.user2.state });
|
||||
|
||||
test('should not access device-management when user has no view-device-management permission', async ({ page }) => {
|
||||
const user2DeviceManagement = new AdminDeviceManagement(page);
|
||||
await user2DeviceManagement.gotoExpecting(user2DeviceManagement.notAuthorizedMessage);
|
||||
await expect(user2DeviceManagement.notAuthorizedMessage).toBeVisible();
|
||||
await expect(user2DeviceManagement.pageContent).not.toBeVisible();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user