diff --git a/ts/components/basic/SessionDropdown.tsx b/ts/components/basic/SessionDropdown.tsx index 0b27a90da..eb00a1f42 100644 --- a/ts/components/basic/SessionDropdown.tsx +++ b/ts/components/basic/SessionDropdown.tsx @@ -17,15 +17,16 @@ type Props = { active?: boolean; onClick?: any; }>; + dataTestId?: string; }; export const SessionDropdown = (props: Props) => { - const { label, options } = props; + const { label, options, dataTestId } = props; const [expanded, setExpanded] = useState(!!props.expanded); const chevronOrientation = expanded ? 180 : 0; return ( -
+
{ @@ -43,6 +44,7 @@ export const SessionDropdown = (props: Props) => { return ( { @@ -23,7 +24,7 @@ export const SessionDropdownItem = (props: Props) => { } }; - const { content, type, icon, active } = props; + const { content, type, icon, active, dataTestId } = props; return (
{ )} role="button" onClick={clickHandler} + data-testid={dataTestId} > {icon ? : ''}
{content}
diff --git a/ts/components/conversation/SessionRightPanel.tsx b/ts/components/conversation/SessionRightPanel.tsx index 6f15fe3f7..f98632661 100644 --- a/ts/components/conversation/SessionRightPanel.tsx +++ b/ts/components/conversation/SessionRightPanel.tsx @@ -354,6 +354,7 @@ export const SessionRightPanelWithDetails = () => { )} diff --git a/ts/test/automation/disappearing_messages.spec.ts b/ts/test/automation/disappearing_messages.spec.ts index 1e88e4d37..35a218d65 100644 --- a/ts/test/automation/disappearing_messages.spec.ts +++ b/ts/test/automation/disappearing_messages.spec.ts @@ -23,10 +23,12 @@ sessionTestTwoWindows('Disappearing messages', async ([windowA, windowB]) => { await createContact(windowA, windowB, userA, userB); // Click on user's avatar to open conversation options await clickOnTestIdWithText(windowA, 'conversation-options-avatar'); + await waitForMatchingText(windowA, 'Your message request has been accepted'); // Select disappearing messages drop down - await clickOnMatchingText(windowA, 'Disappearing messages'); + await clickOnTestIdWithText(windowA, 'disappearing-messages-dropdown', 'Disappearing messages'); // Select 5 seconds - await clickOnMatchingText(windowA, '5 seconds'); + await sleepFor(200); + await clickOnTestIdWithText(windowA, 'dropdownitem-5-seconds', '5 seconds'); // Click chevron to close menu await clickOnTestIdWithText(windowA, 'back-button-conversation-options'); // Check config message diff --git a/ts/test/automation/linked_device_requests.spec.ts b/ts/test/automation/linked_device_requests.spec.ts index 9a9adbab4..4f63ce95d 100644 --- a/ts/test/automation/linked_device_requests.spec.ts +++ b/ts/test/automation/linked_device_requests.spec.ts @@ -41,7 +41,7 @@ sessionTestTwoWindows('Decline request syncs', async ([windowA, windowB]) => { const testMessage = `${userA.userName} sending message request to ${userB.userName}`; await sendNewMessage(windowA, userB.sessionid, testMessage); - // Accept request in windowB + // Decline request in windowB await clickOnTestIdWithText(windowB, 'message-request-banner'); await clickOnTestIdWithText(windowB, 'module-conversation__user__profile-name', userA.userName); await clickOnTestIdWithText(windowC, 'message-request-banner'); diff --git a/ts/test/automation/linked_device_user.spec.ts b/ts/test/automation/linked_device_user.spec.ts index 6b1690202..bad40ede9 100644 --- a/ts/test/automation/linked_device_user.spec.ts +++ b/ts/test/automation/linked_device_user.spec.ts @@ -166,7 +166,8 @@ test('Check blocked user syncs', async () => { // 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'); + // a conf sync job can take 30s (if the last one failed) + 10s polling to show a change on a linked device. + await clickOnTestIdWithText(windowB, 'reveal-blocked-user-settings', undefined, undefined, 50000); // Check if user B is in blocked contact list await waitForMatchingText(windowB, userB.userName); }); diff --git a/ts/test/automation/message_requests.spec.ts b/ts/test/automation/message_requests.spec.ts index a9a0cd104..fa711f74c 100644 --- a/ts/test/automation/message_requests.spec.ts +++ b/ts/test/automation/message_requests.spec.ts @@ -84,6 +84,8 @@ test.describe('Message requests', () => { await clickOnTestIdWithText(windowB, 'session-confirm-ok-button', 'OK'); // Navigate back to message request folder to check await clickOnTestIdWithText(windowB, 'settings-section'); + + await clickOnTestIdWithText(windowB, 'message-requests-settings-menu-item', 'Message Requests'); // Check config message of message request acceptance await waitForMatchingText(windowB, 'No pending message requests'); }); diff --git a/ts/test/automation/setup/new_user.ts b/ts/test/automation/setup/new_user.ts index e57cebba1..7ddf1536d 100644 --- a/ts/test/automation/setup/new_user.ts +++ b/ts/test/automation/setup/new_user.ts @@ -1,12 +1,13 @@ import { Page } from '@playwright/test'; import { User } from '../types/testing'; import { clickOnMatchingText, typeIntoInput } from '../utilities/utils'; +import { sleepFor } from '../../../session/utils/Promise'; // tslint:disable: no-console export const newUser = async (window: Page, userName: string): Promise => { // Create User await clickOnMatchingText(window, 'Create Session ID'); // Wait for animation for finish creating ID - await window.waitForTimeout(1500); + await sleepFor(2500); //Save session ID to a variable const sessionid = await window.inputValue('[data-testid=session-id-signup]'); await clickOnMatchingText(window, 'Continue'); diff --git a/ts/test/automation/utilities/utils.ts b/ts/test/automation/utilities/utils.ts index 39ed571bd..06d5a022d 100644 --- a/ts/test/automation/utilities/utils.ts +++ b/ts/test/automation/utilities/utils.ts @@ -111,7 +111,8 @@ export async function clickOnTestIdWithText( window: Page, dataTestId: string, text?: string, - rightButton?: boolean + rightButton?: boolean, + maxWait?: number ) { console.info(`clickOnTestIdWithText with testId:${dataTestId} and text:${text ? text : 'none'}`); @@ -119,7 +120,7 @@ export async function clickOnTestIdWithText( ? `css=[data-testid=${dataTestId}]` : `css=[data-testid=${dataTestId}]:has-text("${text}")`; - await window.waitForSelector(builtSelector); + await window.waitForSelector(builtSelector, { timeout: maxWait }); return window.click(builtSelector, rightButton ? { button: 'right' } : undefined); }