session-desktop/ts/test/automation/setup/new_user.ts
Audric Ackermann fe2d5ffe6d test: fix remaining integration tests
"Check profile picture syncs" is not fixed yet as it need to be fully
updated and not just fixed (not done as part of this eslint-related PR)
2023-08-01 07:16:08 +02:00

25 lines
1.1 KiB
TypeScript

import { Page } from '@playwright/test';
import { User } from '../types/testing';
import { clickOnMatchingText, clickOnTestIdWithText, typeIntoInput } from '../utilities/utils';
export const newUser = async (window: Page, userName: string): Promise<User> => {
// Create User
await clickOnMatchingText(window, 'Create Session ID');
await clickOnMatchingText(window, 'Continue');
// Input username = testuser
await typeIntoInput(window, 'display-name-input', userName);
await clickOnMatchingText(window, 'Get started');
// save recovery phrase
await clickOnMatchingText(window, 'Reveal Recovery Phrase');
const recoveryPhrase = await window.innerText('[data-testid=recovery-phrase-seed-modal]');
await window.click('.session-icon-button.small');
await clickOnTestIdWithText(window, 'leftpane-primary-avatar');
// Save session ID to a variable
const sessionid = await window.innerText('[data-testid=your-session-id]');
console.info(`${userName}: Session ID: ${sessionid} and Recovery phrase: ${recoveryPhrase}`);
await window.click('.session-icon-button.small');
return { userName, sessionid, recoveryPhrase };
};