Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(update): update chats tests #580

Merged
merged 8 commits into from
Dec 21, 2023
Merged
44 changes: 31 additions & 13 deletions tests/helpers/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,6 @@ export async function loginWithTestUser() {
const unlockScreen = await createPinFirstUser.unlockLayout;
await unlockScreen.waitForExist();
await createPinFirstUser.enterPin("1234");

// Ensure Main Screen is displayed
const welcomeLayout = await welcomeScreenFirstUser.welcomeLayout;
await welcomeLayout.waitForExist();

// Only maximize if current driver is windows
const currentDriver = await welcomeScreenFirstUser.getCurrentDriver();
if (currentDriver === WINDOWS_DRIVER) {
await maximizeWindow();
}
}

export async function resetApp() {
Expand Down Expand Up @@ -172,6 +162,16 @@ export async function launchApplication(
}
}

export async function launchFirstApplication() {
await driver.executeScript("macos: launchApp", [
{
bundleId: MACOS_USER_A_BUNDLE_ID,
arguments: ["--discovery", "disable", "--path", homedir() + "/.uplink"],
},
]);
await browser.pause(5000);
}

export async function launchSecondApplication() {
await driver.executeScript("macos: launchApp", [
{
Expand Down Expand Up @@ -238,6 +238,22 @@ export async function closeApplication() {
}
}

export async function closeFirstApplication() {
await driver.executeScript("macos: terminateApp", [
{
bundleId: MACOS_USER_A_BUNDLE_ID,
},
]);
}

export async function closeSecondApplication() {
await driver.executeScript("macos: terminateApp", [
{
bundleId: MACOS_USER_B_BUNDLE_ID,
},
]);
}

export async function maximizeWindow() {
const currentOS = await driver.capabilities.automationName;
if (currentOS === WINDOWS_DRIVER) {
Expand Down Expand Up @@ -278,10 +294,10 @@ export async function getClipboardValue() {
}

export async function hoverOnMacOS(locator: WebdriverIO.Element) {
// Hover on X and Y coordinates previously retrieved
const elementId = await locator.elementId;
await driver.executeScript("macos: hover", [
{
elementId: locator,
elementId: elementId,
},
]);
}
Expand Down Expand Up @@ -346,11 +362,13 @@ export async function selectFileOnMacos(relativePath: string) {
}

export async function rightClickOnMacOS(locator: WebdriverIO.Element) {
const elementId = await locator.elementId;
await driver.executeScript("macos: rightClick", [
{
elementId: locator,
elementId: elementId,
},
]);
await mouse.click(Button.RIGHT);
}

// Windows driver helper functions
Expand Down
Loading
Loading