The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/tests/e2e/anonymous-user.spec.ts

46 lines
1.6 KiB

import { faker } from '@faker-js/faker';
import { HomeChannel, Registration } from './page-objects';
import { setSettingValueById } from './utils/setSettingValueById';
import { expect, test } from './utils/test';
test.describe('anonymous-user', () => {
let poHomeChannel: HomeChannel;
test.beforeAll(async ({ api }) => {
await expect((await setSettingValueById(api, 'Accounts_AllowAnonymousRead', true)).status()).toBe(200);
await expect((await setSettingValueById(api, 'Accounts_AllowAnonymousWrite', true)).status()).toBe(200);
});
test.afterAll(async ({ api }) => {
await expect((await setSettingValueById(api, 'Accounts_AllowAnonymousRead', false)).status()).toBe(200);
await expect((await setSettingValueById(api, 'Accounts_AllowAnonymousWrite', false)).status()).toBe(200);
});
test.beforeEach(async ({ page }) => {
poHomeChannel = new HomeChannel(page);
await page.goto('/home');
await poHomeChannel.sidenav.openChat('general');
});
test('expect to go to the login page as anonymous user', async ({ page }) => {
await poHomeChannel.content.btnAnonymousSignIn.click();
await expect(page.locator('role=form')).toBeVisible();
});
test('expect to chat as anonymous user', async ({ page }) => {
poHomeChannel = new HomeChannel(page);
const poRegistration = new Registration(page);
await poHomeChannel.content.btnAnonymousTalk.click();
await expect(poRegistration.username).toBeVisible();
await poRegistration.username.type(faker.internet.userName());
await poRegistration.btnRegisterConfirmUsername.click();
await poHomeChannel.content.sendMessage('hello world');
});
});