Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/meteor/tests/e2e/account-profile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ test.describe.serial('settings-account-profile', () => {
await poAccountProfile.security2FASection.click();
await expect(poAccountProfile.email2FASwitch).toBeVisible();
await poAccountProfile.email2FASwitch.click();
await expect(poHomeChannel.toastSuccess).toBeVisible();
await poHomeChannel.dismissToast();
await poHomeChannel.toastMessage.waitForDisplay();
await poHomeChannel.toastMessage.dismissToast();

await poAccountProfile.email2FASwitch.click();
await expect(poHomeChannel.toastSuccess).toBeVisible();
await poHomeChannel.toastMessage.waitForDisplay();
});
});

Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/tests/e2e/admin-users-custom-fields.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ test.describe('Admin users custom fields', () => {

await test.step('should save user custom fields', async () => {
await poAdmin.editUser.btnSaveUser.click();
await poHomeChannel.dismissToast();
await poHomeChannel.toastMessage.dismissToast();
await poAdmin.editUser.close();
});

Expand Down Expand Up @@ -115,7 +115,7 @@ test.describe('Admin users custom fields', () => {

await test.step('should save and verify partial update', async () => {
await poAdmin.editUser.btnSaveUser.click();
await poHomeChannel.dismissToast();
await poHomeChannel.toastMessage.dismissToast();

await poAdmin.editUser.close();
await poAdmin.getUserRowByUsername(updateTestUser.data.username).click();
Expand Down
9 changes: 2 additions & 7 deletions apps/meteor/tests/e2e/admin-users-role-management.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { Users } from './fixtures/userStates';
import { AdminUsers } from './page-objects';
import { ToastBar } from './page-objects/toastBar';
import { test, expect } from './utils/test';
import type { ITestUser } from './utils/user-helpers';
import { createTestUser } from './utils/user-helpers';

let userWithoutAdminAccess: ITestUser;
let userWithAdminAccess: ITestUser;
let admin: AdminUsers;
let poToastBar: ToastBar;

test.describe('Admin > Users Role Management', () => {
test.beforeAll('Create test users', async ({ api }) => {
Expand All @@ -26,7 +24,6 @@ test.describe('Admin > Users Role Management', () => {

test.beforeEach('Go to /admin/users', async ({ page }) => {
admin = new AdminUsers(page);
poToastBar = new ToastBar(page);
await page.goto('/admin/users');
});

Expand All @@ -41,8 +38,7 @@ test.describe('Admin > Users Role Management', () => {

await test.step('make a user admin', async () => {
await admin.dispatchUserAction(userWithoutAdminAccess.data.username, 'Make Admin');
await expect(poToastBar.alert).toBeVisible();
await expect(poToastBar.alert).toHaveText('User is now an admin');
await admin.toastMessage.waitForDisplay({ type: 'success', message: 'User is now an admin' });
});

await test.step('verify user is admin', async () => {
Expand All @@ -61,8 +57,7 @@ test.describe('Admin > Users Role Management', () => {

await test.step('remove admin role', async () => {
await admin.dispatchUserAction(userWithAdminAccess.data.username, 'Remove Admin');
await expect(poToastBar.alert).toBeVisible();
await expect(poToastBar.alert).toHaveText('User is no longer an admin');
await admin.toastMessage.waitForDisplay({ type: 'success', message: 'User is no longer an admin' });
});

await test.step('verify user role as admin is removed', async () => {
Expand Down
6 changes: 3 additions & 3 deletions apps/meteor/tests/e2e/channel-management.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test.describe.serial('channel-management', () => {
await poHomeChannel.tabs.room.inputTopic.fill('hello-topic-edited');
await poHomeChannel.tabs.room.btnSave.click();

await poHomeChannel.dismissToast();
await poHomeChannel.toastMessage.dismissToast();
await poHomeChannel.roomToolbar.openRoomInfo();
await expect(page.getByRole('heading', { name: 'hello-topic-edited' })).toBeVisible();
await expect(page.getByRole('dialog', { name: 'Channel info' })).toContainText('hello-topic-edited');
Expand All @@ -76,7 +76,7 @@ test.describe.serial('channel-management', () => {
await poHomeChannel.tabs.room.inputAnnouncement.fill('hello-announcement-edited');
await poHomeChannel.tabs.room.btnSave.click();

await poHomeChannel.dismissToast();
await poHomeChannel.toastMessage.dismissToast();
await poHomeChannel.roomToolbar.openRoomInfo();
await expect(page.getByRole('dialog', { name: 'Channel info' })).toContainText('hello-announcement-edited');
await expect(poHomeChannel.content.getSystemMessageByText('changed room announcement to: hello-announcement-edited')).toBeVisible();
Expand All @@ -89,7 +89,7 @@ test.describe.serial('channel-management', () => {
await poHomeChannel.tabs.room.inputDescription.fill('hello-description-edited');
await poHomeChannel.tabs.room.btnSave.click();

await poHomeChannel.dismissToast();
await poHomeChannel.toastMessage.dismissToast();
await poHomeChannel.roomToolbar.openRoomInfo();
await expect(page.getByRole('dialog', { name: 'Channel info' })).toContainText('hello-description-edited');
await expect(poHomeChannel.content.getSystemMessageByText('changed room description to: hello-description-edited')).toBeVisible();
Expand Down
6 changes: 1 addition & 5 deletions apps/meteor/tests/e2e/delete-account.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { DEFAULT_USER_CREDENTIALS } from './config/constants';
import { AccountProfile, Registration, Authenticated } from './page-objects';
import { ToastBar } from './page-objects/toastBar';
import { test, expect } from './utils/test';
import { createTestUser, type ITestUser } from './utils/user-helpers';

test.describe('Delete Own Account', () => {
let poAccountProfile: AccountProfile;
let poRegistration: Registration;
let poToastBar: ToastBar;
let poAuth: Authenticated;
let userToDelete: ITestUser;
let userWithInvalidPassword: ITestUser;
Expand All @@ -24,7 +22,6 @@ test.describe('Delete Own Account', () => {
test.beforeEach(async ({ page }) => {
poAccountProfile = new AccountProfile(page);
poRegistration = new Registration(page);
poToastBar = new ToastBar(page);
poAuth = new Authenticated(page);
await page.goto('/home');
});
Expand Down Expand Up @@ -67,8 +64,7 @@ test.describe('Delete Own Account', () => {
});

await test.step('verify error message appears', async () => {
await expect(poToastBar.alert).toBeVisible();
await expect(poToastBar.alert).toHaveText('Invalid password [error-invalid-password]');
await poAccountProfile.toastMessage.waitForDisplay({ type: 'error', message: 'Invalid password [error-invalid-password]' });
});

await test.step('verify user is still on the profile page', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ test.describe('E2EE Encrypted Channels', () => {
await poHomeChannel.tabs.btnDisableE2E.click({ force: true });
await expect(page.getByRole('dialog', { name: 'Disable encryption' })).toBeVisible();
await page.getByRole('button', { name: 'Disable encryption' }).click();
await poHomeChannel.dismissToast();
await poHomeChannel.toastMessage.dismissToast();
await page.waitForTimeout(1000);

await poHomeChannel.content.sendMessage('hello world not encrypted');
Expand All @@ -65,7 +65,7 @@ test.describe('E2EE Encrypted Channels', () => {
await poHomeChannel.tabs.btnEnableE2E.click({ force: true });
await expect(page.getByRole('dialog', { name: 'Enable encryption' })).toBeVisible();
await page.getByRole('button', { name: 'Enable encryption' }).click();
await poHomeChannel.dismissToast();
await poHomeChannel.toastMessage.dismissToast();
await page.waitForTimeout(1000);

await poHomeChannel.content.sendMessage('hello world encrypted again');
Expand Down Expand Up @@ -138,9 +138,8 @@ test.describe('E2EE Encrypted Channels', () => {

await expect(page).toHaveURL(`/group/${channelName}`);

await expect(poHomeChannel.toastSuccess).toBeVisible();

await poHomeChannel.dismissToast();
await poHomeChannel.toastMessage.waitForDisplay();
await poHomeChannel.toastMessage.dismissToast();

await poHomeChannel.tabs.kebab.click();
// TODO(@jessicaschelly/@dougfabris): fix this flaky behavior
Expand Down Expand Up @@ -236,8 +235,8 @@ test.describe('E2EE Encrypted Channels', () => {
await poHomeChannel.sidenav.inputChannelName.fill(channelName);
await poHomeChannel.sidenav.btnCreate.click();
await expect(page).toHaveURL(`/group/${channelName}`);
await expect(poHomeChannel.toastSuccess).toBeVisible();
await poHomeChannel.dismissToast();
await poHomeChannel.toastMessage.waitForDisplay();
await poHomeChannel.toastMessage.dismissToast();

// Send Unencrypted Messages
await poHomeChannel.content.sendMessage('first unencrypted message');
Expand Down Expand Up @@ -291,15 +290,15 @@ test.describe('E2EE Encrypted Channels', () => {
await poHomeChannel.content.openLastMessageMenu();
await page.locator('role=menuitem[name="Star"]').click();

await expect(poHomeChannel.toastSuccess).toBeVisible();
await poHomeChannel.dismissToast();
await poHomeChannel.toastMessage.waitForDisplay();
await poHomeChannel.toastMessage.dismissToast();

await poHomeChannel.content.openLastMessageMenu();
await page.locator('role=menuitem[name="Pin"]').click();
await page.locator('#modal-root >> button:has-text("Yes, pin message")').click();

await expect(poHomeChannel.toastSuccess).toBeVisible();
await poHomeChannel.dismissToast();
await poHomeChannel.toastMessage.waitForDisplay();
await poHomeChannel.toastMessage.dismissToast();

await poHomeChannel.tabs.kebab.click();
await poHomeChannel.tabs.btnPinnedMessagesList.click();
Expand Down
4 changes: 2 additions & 2 deletions apps/meteor/tests/e2e/e2e-encryption/e2ee-otr.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test.describe('E2EE OTR (Off-The-Record)', () => {
await poHomeChannel.tabs.btnDisableE2E.click({ force: true });
await expect(page.getByRole('dialog', { name: 'Disable encryption' })).toBeVisible();
await page.getByRole('button', { name: 'Disable encryption' }).click();
await poHomeChannel.dismissToast();
await poHomeChannel.toastMessage.dismissToast();
await poHomeChannel.tabs.kebab.click({ force: true });
}
await expect(poHomeChannel.tabs.btnEnableE2E).toBeVisible();
Expand All @@ -56,7 +56,7 @@ test.describe('E2EE OTR (Off-The-Record)', () => {

await expect(poHomeChannel.content.encryptedRoomHeaderIcon).toBeVisible();

await poHomeChannel.dismissToast();
await poHomeChannel.toastMessage.dismissToast();

await poHomeChannel.tabs.kebab.click({ force: true });
await expect(poHomeChannel.tabs.btnEnableOTR).toBeVisible();
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/tests/e2e/enforce-2FA.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ test.describe('enforce two factor authentication', () => {
await expect(poAccountProfile.email2FASwitch).toBeVisible();
await poAccountProfile.email2FASwitch.click();

await expect(poHomeChannel.toastSuccess).toBeVisible();
await poHomeChannel.toastMessage.waitForDisplay();
await expect(poHomeChannel.sidenav.sidebarHomeAction).toBeVisible();
await expect(poAccountProfile.securityHeader).not.toBeVisible();
});
Expand Down
13 changes: 4 additions & 9 deletions apps/meteor/tests/e2e/federation/page-objects/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Locator, Page } from '@playwright/test';
import { FederationHomeContent } from './fragments/home-content';
import { FederationHomeFlextab } from './fragments/home-flextab';
import { FederationSidenav } from './fragments/home-sidenav';
import { RoomToolbar } from '../../page-objects/fragments/toolbar';
import { RoomToolbar, ToastMessages } from '../../page-objects/fragments';

export class FederationChannel {
private readonly page: Page;
Expand All @@ -16,20 +16,15 @@ export class FederationChannel {

readonly roomToolbar: RoomToolbar;

readonly toastMessage: ToastMessages;

constructor(page: Page) {
this.page = page;
this.content = new FederationHomeContent(page);
this.sidenav = new FederationSidenav(page);
this.tabs = new FederationHomeFlextab(page);
this.roomToolbar = new RoomToolbar(page);
}

get toastSuccess(): Locator {
return this.page.locator('.rcx-toastbar.rcx-toastbar--success');
}

get toastError(): Locator {
return this.page.locator('.rcx-toastbar.rcx-toastbar--error');
this.toastMessage = new ToastMessages(page);
}

get btnContextualbarClose(): Locator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ test.describe.parallel('Federation - CE version', () => {

test('expect to not be able to create DMs from UI inviting external users (an user who does not exists on the server yet)', async () => {
await poFederationChannelServer2.createDirectMessagesUsingModal([fullUsernameFromServer1]);
await expect(poFederationChannelServer2.toastError).toBeVisible();
await poFederationChannelServer2.toastMessage.waitForDisplay({ type: 'error' });
});

test('expect to not be able to create DMs from UI inviting external users (an user who already exists in the server)', async ({
Expand All @@ -66,7 +66,7 @@ test.describe.parallel('Federation - CE version', () => {
server: constants.RC_SERVER_1,
});
await poFederationChannelServer2.createDirectMessagesUsingModal([fullUsernameFromServer1]);
await expect(poFederationChannelServer2.toastError).toBeVisible();
await poFederationChannelServer2.toastMessage.waitForDisplay({ type: 'error' });
});

test('expect to not be able to invite federated users to non-federated rooms (using modal)', async () => {
Expand Down
10 changes: 5 additions & 5 deletions apps/meteor/tests/e2e/federation/tests/channel/private.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ test.describe.parallel('Federation - Group Creation', () => {
await poFederationChannelServer1.roomToolbar.openMembersTab();
await poFederationChannelServer1.tabs.members.showAllUsers();
await poFederationChannelServer1.tabs.members.addMultipleUsers([fullUsernameFromServer2]);
await expect(poFederationChannelServer1.toastSuccess).toBeVisible();
await poFederationChannelServer1.toastMessage.waitForDisplay();

await poFederationChannelServer2.sidenav.openChat(groupName);
await poFederationChannelServer2.roomToolbar.openMembersTab();
Expand Down Expand Up @@ -487,7 +487,7 @@ test.describe.parallel('Federation - Group Creation', () => {
await poFederationChannelServer1.roomToolbar.openMembersTab();
await poFederationChannelServer1.tabs.members.showAllUsers();
await poFederationChannelServer1.tabs.members.addMultipleUsers([userFromServer2UsernameOnly]);
await expect(poFederationChannelServer1.toastSuccess).toBeVisible();
await poFederationChannelServer1.toastMessage.waitForDisplay();

await poFederationChannelServer2.sidenav.openChat(groupName);
await poFederationChannelServer2.roomToolbar.openMembersTab();
Expand Down Expand Up @@ -549,7 +549,7 @@ test.describe.parallel('Federation - Group Creation', () => {
await poFederationChannelServer1.roomToolbar.openMembersTab();
await poFederationChannelServer1.tabs.members.showAllUsers();
await poFederationChannelServer1.tabs.members.addMultipleUsers([fullUsernameFromServer2, userFromServer1UsernameOnly]);
await expect(poFederationChannelServer1.toastSuccess).toBeVisible();
await poFederationChannelServer1.toastMessage.waitForDisplay();

await poFederationChannelServer2.sidenav.openChat(createdGroup);
await poFederationChannelServer2.roomToolbar.openMembersTab();
Expand Down Expand Up @@ -641,7 +641,7 @@ test.describe.parallel('Federation - Group Creation', () => {
await poFederationChannelServer1.roomToolbar.openMembersTab();
await poFederationChannelServer1.tabs.members.showAllUsers();
await poFederationChannelServer1.tabs.members.addMultipleUsers([userFromServer1UsernameOnly, userFromServer2UsernameOnly]);
await expect(poFederationChannelServer1.toastSuccess).toBeVisible();
await poFederationChannelServer1.toastMessage.waitForDisplay();

await poFederationChannelServer2.sidenav.openChat(createdGroup);
await poFederationChannelServer2.roomToolbar.openMembersTab();
Expand Down Expand Up @@ -704,7 +704,7 @@ test.describe.parallel('Federation - Group Creation', () => {
await poFederationChannelServer1.tabs.members.showAllUsers();
await poFederationChannelServer1.tabs.members.addMultipleUsers([userFromServer1UsernameOnly]);

await expect(poFederationChannelServer1.toastSuccess).toBeVisible();
await poFederationChannelServer1.toastMessage.waitForDisplay();

await expect(poFederationChannelServer1.tabs.members.getUserInList(userFromServer1UsernameOnly)).toBeVisible();
await expect(poFederationChannelServer1.tabs.members.getUserInList(constants.RC_SERVER_1.username)).toBeVisible();
Expand Down
10 changes: 5 additions & 5 deletions apps/meteor/tests/e2e/federation/tests/channel/public.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ test.describe.parallel('Federation - Channel Creation', () => {
await poFederationChannelServer1.roomToolbar.openMembersTab();
await poFederationChannelServer1.tabs.members.showAllUsers();
await poFederationChannelServer1.tabs.members.addMultipleUsers([fullUsernameFromServer2]);
await expect(poFederationChannelServer1.toastSuccess).toBeVisible();
await poFederationChannelServer1.toastMessage.waitForDisplay();

await poFederationChannelServer2.sidenav.openChat(channelName);
await poFederationChannelServer2.roomToolbar.openMembersTab();
Expand Down Expand Up @@ -490,7 +490,7 @@ test.describe.parallel('Federation - Channel Creation', () => {
await poFederationChannelServer1.roomToolbar.openMembersTab();
await poFederationChannelServer1.tabs.members.showAllUsers();
await poFederationChannelServer1.tabs.members.addMultipleUsers([userFromServer2UsernameOnly]);
await expect(poFederationChannelServer1.toastSuccess).toBeVisible();
await poFederationChannelServer1.toastMessage.waitForDisplay();

await poFederationChannelServer2.sidenav.openChat(channelName);
await poFederationChannelServer2.roomToolbar.openMembersTab();
Expand Down Expand Up @@ -552,7 +552,7 @@ test.describe.parallel('Federation - Channel Creation', () => {
await poFederationChannelServer1.roomToolbar.openMembersTab();
await poFederationChannelServer1.tabs.members.showAllUsers();
await poFederationChannelServer1.tabs.members.addMultipleUsers([fullUsernameFromServer2, userFromServer1UsernameOnly]);
await expect(poFederationChannelServer1.toastSuccess).toBeVisible();
await poFederationChannelServer1.toastMessage.waitForDisplay();

await poFederationChannelServer2.sidenav.openChat(createdChannel);
await poFederationChannelServer2.roomToolbar.openMembersTab();
Expand Down Expand Up @@ -644,7 +644,7 @@ test.describe.parallel('Federation - Channel Creation', () => {
await poFederationChannelServer1.roomToolbar.openMembersTab();
await poFederationChannelServer1.tabs.members.showAllUsers();
await poFederationChannelServer1.tabs.members.addMultipleUsers([userFromServer1UsernameOnly, userFromServer2UsernameOnly]);
await expect(poFederationChannelServer1.toastSuccess).toBeVisible();
await poFederationChannelServer1.toastMessage.waitForDisplay();

await poFederationChannelServer2.sidenav.openChat(createdChannel);
await poFederationChannelServer2.roomToolbar.openMembersTab();
Expand Down Expand Up @@ -707,7 +707,7 @@ test.describe.parallel('Federation - Channel Creation', () => {
await poFederationChannelServer1.tabs.members.showAllUsers();
await poFederationChannelServer1.tabs.members.addMultipleUsers([userFromServer1UsernameOnly]);

await expect(poFederationChannelServer1.toastSuccess).toBeVisible();
await poFederationChannelServer1.toastMessage.waitForDisplay();

await expect(poFederationChannelServer1.tabs.members.getUserInList(userFromServer1UsernameOnly)).toBeVisible();
await expect(poFederationChannelServer1.tabs.members.getUserInList(constants.RC_SERVER_1.username)).toBeVisible();
Expand Down
Loading
Loading