Adds data-testid to loading-animation, microphone recording button, recording permissions button, stop recording button, consolidates tests into user actions test, adds media to fixtures folder, updates linked device tests with avatar change, username change and group tests. Adds tests for messaging, sending image, video, document, gif and link with preview. Also updates reply message functionality to wait for loading animation
2 years ago
|
|
|
import { test } from '@playwright/test';
|
|
|
|
import { sleepFor } from '../../session/utils/Promise';
|
|
|
|
import { beforeAllClean } from './setup/beforeEach';
|
|
|
|
import { newUser } from './setup/new_user';
|
|
|
|
import { openApp } from './setup/open';
|
|
|
|
import { sendMessage } from './utilities/message';
|
|
|
|
import {
|
|
|
|
clickOnMatchingText,
|
|
|
|
clickOnTestIdWithText,
|
|
|
|
hasTextElementBeenDeleted,
|
|
|
|
waitForTestIdWithText,
|
|
|
|
} from './utilities/utils';
|
|
|
|
import { createContact } from './utilities/create_contact';
|
|
|
|
|
|
|
|
test.beforeEach(beforeAllClean);
|
|
|
|
|
Adds data-testid to loading-animation, microphone recording button, recording permissions button, stop recording button, consolidates tests into user actions test, adds media to fixtures folder, updates linked device tests with avatar change, username change and group tests. Adds tests for messaging, sending image, video, document, gif and link with preview. Also updates reply message functionality to wait for loading animation
2 years ago
|
|
|
// test.afterEach(() => forceCloseAllWindows(windows));
|
|
|
|
// tslint:disable: no-console
|
|
|
|
|
|
|
|
const testMessage = 'Test-Message- (A -> B) ';
|
|
|
|
// const testReply = 'Reply-Test-Message- (B -> A)';
|
|
|
|
const sentMessage = `${testMessage}${Date.now()}`;
|
|
|
|
// const sentReplyMessage = `${testReply} :${Date.now()}`;
|
|
|
|
|
Adds data-testid to loading-animation, microphone recording button, recording permissions button, stop recording button, consolidates tests into user actions test, adds media to fixtures folder, updates linked device tests with avatar change, username change and group tests. Adds tests for messaging, sending image, video, document, gif and link with preview. Also updates reply message functionality to wait for loading animation
2 years ago
|
|
|
test('Disappearing messages', async () => {
|
|
|
|
// Open App
|
|
|
|
// Create User
|
Adds data-testid to loading-animation, microphone recording button, recording permissions button, stop recording button, consolidates tests into user actions test, adds media to fixtures folder, updates linked device tests with avatar change, username change and group tests. Adds tests for messaging, sending image, video, document, gif and link with preview. Also updates reply message functionality to wait for loading animation
2 years ago
|
|
|
const [windowA, windowB] = await openApp(2);
|
|
|
|
const [userA, userB] = await Promise.all([newUser(windowA, 'Alice'), newUser(windowB, 'Bob')]);
|
|
|
|
// Create Contact
|
|
|
|
await createContact(windowA, windowB, userA, userB);
|
|
|
|
// Need to wait for contact approval
|
|
|
|
await sleepFor(5000);
|
|
|
|
// Click on user's avatar to open conversation options
|
|
|
|
await clickOnTestIdWithText(windowA, 'conversation-options-avatar');
|
|
|
|
// Select disappearing messages drop down
|
|
|
|
await clickOnMatchingText(windowA, 'Disappearing messages');
|
|
|
|
// Select 5 seconds
|
|
|
|
await clickOnMatchingText(windowA, '5 seconds');
|
|
|
|
// Click chevron to close menu
|
|
|
|
await clickOnTestIdWithText(windowA, 'back-button-conversation-options');
|
|
|
|
// Check config message
|
|
|
|
await waitForTestIdWithText(
|
|
|
|
windowA,
|
Adds data-testid to loading-animation, microphone recording button, recording permissions button, stop recording button, consolidates tests into user actions test, adds media to fixtures folder, updates linked device tests with avatar change, username change and group tests. Adds tests for messaging, sending image, video, document, gif and link with preview. Also updates reply message functionality to wait for loading animation
2 years ago
|
|
|
'control-message',
|
|
|
|
'You set the disappearing message timer to 5 seconds'
|
|
|
|
);
|
|
|
|
await waitForTestIdWithText(
|
|
|
|
windowB,
|
|
|
|
'control-message',
|
|
|
|
`${userA.userName} set the disappearing message timer to 5 seconds`
|
|
|
|
);
|
|
|
|
await sleepFor(500);
|
|
|
|
// Check top right hand corner indicator
|
|
|
|
await waitForTestIdWithText(windowA, 'disappearing-messages-indicator', '5 seconds');
|
|
|
|
// Send message
|
Adds data-testid to loading-animation, microphone recording button, recording permissions button, stop recording button, consolidates tests into user actions test, adds media to fixtures folder, updates linked device tests with avatar change, username change and group tests. Adds tests for messaging, sending image, video, document, gif and link with preview. Also updates reply message functionality to wait for loading animation
2 years ago
|
|
|
await sendMessage(windowA, sentMessage);
|
|
|
|
// Check timer is functioning
|
|
|
|
await sleepFor(6000);
|
|
|
|
// Verify message is deleted
|
|
|
|
await hasTextElementBeenDeleted(windowA, sentMessage, 3000);
|
|
|
|
// focus window B
|
|
|
|
await windowA.close();
|
|
|
|
await windowB.bringToFront();
|
|
|
|
await clickOnTestIdWithText(windowB, "control-message", `${userA.userName} set the disappearing message timer to 5 seconds`);
|
|
|
|
await hasTextElementBeenDeleted(windowB, sentMessage, 5000);
|
|
|
|
});
|