Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e785aaa
test(TC-657): add test for sending ephemeral text message in 1:1
markbrockhoff Nov 18, 2025
446efe5
test(TC-658): add test for sending ephemeral text message in group
markbrockhoff Nov 18, 2025
10342e1
refactor: replace util sendTimedMessage with dedicated utils for enab…
markbrockhoff Nov 19, 2025
c4704a3
test(TC-662): Verify timer is applied to all messages until turning i…
markbrockhoff Nov 19, 2025
dc77315
test(TC-664): Verify that message with previous timer are deleted on …
markbrockhoff Nov 19, 2025
3087753
refactor: overload createPage fixture to optionally accept a context …
markbrockhoff Nov 19, 2025
0755515
refactor: use team for tests using new fixture
markbrockhoff Nov 24, 2025
f3fa95a
test(TC-675): Verify the message is not deleted for users that didn't…
markbrockhoff Nov 24, 2025
9349474
test(TC-3715): set global group conversation timer
markbrockhoff Nov 24, 2025
630ef0e
refactor(reply-tests): remove unused createUser fixture
markbrockhoff Nov 24, 2025
272321c
test(TC-3716): check current time is visible in details
markbrockhoff Nov 24, 2025
c505581
fix(a11y): add disabled attribute to MessageTimerButton
markbrockhoff Nov 24, 2025
66c0db1
test(TC-3718): check timed message button is disabled if timed messag…
markbrockhoff Nov 24, 2025
e02ebce
test(TC-3719): globally set timer is shown on button next to input field
markbrockhoff Nov 24, 2025
aef3f3b
test(TC-3720): system messages are shown for enabled / disabled timer…
markbrockhoff Nov 24, 2025
8b06697
test(TC-3717): check ephemeral message appear in search results
markbrockhoff Nov 24, 2025
088a775
test(TC-3731): add test for message to disappear from search results …
markbrockhoff Nov 24, 2025
9e8c494
refactor: group search tests
markbrockhoff Nov 25, 2025
b2dfb6d
refactor: update search result tests to do assertions on receiver side
markbrockhoff Nov 25, 2025
a5bfa35
refactor: group tests with self deleting messages set globally for a …
markbrockhoff Nov 25, 2025
cb0a694
docs: add ticket number to comment for skipped test
markbrockhoff Nov 25, 2025
bd50454
docs: improve comments
markbrockhoff Nov 25, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const MessageTimerButton = ({conversation, teamState = container.resolve(TeamSta
onClick={isTimerDisabled ? undefined : onClick}
onKeyDown={handleContextKeyDown}
title={t('tooltipConversationEphemeral')}
disabled={isTimerDisabled}
data-uie-value={isTimerDisabled ? 'disabled' : 'enabled'}
data-uie-name="do-set-ephemeral-timer"
type="button"
Expand Down
21 changes: 14 additions & 7 deletions test/e2e_tests/pageManager/webapp/pages/conversation.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {Locator, Page} from '@playwright/test';

import {User} from 'test/e2e_tests/data/user';
import {downloadAssetAndGetFilePath} from 'test/e2e_tests/utils/asset.util';
import {selectById, selectByClass, selectByDataAttribute} from 'test/e2e_tests/utils/selector.util';
import {selectByClass, selectByDataAttribute} from 'test/e2e_tests/utils/selector.util';

import {ConfirmModal} from '../modals/confirm.modal';

Expand All @@ -40,6 +40,7 @@ export class ConversationPage {
readonly conversationTitle: Locator;
readonly watermark: Locator;
readonly timerMessageButton: Locator;
readonly timerOffButton: Locator;
readonly timerTenSecondsButton: Locator;
readonly openGroupInformationViaName: Locator;
readonly membersList: Locator;
Expand All @@ -52,7 +53,7 @@ export class ConversationPage {
readonly callButton: Locator;
readonly conversationInfoButton: Locator;
readonly pingButton: Locator;
readonly messages: Locator;
readonly messages: Locator; // Only contains message items which have been sent successfully
readonly messageDetails: Locator;
readonly messageItems: Locator;
readonly filesTab: Locator;
Expand Down Expand Up @@ -83,7 +84,8 @@ export class ConversationPage {
this.conversationTitle = page.locator('[data-uie-name="status-conversation-title-bar-label"]');
this.openGroupInformationViaName = page.locator(selectByDataAttribute('status-conversation-title-bar-label'));
this.timerMessageButton = page.locator(selectByDataAttribute('do-set-ephemeral-timer'));
this.timerTenSecondsButton = page.locator(selectById('btn-10-seconds'));
this.timerOffButton = page.getByRole('button', {name: 'Off'});
this.timerTenSecondsButton = page.getByRole('button', {name: '10 seconds'});
this.membersList = page.locator(selectByDataAttribute('list-members'));
this.adminsList = page.locator(selectByDataAttribute('list-admins'));
this.leaveConversationButton = page.locator(selectByDataAttribute('do-leave-item-text'));
Expand All @@ -98,7 +100,8 @@ export class ConversationPage {
this.pingButton = page.locator(selectByDataAttribute('do-ping'));
this.messageItems = page.locator(selectByDataAttribute('item-message'));
this.messages = page.locator(
`${selectByDataAttribute('item-message')} ${selectByClass('message-body')}:not(:has(p${selectByClass('text-foreground')})):has(${selectByClass('text')})`,
// The attribute 'send-status' indicates whether the optimistic update for sending the message was successful
`${selectByDataAttribute('item-message')}${selectByDataAttribute('2', 'send-status')}`,
);
this.messageDetails = page.locator('#message-details');
this.filesTab = page.locator('#conversation-tab-files');
Expand Down Expand Up @@ -171,10 +174,14 @@ export class ConversationPage {
await message.getByRole('group').getByTestId('do-reply-message').click();
}

async sendTimedMessage(message: string) {
async enableSelfDeletingMessages() {
await this.timerMessageButton.click();
await this.timerTenSecondsButton.click();
await this.sendMessage(message);
}

async disableSelfDeletingMessages() {
await this.timerMessageButton.click();
await this.timerOffButton.click();
}

async sendMessageWithUserMention(userFullName: string, messageText?: string) {
Expand Down Expand Up @@ -219,7 +226,7 @@ export class ConversationPage {
* @returns a Locator to the matching message(s)
*/
getMessage(options?: {content?: string | RegExp; sender?: User}): Locator {
let message = this.messageItems;
let message = this.messages;

if (options?.content) {
message = message.filter({hasText: options.content});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class ConversationDetailsPage {
readonly addPeopleButton: Locator;
readonly conversationDetails: Locator;
readonly guestOptionsButton: Locator;
readonly selfDeletingMessageButton: Locator;
readonly archiveButton: Locator;

constructor(page: Page) {
Expand All @@ -35,6 +36,7 @@ export class ConversationDetailsPage {
this.addPeopleButton = page.locator(`${selectByDataAttribute('go-add-people')}`);
this.conversationDetails = page.locator('#conversation-details');
this.guestOptionsButton = this.conversationDetails.locator('[data-uie-name="go-guest-options"]');
this.selfDeletingMessageButton = this.conversationDetails.getByRole('button', {name: 'Self-deleting messages'});
this.archiveButton = this.conversationDetails.locator(selectByDataAttribute('do-archive'));
}

Expand Down Expand Up @@ -102,6 +104,15 @@ export class ConversationDetailsPage {
await this.archiveButton.click();
}

/** Opens the self deleting messages panel, selects the given value and closes it again */
async setSelfDeletingMessages(value: 'Off' | '10 seconds') {
await this.selfDeletingMessageButton.click();
const selfDeletingMessagesPanel = this.page.locator('#timed-messages');
// I tried to use accessible locators but the radio options are currently not accessible
await selfDeletingMessagesPanel.getByRole('radiogroup').locator('label', {hasText: value}).click();
await selfDeletingMessagesPanel.getByRole('button', {name: 'Go back'}).click();
}

async addServiceToConversation(serviceName: string) {
// Click on the Services/Apps tab
const servicesTab = this.page.locator(
Expand Down
8 changes: 5 additions & 3 deletions test/e2e_tests/specs/Reply/reply.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test.describe('Reply', () => {
let userA: User;
let userB: User;

test.beforeEach(async ({createTeam, createUser}) => {
test.beforeEach(async ({createTeam}) => {
const team = await createTeam('Test Team', {withMembers: 1});
userA = team.owner;
userB = team.members[0];
Expand All @@ -49,7 +49,8 @@ test.describe('Reply', () => {
test('I should not be able to reply to timed messages', {tag: ['@TC-8039', '@regression']}, async ({createPage}) => {
const pages = (await PageManager.from(createPage(withLogin(userA), withConnectedUser(userB)))).webapp.pages;

await pages.conversation().sendTimedMessage('Gone in 10s');
await pages.conversation().enableSelfDeletingMessages();
await pages.conversation().sendMessage('Gone in 10s');
const message = pages.conversation().getMessage({content: 'Gone in 10s'});
await message.hover();

Expand Down Expand Up @@ -251,7 +252,8 @@ test.describe('Reply', () => {

const message = pages.conversation().getMessage({sender: userA});
await pages.conversation().replyToMessage(message);
await pages.conversation().sendTimedMessage('Timed Reply');
await pages.conversation().enableSelfDeletingMessages();
await pages.conversation().sendMessage('Timed Reply');

const reply = pages.conversation().getMessage({content: 'Timed Reply'});
await expect(reply.getByTestId('quote-item')).toContainText('Message');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,248 @@
/*
* 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} from '@playwright/test';

import {User} from 'test/e2e_tests/data/user';
import {PageManager} from 'test/e2e_tests/pageManager';
import {test, expect, withLogin, withConnectedUser} from 'test/e2e_tests/test.fixtures';
import {createGroup} from 'test/e2e_tests/utils/userActions';

test.describe('Self Deleting Messages', () => {
let userA: User;
let userB: User;

test.beforeEach(async ({createTeam}) => {
const team = await createTeam('Test Team', {withMembers: 1});
userA = team.owner;
userB = team.members[0];
});

test('Verify sending ephemeral text message in 1:1', {tag: ['@TC-657', '@regression']}, async ({createPage}) => {
const [userAPage, userBPage] = await Promise.all([
createPage(withLogin(userA), withConnectedUser(userB)),
createPage(withLogin(userB), withConnectedUser(userA)),
]);
const userAPages = PageManager.from(userAPage).webapp.pages;
const userBPages = PageManager.from(userBPage).webapp.pages;

await userAPages.conversation().enableSelfDeletingMessages();
await userAPages.conversation().sendMessage('Gone in 10s');
await expect(userBPages.conversation().getMessage({content: 'Gone in 10s'})).toBeVisible();

await userBPage.waitForTimeout(10_000); // Wait for 10s so the message is deleted
await expect(userAPages.conversation().getMessage({content: 'Gone in 10s'})).not.toBeVisible();
await expect(userBPages.conversation().getMessage({content: 'Gone in 10s'})).not.toBeVisible();
});

test('Verify sending ephemeral text message in group', {tag: ['@TC-658', '@regression']}, async ({createPage}) => {
const [userAPage, userBPage] = await Promise.all([createPage(withLogin(userA)), createPage(withLogin(userB))]);
const userAPages = PageManager.from(userAPage).webapp.pages;
const userBPages = PageManager.from(userBPage).webapp.pages;

await createGroup(userAPages, 'Test Group', [userB]);
await userBPages.conversationList().openConversation('Test Group');

await userAPages.conversation().enableSelfDeletingMessages();
await userAPages.conversation().sendMessage('Gone in 10s');
await expect(userBPages.conversation().getMessage({content: 'Gone in 10s'})).toBeVisible();

await userBPage.waitForTimeout(10_000); // Wait for 10s so the message is deleted
await expect(userAPages.conversation().getMessage({content: 'Gone in 10s'})).not.toBeVisible();
await expect(userBPages.conversation().getMessage({content: 'Gone in 10s'})).not.toBeVisible();
});

test(
'Verify timer is applied to all messages until turning it off in 1:1',
{tag: ['@TC-662', '@regression']},
async ({createPage}) => {
const page = await createPage(withLogin(userA), withConnectedUser(userB));
const pages = PageManager.from(page).webapp.pages;

await pages.conversation().enableSelfDeletingMessages();
await pages.conversation().sendMessage('First Message');
await pages.conversation().sendMessage('Second Message');

await pages.conversation().disableSelfDeletingMessages();
await pages.conversation().sendMessage('Third Message');

const firstMessage = pages.conversation().getMessage({content: 'First Message'});
const secondMessage = pages.conversation().getMessage({content: 'Second Message'});
const thirdMessage = pages.conversation().getMessage({content: 'Third Message'});
await expect(firstMessage).toBeVisible();
await expect(secondMessage).toBeVisible();
await expect(thirdMessage).toBeVisible();

await page.waitForTimeout(10_000);
await expect(firstMessage).not.toBeVisible();
await expect(secondMessage).not.toBeVisible();
await expect(thirdMessage).toBeVisible(); // Third message should still be visible since the timer was turned off before sending it
},
);

test(
'Verify that message with previous timer are deleted on start-up when the timeout passed in 1:1',
{tag: ['@TC-664', '@regression']},
async ({context, createPage}) => {
let page = await createPage(context, withLogin(userA), withConnectedUser(userB));
let pages = PageManager.from(page).webapp.pages;

await pages.conversation().enableSelfDeletingMessages();
await pages.conversation().sendMessage('Test Message');
await expect(pages.conversation().getMessage({sender: userA})).toBeVisible(); // Ensure message was sent before closing the page

await page.close();
await new Promise(res => setTimeout(res, 10_000)); // Wait 10s before logging in again to ensure the message has been deleted by now

// Re-open page reusing the same context so the login is not happening on a new device
page = await createPage(context, withLogin(userA));
pages = PageManager.from(page).webapp.pages;
await pages.conversationList().openConversation(userB.fullName);

const selfDeletingMessage = pages.conversation().getMessage({sender: userA});
await expect(selfDeletingMessage).toBeVisible();
await expect(selfDeletingMessage).not.toContainText('Test Message');
},
);

test(
"Verify the message is not deleted for users that didn't read the message",
{tag: ['@TC-675', '@regression']},
async ({createPage}) => {
const [userAPage, userBPage] = await Promise.all([
createPage(withLogin(userA), withConnectedUser(userB)),
createPage(withLogin(userB), withConnectedUser(userA)),
]);
const [userAPages, userBPages] = [userAPage, userBPage].map(page => PageManager.from(page).webapp.pages);
await createGroup(userAPages, 'Test Group', [userB]);

await userAPages.conversationList().openConversation('Test Group');
await userBPages.conversationList().openConversation(userA.fullName); // User B should not read the message sent into the group immediately

await userAPages.conversation().enableSelfDeletingMessages();
await userAPages.conversation().sendMessage('Test Message');
await expect(userAPages.conversation().getMessage({sender: userA})).toBeVisible();

await userBPage.waitForTimeout(10_000); // Wait 10s before user B opens the group chat

await userBPages.conversationList().openConversation('Test Group');
await expect(userBPages.conversation().getMessage({content: 'Test Message'})).toBeVisible();
},
);

test.describe('set globally in group conversation', () => {
let userAPages: PageManager['webapp']['pages'];
let userBPages: PageManager['webapp']['pages'];

test.beforeEach(async ({createPage}) => {
[userAPages, userBPages] = await Promise.all([
PageManager.from(createPage(withLogin(userA))).then(pm => pm.webapp.pages),
PageManager.from(createPage(withLogin(userB))).then(pm => pm.webapp.pages),
]);
await createGroup(userAPages, 'Test Group', [userB]);

await userAPages.conversationList().openConversation('Test Group');
await userBPages.conversationList().openConversation('Test Group');

await userAPages.conversation().toggleGroupInformation();
await userAPages.conversationDetails().setSelfDeletingMessages('10 seconds');
await userAPages.conversation().toggleGroupInformation();
});

test('I want to set a global group conversation timer', {tag: ['@TC-3715', '@regression']}, async () => {
await userAPages.conversation().sendMessage('Message');
const message = userBPages.conversation().getMessage({content: 'Message'});
await expect(message).toBeAttached();

await new Promise(res => setTimeout(res, 10_000));
await expect(message).not.toBeAttached();
});

test('I want to see the current timer in conversation details', {tag: ['@TC-3716', '@regression']}, async () => {
await userBPages.conversation().toggleGroupInformation();
await expect(userBPages.conversationDetails().selfDeletingMessageButton).toContainText('10 seconds');
});

test(
'I want to see timed message disable in an input bar when global settings conversation options are set',
{tag: ['@TC-3718', '@regression']},
async () => {
await expect(userBPages.conversation().timerMessageButton).toBeDisabled();
},
);

test(
'I want to see the ephemeral indicator is updated in the input field if someone sets a global timer in conversation options',
{tag: ['@TC-3719', '@regression']},
async () => {
await expect(userBPages.conversation().timerMessageButton).toContainText('s10');
},
);

test(
'I want to see a system message that a global timer was set or changed or removed in conversation options',
{tag: ['@TC-3720', '@regression']},
async () => {
const userBSystemMessages = userBPages.conversation().systemMessages;
await expect(userBSystemMessages.getByText('set the message timer to 10 seconds')).toBeAttached();

await userAPages.conversation().toggleGroupInformation();
await userAPages.conversationDetails().setSelfDeletingMessages('Off');
await expect(userBSystemMessages.getByText('turned off the message timer')).toBeAttached();
},
);
});

test.describe('in search results', () => {
let searchResults: Locator;

test.beforeEach(async ({createPage}) => {
const [userAPages, userBPages] = await Promise.all([
PageManager.from(createPage(withLogin(userA), withConnectedUser(userB))).then(pm => pm.webapp.pages),
PageManager.from(createPage(withLogin(userB), withConnectedUser(userA))).then(pm => pm.webapp.pages),
]);

await userAPages.conversation().enableSelfDeletingMessages();
await userAPages.conversation().sendMessage('Test');
await expect(userBPages.conversation().getMessage({content: 'Test'})).toBeVisible();

await userBPages.conversation().searchButton.click();
await userBPages.collection().searchForMessages('Test');
searchResults = userBPages.collection().searchItems;
});

test('I want to see ephemeral messages in the search results', {tag: ['@TC-3717', '@regression']}, async () => {
await expect(searchResults).toHaveCount(1);
await expect(searchResults).toContainText('Test');
});

// WPB-21980 - Currently the message isn't removed from the search results after its specified lifetime
test.skip(
'I want to to see ephemeral messages disappear from search results when their timer runs out',
{tag: ['@TC-3731', '@regression']},
async () => {
await expect(searchResults).toHaveCount(1);

await new Promise(res => setTimeout(res, 10_000)); // Wait 10s for the message to expire

await expect(searchResults).toHaveCount(0);
},
);
});
});
Loading
Loading