Skip to content

Commit

Permalink
Merge pull request #595 from Satellite-im/luis/friends-windows
Browse files Browse the repository at this point in the history
chore(appium): execute friends tests on windows
  • Loading branch information
luisecm authored Jan 23, 2024
2 parents 660852e + e2e3056 commit c1be82b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"mac.ci": "DRIVER=mac2 npx wdio config/wdio.mac.ci.conf.ts",
"mac.multiremote": "DRIVER=mac2 npx wdio config/wdio.mac.multiremote.conf.ts",
"windows.app": "powershell -ExecutionPolicy Bypass -File .\\scripts\\windows_app.ps1",
"windows.ci": "powershell -File .\\scripts\\windows_ci.ps1",
"windows.ci": "powershell -ExecutionPolicy Bypass -File .\\scripts\\windows_ci.ps1",
"lint": "eslint config tests"
},
"repository": {
Expand Down
18 changes: 11 additions & 7 deletions tests/screenobjects/friends/FriendsScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const SELECTORS_WINDOWS = {
CONTEXT_MENU: '[name="Context Menu"]',
CONTEXT_MENU_BLOCK: '[name="friends-block"]',
CONTEXT_MENU_CHAT: '[name="friends-chat"]',
CONTEXT_MENU_COPY_DID_KEY: "<Button>[2]",
CONTEXT_MENU_COPY_ID: "<Button>[1]",
CONTEXT_MENU_COPY_DID_KEY: '//Button[@Name="copy-id-context"][2]',
CONTEXT_MENU_COPY_ID: '//Button[@Name="copy-id-context"][1]',
CONTEXT_MENU_FAVORITES_ADD: '[name="favorites-add"]',
CONTEXT_MENU_FAVORITES_REMOVE: '[name="favorites-remove"]',
CONTEXT_MENU_INCOMING_ACCEPT: '[name="friends-accept"]',
Expand Down Expand Up @@ -65,7 +65,7 @@ const SELECTORS_WINDOWS = {
INPUT_ERROR: '[name="input-error"]',
INPUT_ERROR_TEXT: "<Text>",
NO_REQUESTS: '[name="no-requests"]',
NO_REQUESTS_TEXT: "<Text>",
NO_REQUESTS_TEXT: "//Text/Text",
OUTGOING_REQUESTS_LIST: '[name="Outgoing Requests List"]',
OUTGOING_REQUESTS_LIST_LABEL: '[name="outgoing-list-label"]',
PENDING_FRIENDS_BUTTON: '[name="pending-friends-button"]',
Expand Down Expand Up @@ -654,6 +654,12 @@ export default class FriendsScreen extends UplinkMainScreen {
return userTooltipText;
}

async getValueFromAddSomeoneInput() {
const addSomeoneInput = await this.addSomeoneInput;
const addSomeoneInputText = await addSomeoneInput.getText();
return addSomeoneInputText;
}

async getValueFromFriendsButtonBadge() {
const friendsButtonBadgeValue = await this.friendsButtonBadgeText;
const friendsButtonBadgeValueText = await friendsButtonBadgeValue.getText();
Expand Down Expand Up @@ -837,14 +843,12 @@ export default class FriendsScreen extends UplinkMainScreen {

async validateIncomingListIsShown() {
await this.noRequests.waitForExist({ reverse: true, timeout: 30000 });
const incomingList = await this.incomingRequestsList;
await incomingList.waitForExist();
await this.incomingRequestsList.waitForExist();
}

async validateNoRequestsIsShown() {
// Ensure no requests message is displayed
const noRequests = await this.noRequests;
await noRequests.waitForExist();
await this.noRequests.waitForExist();
}

async validateOutgoingListIsNotEmpty() {
Expand Down
17 changes: 10 additions & 7 deletions tests/specs/04-friends.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require("module-alias/register");
import { getClipboardValue, resetAndLoginWithCache } from "@helpers/commands";
import { resetAndLoginWithCache } from "@helpers/commands";
import ChatsLayout from "@screenobjects/chats/ChatsLayout";
import ChatsSidebar from "@screenobjects/chats/ChatsSidebar";
import FavoritesSidebar from "@screenobjects/chats/FavoritesSidebar";
Expand Down Expand Up @@ -104,8 +104,9 @@ export default async function friendsTests() {
// Wait for toast notification to disappear
await friendsScreen.waitUntilNotificationIsClosed();

// Validate clipboard text contains Username#
const clipboardText = await getClipboardValue();
// Validate value copied from Copy ID is correct
await friendsScreen.pasteUserKeyInAddSomeone();
const clipboardText = await friendsScreen.getValueFromAddSomeoneInput();
await expect(clipboardText).toContain("ChatUserA#");
});

Expand All @@ -117,8 +118,9 @@ export default async function friendsTests() {
// Wait for toast notification to disappear
await friendsScreen.waitUntilNotificationIsClosed();

// Validate clipboard text contains Did Key
const clipboardText = await getClipboardValue();
// Validate value copied from Copy DID is correct
await friendsScreen.pasteUserKeyInAddSomeone();
const clipboardText = await friendsScreen.getValueFromAddSomeoneInput();
await expect(clipboardText).toContain("did:key");
});

Expand All @@ -130,8 +132,9 @@ export default async function friendsTests() {
// Wait for toast notification to disappear
await friendsScreen.waitUntilNotificationIsClosed();

// Validate clipboard text contains Username#
const clipboardText = await getClipboardValue();
// Validate value copied from Copy ID is correct
await friendsScreen.pasteUserKeyInAddSomeone();
const clipboardText = await friendsScreen.getValueFromAddSomeoneInput();
await expect(clipboardText).toContain("ChatUserA#");
});

Expand Down
2 changes: 2 additions & 0 deletions tests/suites/MainTests/02-UplinkWindows.suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ require("module-alias/register");
import createAccountTests from "@specs/01-create-account.spec";
import chatsTests from "@specs/02-chats.spec";
import filesTests from "@specs/03-files.spec";
import friendsTests from "@specs/04-friends.spec";
import settingsProfileTests from "@specs/05-settings-profile.spec";
import settingsGeneralTests from "@specs/06-settings-general.spec";
import settingsMessagesTests from "@specs/15-settings-messages.spec";
Expand Down Expand Up @@ -34,5 +35,6 @@ describe("MacOS Tests", function () {
describe("Settings About Tests", settingsAboutTests.bind(this));
describe("Settings Licenses Tests", settingsLicensesTests.bind(this));
describe("Settings Developer Tests", settingsDeveloperTests.bind(this));
describe("Friends Screen Tests", friendsTests.bind(this));
describe("Import Account Tests", importAccountTests.bind(this));
});

0 comments on commit c1be82b

Please sign in to comment.