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
2 changes: 1 addition & 1 deletion run/test/specs/group_disappearing_messages_image.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ androidIt('Disappearing image message to group', 'low', disappearingImageMessage
async function disappearingImageMessageGroup(platform: SupportedPlatformsType) {
const { device1, device2, device3 } = await openAppThreeDevices(platform);
const testMessage = 'Testing disappearing messages for images';
const testGroupName = 'Test group';
const testGroupName = 'Testing disappearing messages';
const time = DISAPPEARING_TIMES.THIRTY_SECONDS;
const timerType = 'Disappear after send option';
// Create user A and user B
Expand Down
2 changes: 1 addition & 1 deletion run/test/specs/group_disappearing_messages_link.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const time = DISAPPEARING_TIMES.THIRTY_SECONDS;

async function disappearingLinkMessageGroup(platform: SupportedPlatformsType) {
const { device1, device2, device3 } = await openAppThreeDevices(platform);
const testGroupName = 'Test group';
const testGroupName = 'Testing disappearing messages';
const testLink = `https://getsession.org/`;
// Create user A and user B
const [userA, userB, userC] = await Promise.all([
Expand Down
41 changes: 41 additions & 0 deletions run/test/specs/group_disappearing_messages_members.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { bothPlatformsIt } from '../../types/sessionIt';
import { openAppThreeDevices, SupportedPlatformsType, closeApp } from './utils/open_app';
import { newUser } from './utils/create_account';
import { DISAPPEARING_TIMES, USERNAME } from '../../types/testing';
import { createGroup } from './utils/create_group';
import { ConversationSettings } from './locators/conversation';
import {
DisappearingMessageRadial,
DisappearingMessagesMenuOption,
SetDisappearMessagesButton,
} from './locators/disappearing_messages';

bothPlatformsIt('Group member disappearing messages', 'medium', membersCantSetDisappearingMessages);

async function membersCantSetDisappearingMessages(platform: SupportedPlatformsType) {
const { device1, device2, device3 } = await openAppThreeDevices(platform);
const testGroupName = 'Testing disappearing messages';
// Create user A, B and C
const [userA, userB, userC] = await Promise.all([
newUser(device1, USERNAME.ALICE),
newUser(device2, USERNAME.BOB),
newUser(device3, USERNAME.CHARLIE),
]);
// A creates group with B and C
await createGroup(platform, device1, userA, device2, userB, device3, userC, testGroupName);
// Member B navigates to DM settings
await device2.clickOnElementAll(new ConversationSettings(device2));
await device2.clickOnElementAll(new DisappearingMessagesMenuOption(device2));
// On iOS, the Set button becomes visible after an admin clicks on a timer option
// This is a 'fake' click on a disabled radial to rule out the false positive of the Set button becoming visible
// On Android, this is not necessary because the button is always visible for admins
await device2
.onIOS()
.clickOnElementAll(new DisappearingMessageRadial(device2, DISAPPEARING_TIMES.ONE_DAY));
const setButton = await device2.doesElementExist({
...new SetDisappearMessagesButton(device2).build(),
maxWait: 500,
});
if (setButton) throw new Error('Disappearing Messages Set button should not be visible');
await closeApp(device1, device2, device3);
}
2 changes: 1 addition & 1 deletion run/test/specs/group_disappearing_messages_video.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const timerType = 'Disappear after send option';

async function disappearingVideoMessageGroup(platform: SupportedPlatformsType) {
const testMessage = 'Testing disappearing messages for videos';
const testGroupName = 'Test group';
const testGroupName = 'Testing disappearing messages';
const { device1, device2, device3 } = await openAppThreeDevices(platform);
// Create user A and user B
const [userA, userB, userC] = await Promise.all([
Expand Down
29 changes: 21 additions & 8 deletions run/test/specs/locators/disappearing_messages.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { LocatorsInterface } from '.';
import { StrategyExtractionObj } from '../../../types/testing';
import { DISAPPEARING_TIMES } from '../../../types/testing';
import { DeviceWrapper } from '../../../types/DeviceWrapper';

export class DisappearingMessagesMenuOption extends LocatorsInterface {
public build(): StrategyExtractionObj {
Expand Down Expand Up @@ -50,14 +52,10 @@ export class DisableDisappearingMessages extends LocatorsInterface {
}
export class SetDisappearMessagesButton extends LocatorsInterface {
public build(): StrategyExtractionObj {
switch (this.platform) {
case 'android':
case 'ios':
return {
strategy: 'accessibility id',
selector: 'Set button',
} as const;
}
return {
strategy: 'accessibility id',
selector: 'Set button',
} as const;
}
}

Expand Down Expand Up @@ -86,3 +84,18 @@ export class FollowSettingsButton extends LocatorsInterface {
}
}
}
export class DisappearingMessageRadial extends LocatorsInterface {
private timer: DISAPPEARING_TIMES;

// Receives a timer argument so that one locator can handle all DM durations
constructor(device: DeviceWrapper, timer: DISAPPEARING_TIMES) {
super(device);
this.timer = timer;
}
public build(): StrategyExtractionObj {
return {
strategy: 'accessibility id',
selector: `${this.timer} - Radio`,
} as const;
}
}
16 changes: 0 additions & 16 deletions run/test/specs/locators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,22 +505,6 @@ export class DownloadMediaButton extends LocatorsInterface {
}
}

export class SetDisappearMessagesButton extends LocatorsInterface {
public build(): StrategyExtractionObj {
switch (this.platform) {
case 'android':
return {
strategy: 'accessibility id',
selector: 'Set',
} as const;
case 'ios':
return {
strategy: 'accessibility id',
selector: 'Set button',
} as const;
}
}
}
export class ShareExtensionIcon extends LocatorsInterface {
public build(): StrategyExtractionObj {
switch (this.platform) {
Expand Down
Loading