Skip to content
Snippets Groups Projects
Commit b9887fcd authored by Tiago Evangelista's avatar Tiago Evangelista
Browse files

app test

parent 1a4ca8ed
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@ export default async function injectInitialData() {
createUserFixture(Users.user2),
createUserFixture(Users.user3),
createUserFixture(Users.userE2EE),
createUserFixture(Users.userNotAllowedByApp),
];
await Promise.all(
......
......@@ -3,7 +3,7 @@ import { request } from '@playwright/test';
import { Users } from './userStates';
import { BASE_API_URL, BASE_URL } from '../config/constants';
const APP_URL = 'https://github.com/RocketChat/Apps.RocketChat.Tester/blob/master/dist/appsrocketchattester_0.1.0.zip?raw=true';
const APP_URL = 'https://github.com/RocketChat/Apps.RocketChat.Tester/blob/master/dist/appsrocketchattester_0.2.0.zip?raw=true';
export default async function insertApp(): Promise<void> {
const api = await request.newContext();
......
......@@ -120,6 +120,7 @@ export const Users = {
user1: generateContext('user1'),
user2: generateContext('user2'),
user3: generateContext('user3'),
userNotAllowedByApp: generateContext('userNotAllowedByApp'),
userE2EE: generateContext('userE2EE'),
samluser1: generateContext('samluser1'),
samluser2: generateContext('samluser2'),
......
import { Users } from './fixtures/userStates';
import { HomeChannel } from './page-objects';
import { HomeChannel, Utils } from './page-objects';
import { Directory } from './page-objects/directory';
import { createTargetChannel } from './utils';
import { test, expect } from './utils/test';
......@@ -9,23 +9,28 @@ test.use({ storageState: Users.user1.state });
test.describe('Preview public channel', () => {
let poHomeChannel: HomeChannel;
let poDirectory: Directory;
let poUtils: Utils;
let targetChannel: string;
test.beforeEach(async ({ page, api }) => {
poHomeChannel = new HomeChannel(page);
targetChannel = await createTargetChannel(api);
poDirectory = new Directory(page);
poUtils = new Utils(page);
await page.goto('/home');
});
test.afterEach(async ({ api }) => {
await api.post('/channels.delete', { roomName: targetChannel });
});
test.describe('without preview public room permission', () => {
test.beforeAll(async ({ api }) => {
await api.post('/permissions.update', { permissions: [{ _id: 'preview-c-room', roles: ['admin'] }] });
});
test.afterAll(async ({ api }) => {
await api.post('/channels.delete', { roomName: targetChannel });
await api.post('/permissions.update', { permissions: [{ _id: 'preview-c-room', roles: ['admin', 'user', 'anonymous'] }] });
});
......@@ -35,5 +40,17 @@ test.describe('Preview public channel', () => {
expect(poHomeChannel.content.btnJoinChannel).toBeVisible;
});
test.describe('apps', () => {
test.use({ storageState: Users.userNotAllowedByApp.state });
test('should prevent user from join the room', async () => {
await poHomeChannel.sidenav.openDirectory();
await poDirectory.openChannel(targetChannel);
await poHomeChannel.content.btnJoinChannel.click();
expect(poUtils.getAlertByText('TEST OF NOT ALLOWED USER')).toBeVisible;
});
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment