Skip to content

Commit

Permalink
Merge pull request #632 from Satellite-im/luis/click-fixes
Browse files Browse the repository at this point in the history
screenobject(update): use external click on appium methods for flakyness
  • Loading branch information
luisecm authored Feb 14, 2024
2 parents 7413db3 + 0f689f6 commit 5193153
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
16 changes: 13 additions & 3 deletions tests/screenobjects/UplinkMainScreen.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
require("module-alias/register");
import AppScreen from "@screenobjects/AppScreen";
import { hoverOnMacOS, hoverOnWindows } from "@helpers/commands";
import {
hoverOnMacOS,
hoverOnWindows,
leftClickOnMacOS,
leftClickOnWindows,
} from "@helpers/commands";
import { MACOS_DRIVER, WINDOWS_DRIVER } from "@helpers/constants";

let SELECTORS = {};
Expand Down Expand Up @@ -260,8 +265,13 @@ export default class UplinkMainScreen extends AppScreen {
}

async goToMainScreen() {
const button = await this.chatsButton;
await button.click();
const chatsButton = await this.chatsButton;
const currentDriver = await this.getCurrentDriver();
if (currentDriver === MACOS_DRIVER) {
await leftClickOnMacOS(chatsButton);
} else if (currentDriver === WINDOWS_DRIVER) {
await leftClickOnWindows(chatsButton);
}
}

async goToSettings() {
Expand Down
12 changes: 12 additions & 0 deletions tests/screenobjects/friends/FriendsScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import UplinkMainScreen from "@screenobjects/UplinkMainScreen";
import {
getClipboardMacOS,
keyboardShortcutPaste,
leftClickOnMacOS,
leftClickOnWindows,
rightClickOnMacOS,
rightClickOnWindows,
} from "@helpers/commands";
Expand Down Expand Up @@ -677,6 +679,16 @@ export default class FriendsScreen extends UplinkMainScreen {
await this.blockedListButton.click();
}

async goToChatWithFriend() {
const chatWithFriendButton = await this.chatWithFriendButton;
const currentDriver = await this.getCurrentDriver();
if (currentDriver === MACOS_DRIVER) {
await leftClickOnMacOS(chatWithFriendButton);
} else if (currentDriver === WINDOWS_DRIVER) {
await leftClickOnWindows(chatWithFriendButton);
}
}

async goToPendingFriendsList() {
await browser.pause(1000);
await this.pendingFriendsButton.waitForExist();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default async function createChatAccountsTests() {
await friendsScreen.validateAllFriendsListIsNotEmpty();

// Go to Chat with User B
await friendsScreen.chatWithFriendButton.click();
await friendsScreen.goToChatWithFriend();
});

it("Chat User B - Validate friend request was accepted", async () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/specs/reusable-accounts/07-quick-profile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default async function quickProfileTests() {
it("Chat User A - Click on Edit Profile", async () => {
// Click on Edit Profile from Quick Profile
await chatsQuickProfile.clickOnEditProfile();
await settingsProfile.validateSettingsProfileIsShown();
await settingsProfile.waitForIsShown(true);
await settingsProfile.goToMainScreen();
});

Expand Down

0 comments on commit 5193153

Please sign in to comment.