Skip to content

Commit

Permalink
Merge pull request #580 from Satellite-im/luis/chats-tests-2
Browse files Browse the repository at this point in the history
test(update): update chats tests
  • Loading branch information
luisecm authored Dec 21, 2023
2 parents 954edc4 + 6050eb0 commit a8d221a
Show file tree
Hide file tree
Showing 16 changed files with 1,086 additions and 664 deletions.
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

0 comments on commit a8d221a

Please sign in to comment.