Merge pull request #11 from burtonemily/onboarding-with-integrationtest-2

Remove look for text in blocked user test and updated disappearing me…
This commit is contained in:
Audric Ackermann 2023-05-17 12:11:17 +10:00 committed by GitHub
commit 20ae5bd7d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 40 deletions

View file

@ -1,35 +1,28 @@
import { sleepFor } from '../../session/utils/Promise';
import { newUser } from './setup/new_user';
import { sessionTestTwoWindows } from './setup/sessionTest';
import { createContact } from './utilities/create_contact';
import { sendMessage } from './utilities/message';
import { sendNewMessage } from './utilities/send_message';
import {
clickOnMatchingText,
clickOnTestIdWithText,
waitForControlMessageWithText,
waitForMatchingText,
waitForTestIdWithText,
waitForTestIdWithText
} from './utilities/utils';
// 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()}`;
sessionTestTwoWindows('Disappearing messages', async ([windowA, windowB]) => {
// Open App
// Create User
const [userA, userB] = await Promise.all([newUser(windowA, 'Alice'), newUser(windowB, 'Bob')]);
// Create Contact
await sendNewMessage(windowA, userB.sessionid, sentMessage);
await sendNewMessage(windowB, userA.sessionid, sentReplyMessage);
await waitForControlMessageWithText(windowA, 'Your message request has been accepted');
// await waitForMatchingText(windowA, `You have accepted ${userA.userName}'s message request`);
// await waitForMatchingText(windowB, 'Your message request has been accepted');
await createContact(windowA, windowB, userA, userB)
// Click on user's avatar to open conversation options
await clickOnTestIdWithText(windowA, 'conversation-options-avatar');
await clickOnTestIdWithText(windowA, 'conversation-options-avatar')
// Select disappearing messages drop down
await clickOnMatchingText(windowA, 'Disappearing messages');
// Select 5 seconds
@ -81,6 +74,7 @@ sessionTestTwoWindows('Disappearing messages', async ([windowA, windowB]) => {
`${userA.userName} set the disappearing message timer to 5 seconds`
);
// Wait 5 seconds
await sleepFor(5000)
await waitForMatchingText(windowB, `${userA.userName} has turned off disappearing messages.`);
// verify message is deleted in windowB
const errorDesc2 = 'Should not be found';

View file

@ -48,7 +48,6 @@ sessionTestTwoWindows('Decline request syncs', async ([windowA, windowB]) => {
await waitForTestIdWithText(windowC, 'module-conversation__user__profile-name', userA.userName);
await clickOnTestIdWithText(windowB, 'decline-message-request');
await clickOnTestIdWithText(windowB, 'session-confirm-ok-button', 'Decline');
await waitForTestIdWithText(windowB, 'session-toast', 'Blocked');
await waitForMatchingText(windowB, 'No pending message requests');
await waitForMatchingText(windowC, 'No pending message requests');

View file

@ -12,10 +12,9 @@ import {
clickOnTestIdWithText,
hasTextElementBeenDeleted,
typeIntoInput,
waitForLoadingAnimationToFinish,
waitForMatchingText,
waitForTestIdWithText,
waitForTextMessage,
waitForTextMessage
} from './utilities/utils';
const windows: Array<Page> = [];
@ -96,12 +95,10 @@ test('Check profile picture syncs', async () => {
expect(screenshot).toMatchSnapshot({ name: 'avatar-updated-blue.jpeg' });
});
test('Check contacts sync', async () => {
test('Check contacts syncs', async () => {
const [windowA, windowC] = await openApp(2); // not using sessionTest here as we need to close and reopen one of the window
const [userA, userB] = await Promise.all([newUser(windowA, 'Alice'), newUser(windowC, 'Bob')]);
const [windowB] = await linkedDevice(userA.recoveryPhrase); // not using sessionTest here as we need to close and reopen one of the window
// Waiting for linked device to finish loading
await waitForLoadingAnimationToFinish(windowB, 'loading-spinner');
await createContact(windowA, windowC, userA, userB);
// Check linked device (windowB)
await waitForTestIdWithText(windowB, 'module-conversation__user__profile-name', userB.userName);
@ -113,7 +110,6 @@ test('Check deleted message syncs', async () => {
const [userA, userB] = await Promise.all([newUser(windowA, 'Alice'), newUser(windowC, 'Bob')]);
const [windowB] = await linkedDevice(userA.recoveryPhrase);
const deletedMessage = 'Testing deletion functionality for linked device';
await waitForLoadingAnimationToFinish(windowB, 'loading-spinner');
await createContact(windowA, windowC, userA, userB);
await sendMessage(windowA, deletedMessage);
// Navigate to conversation on linked device and check for message from user A to user B
@ -138,7 +134,6 @@ test('Check unsent message syncs', async () => {
const [userA, userB] = await Promise.all([newUser(windowA, 'Alice'), newUser(windowC, 'Bob')]);
const [windowB] = await linkedDevice(userA.recoveryPhrase);
const unsentMessage = 'Testing unsending functionality for linked device';
await waitForLoadingAnimationToFinish(windowB, 'loading-spinner');
await createContact(windowA, windowC, userA, userB);
await sendMessage(windowA, unsentMessage);
// Navigate to conversation on linked device and check for message from user A to user B
@ -155,24 +150,23 @@ test('Check unsent message syncs', async () => {
await hasTextElementBeenDeleted(windowB, unsentMessage, 1000);
});
// test('Check blocked user syncs', async () => {
// const [windowA, windowC] = await openApp(2);
// const [userA, userB] = await Promise.all([newUser(windowA, 'Alice'), newUser(windowC, 'Bob')]);
// const [windowB] = await linkedDevice(userA.recoveryPhrase);
// const testMessage = 'Testing blocking functionality for linked device';
// await waitForLoadingAnimationToFinish(windowB, 'loading-spinner');
// await createContact(windowA, windowC, userA, userB);
// await sendMessage(windowA, testMessage);
// // Navigate to conversation on linked device and check for message from user A to user B
// await clickOnTestIdWithText(windowB, 'module-conversation__user__profile-name', userB.userName);
// await clickOnElement(windowA, 'data-testid', 'three-dots-conversation-options');
// await clickOnMatchingText(windowA, 'Block');
// await waitForTestIdWithText(windowA, 'session-toast', 'Blocked');
// await waitForMatchingText(windowA, 'Unblock this contact to send a message.');
// // Check linked device for blocked contact in settings screen
// await clickOnTestIdWithText(windowB, 'settings-section');
// await clickOnTestIdWithText(windowB, 'conversations-settings-menu-item');
// await clickOnTestIdWithText(windowB, 'reveal-blocked-user-settings');
// // Check if user B is in blocked contact list
// await waitForMatchingText(windowB, userB.userName);
// });
test('Check blocked user syncs', async () => {
const [windowA, windowC] = await openApp(2);
const [userA, userB] = await Promise.all([newUser(windowA, 'Alice'), newUser(windowC, 'Bob')]);
const [windowB] = await linkedDevice(userA.recoveryPhrase);
const testMessage = 'Testing blocking functionality for linked device';
await createContact(windowA, windowC, userA, userB);
await sendMessage(windowA, testMessage);
// Navigate to conversation on linked device and check for message from user A to user B
await clickOnTestIdWithText(windowB, 'module-conversation__user__profile-name', userB.userName);
await clickOnElement(windowA, 'data-testid', 'three-dots-conversation-options');
await clickOnMatchingText(windowA, 'Block');
await waitForTestIdWithText(windowA, 'session-toast', 'Blocked');
// await waitForMatchingText(windowA, 'Unblock this contact to send a message.');
// Check linked device for blocked contact in settings screen
await clickOnTestIdWithText(windowB, 'settings-section');
await clickOnTestIdWithText(windowB, 'conversations-settings-menu-item');
await clickOnTestIdWithText(windowB, 'reveal-blocked-user-settings');
// Check if user B is in blocked contact list
await waitForMatchingText(windowB, userB.userName);
});