Skip to content
Open
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
3 changes: 3 additions & 0 deletions apps/webapp/test/e2e_tests/pageManager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ import {GuestLinkPasswordModal} from './webapp/modals/guestLinkPassword.modal';
import {ConversationJoinPage} from './webapp/pages/conversationJoin.page';
import {CreateConversationModal} from './webapp/modals/createConversation';
import {InviteModal} from './webapp/modals/invite.modal';
import {ConversationAccessModal} from './webapp/modals/conversationAccess.modal';

export const webAppPath = process.env.WEBAPP_URL ?? '';

Expand Down Expand Up @@ -220,6 +221,8 @@ export class PageManager {
optionModal: () => this.getOrCreate('webapp.modals.optionModal', () => new OptionModal(this.page)),
guestLinkPassword: () =>
this.getOrCreate('webapp.modals.guestLinkPassword', () => new GuestLinkPasswordModal(this.page)),
conversationAccess: () =>
this.getOrCreate('webapp.modals.conversationAccess', () => new ConversationAccessModal(this.page)),
createConversation: () =>
this.getOrCreate('webapp.modals.createConversation', () => CreateConversationModal(this.page)),
invite: () => this.getOrCreate('webapp.modals.invite', () => InviteModal(this.page)),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Wire
* Copyright (C) 2025 Wire Swiss GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/.
*
*/

import {Locator, Page} from '@playwright/test';

import {BaseModal} from './base.modal';

/** Modal shown when a link for guests to join a group conversation with a password is created */
export class ConversationAccessModal extends BaseModal {
readonly passwordInput: Locator;
readonly submitButton: Locator;
readonly joinForm: Locator;

constructor(page: Page) {
super(page, 'modal');

this.passwordInput = this.modal.getByRole('textbox', {name: 'Conversation password'});
this.submitButton = this.modal.getByRole('button', {name: 'Join conversation'});
this.joinForm = this.modal.getByTestId('guest-password-join-form');
}

async joinConversation(password: string) {
await this.passwordInput.fill(password);
await this.submitButton.click();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ import {BaseModal} from './base.modal';
export class GuestLinkPasswordModal extends BaseModal {
readonly setPasswordInput: Locator;
readonly confirmPasswordInput: Locator;
readonly errorMessage: Locator;

constructor(page: Page) {
super(page, 'modal-template-guest-link-password');

this.setPasswordInput = this.modal.getByRole('textbox', {name: 'Set password'});
this.confirmPasswordInput = this.modal.getByRole('textbox', {name: 'Confirm password'});
this.errorMessage = this.modal.getByTestId('primary-modals-error-message');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ export class ConversationDetailsPage {
await this.blockConversationButton.click();
}

async openGuestOptions() {
await this.guestOptionsButton.click();
}

async clickClearConversationContentButton() {
await this.clearConversationContentButton.click();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@ import {Page} from 'playwright/test';

/** Page shown to users using a guest link to join a group conversation */
export const ConversationJoinPage = (page: Page) => {
const joinBrowserButton = page.getByTestId('do-conversation-join-webapp');
const nameInput = page.getByRole('textbox', {name: 'Your name'});
const acceptTermsCheckBox = page.getByText(/I accept .* terms of use/i);
const joinAsGuestButton = page.getByRole('button', {name: 'Join as Temporary Guest'});

const joinAsGuest = async (name: string) => {
await page.getByRole('textbox', {name: 'Your name'}).fill(name);
await nameInput.fill(name);
// It's necessary to specify a position since the text contains a link which would be clicked instead of the checkbox
await page.getByText(/I accept .* terms of use/i).click({position: {x: 0, y: 8}});
await page.getByRole('button', {name: 'Join as Temporary Guest'}).click();
await acceptTermsCheckBox.click({position: {x: 0, y: 8}});
await joinAsGuestButton.click();
};

return {
joinAsGuest,
joinBrowserButton,
joinAsGuestButton,
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class GroupCreationPage {
readonly createGroupButton: Locator;
readonly addMembersButton: Locator;
readonly filesCheckbox: Locator;
readonly guestsToggle: Locator;

readonly searchPeopleInput: Locator;
readonly searchPeopleResults: Locator;
Expand All @@ -38,6 +39,7 @@ export class GroupCreationPage {
this.createGroupButton = page.locator('[data-uie-name="do-create-group"]');
this.addMembersButton = page.locator('[data-uie-name="do-create"]');
this.filesCheckbox = page.locator('[data-uie-name="do-toggle-cells"]');
this.guestsToggle = page.getByRole('button', {name: 'Guests', exact: true});

this.searchPeopleInput = page.getByRole('dialog').getByLabel('Search by name');
this.searchPeopleList = page.getByRole('dialog').getByRole('list');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ export const GuestOptionsPage = (page: Page) => {
const createPasswordModal = new GuestLinkPasswordModal(page);

const backButton = panel.getByRole('button', {name: 'Go back'});
const passwordSecuredRadioButton = panel.getByRole('radiogroup').getByText('Password secured');
const notPasswordSecuredRadioButton = panel.getByRole('radiogroup').getByText('Not password secured');
const passwordSecuredRadioButton = panel.getByRole('radiogroup').getByText('Password secured', {exact: true});
const notPasswordSecuredRadioButton = panel.getByRole('radiogroup').getByText('Not password secured', {exact: true});
const createLinkButton = panel.getByRole('button', {name: 'Create link'});
const revokeLinkButton = panel.getByRole('button', {name: 'Revoke link'});
const guestsToggle = panel.getByRole('button', {name: 'Allow Guests'});

const guestLink = panel.getByRole('button', {name: /https:\/\/.+\/conversation-join\//});

Expand All @@ -53,8 +55,24 @@ export const GuestOptionsPage = (page: Page) => {
return await guestLink.textContent();
};

const revokeLink = async () => {
await revokeLinkButton.click();
await new ConfirmModal(page).actionButton.click();
};

const toggleGuests = async () => {
await guestsToggle.click();
await new ConfirmModal(page).actionButton.click();
};

return {
backButton,
createLink,
revokeLink,
toggleGuests,
guestsToggle,
passwordSecuredRadioButton,
createLinkButton,
guestLink,
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,21 @@ export class ParticipantDetails {
readonly userPicture: Locator;
readonly userName: Locator;
readonly userStatus: Locator;
readonly userHandle: Locator;
readonly createGroup: Locator;
readonly block: Locator;
readonly closeButton: Locator;
readonly cancelRequest: Locator;
readonly unblockButton: Locator;
readonly removeFromGroupButton: Locator;
readonly openConversationButton: Locator;
readonly connectButton: Locator;

constructor(page: Page) {
this.page = page;
this.userPicture = this.page.getByTestId('status-profile-picture');
this.userName = this.page.locator('.panel-participant').getByTestId('status-name');
this.userHandle = this.page.locator('.panel-participant').getByTestId('status-username');
this.userStatus = this.page
.locator('#group-participant-user')
.getByTestId(/^status-(external|guest|admin)$/)
Expand All @@ -47,6 +51,8 @@ export class ParticipantDetails {
this.cancelRequest = this.page.getByRole('button', {name: 'Cancel request'});
this.unblockButton = this.page.getByRole('button', {name: 'Unblock'});
this.removeFromGroupButton = this.page.getByRole('button', {name: 'Remove from group'});
this.openConversationButton = this.page.getByRole('button', {name: 'Open conversation', exact: true});
this.connectButton = this.page.getByRole('button', {name: 'Connect'});
}

async blockUser() {
Expand All @@ -62,7 +68,7 @@ export class ParticipantDetails {
}

async sendConnectRequest() {
await this.page.getByRole('button', {name: 'Connect'}).click();
await this.connectButton.click();
}

async removeFromGroup() {
Expand Down
Loading
Loading