Skip to content

Commit

Permalink
test(update): updates tests and screenobjects for linter
Browse files Browse the repository at this point in the history
  • Loading branch information
luisecm committed Dec 6, 2023
1 parent 1baf704 commit d5e788f
Show file tree
Hide file tree
Showing 36 changed files with 296 additions and 332 deletions.
4 changes: 2 additions & 2 deletions docs/ARIA_LABELS.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ Find more information about the WebdriverIO API methods in the following [`link`
```js
it("Validate Welcome Screen is displayed", async () => {
await expect(welcomeScreenFirstUser.addSomeoneText).toHaveTextContaining(
"Things are better with friends."
"Things are better with friends.",
);
});
```
Expand All @@ -301,7 +301,7 @@ it("Validate Welcome Screen is displayed", async () => {
```js
it("Validate Welcome Screen is displayed", async () => {
await expect(welcomeScreenFirstUser.addSomeoneText).toHaveTextContaining(
"No friends added yet!"
"No friends added yet!",
);
});
```
Expand Down
4 changes: 2 additions & 2 deletions docs/TEST_COVERAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ This document provides a test coverage matrix of the Uplink features already aut

- [x] Any message you send yourself should appear within a colored message bubble.
- [x] Any message received should appear with a grey bubble.
- [ ] The chat you are in should be highlighted in the sidebar.
- [ ] The chat you are in should be highlighted in the sidebar.
- [x] User Profile Pic should appear next to their message and be up to date.
- [x] Username should appear above each message or bulk of messages sent or received.
- [x] Clicking the _Heart_ should add the friend to your _Favorites_.
- [x] Current chat should be displayed at the top of the list in the sidebar.
- [x] Current chat should be displayed at the top of the list in the sidebar.
- [x] Timestamps should be updated in chat and sidebar. (now, then goes by minutes-hours-days)
- [ ] Clicking _Phone_ icon should open call modal.
- [ ] Chat should close if the user blocks the friend they are in the current chat with.
Expand Down
4 changes: 2 additions & 2 deletions tests/screenobjects/AppScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export default class AppScreen {
}

async getCurrentDriver() {
const currentDriver = await driver[this.executor].capabilities
.automationName;
const currentDriver =
await driver[this.executor].capabilities.automationName;
return currentDriver;
}

Expand Down
33 changes: 16 additions & 17 deletions tests/screenobjects/chats/FavoritesSidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ export default class FavoritesSidebar extends UplinkMainScreen {
timeout: 15000,
timeoutMsg:
"Expected Favorite User was never displayed after 15 seconds",
}
},
);
const favoritesElement = await this.instance
.$(SELECTORS.SLIMBAR)
Expand All @@ -209,7 +209,7 @@ export default class FavoritesSidebar extends UplinkMainScreen {
timeout: 15000,
timeoutMsg:
"Expected user image was never displayed on Favorites Sidebar after 15 seconds",
}
},
);
const userImage = await favoriteLocator.$(SELECTORS.FAVORITES_USER_IMAGE);
return userImage;
Expand All @@ -220,26 +220,26 @@ export default class FavoritesSidebar extends UplinkMainScreen {
await driver[this.executor].waitUntil(
async () => {
return await favoriteLocator.$(
SELECTORS.FAVORITES_USER_IMAGE_GROUP_WRAP
SELECTORS.FAVORITES_USER_IMAGE_GROUP_WRAP,
);
},
{
timeout: 15000,
timeoutMsg:
"Expected user image group wrap was never displayed on Favorites Sidebar after 15 seconds",
}
},
);

const userImageGroupWrap = await favoriteLocator.$(
SELECTORS.FAVORITES_USER_IMAGE_GROUP_WRAP
SELECTORS.FAVORITES_USER_IMAGE_GROUP_WRAP,
);
return userImageGroupWrap;
}

async getFavoritesUserImageProfile(username: string) {
const favoriteLocator = await this.getFavoritesUserByAriaLabel(username);
const imageProfile = await favoriteLocator.$(
SELECTORS.FAVORITES_USER_IMAGE_PROFILE
SELECTORS.FAVORITES_USER_IMAGE_PROFILE,
);
await imageProfile.waitForExist();
return imageProfile;
Expand All @@ -248,7 +248,7 @@ export default class FavoritesSidebar extends UplinkMainScreen {
async getFavoritesUserImageWrap(username: string) {
const favoriteLocator = await this.getFavoritesUserByAriaLabel(username);
const userImageWrap = await favoriteLocator.$(
SELECTORS.FAVORITES_USER_IMAGE_WRAP
SELECTORS.FAVORITES_USER_IMAGE_WRAP,
);
await userImageWrap.waitForExist();
return userImageWrap;
Expand All @@ -257,7 +257,7 @@ export default class FavoritesSidebar extends UplinkMainScreen {
async getFavoritesUserIndicator(username: string) {
const favoriteLocator = await this.getFavoritesUserByAriaLabel(username);
const indicator = await favoriteLocator.$(
SELECTORS.FAVORITES_USER_INDICATOR
SELECTORS.FAVORITES_USER_INDICATOR,
);
await indicator.waitForExist();
return indicator;
Expand All @@ -266,7 +266,7 @@ export default class FavoritesSidebar extends UplinkMainScreen {
async getFavoritesUserIndicatorOffline(username: string) {
const favoriteLocator = await this.getFavoritesUserByAriaLabel(username);
const indicatorOffline = await favoriteLocator.$(
SELECTORS.FAVORITES_USER_INDICATOR_OFFLINE
SELECTORS.FAVORITES_USER_INDICATOR_OFFLINE,
);
await indicatorOffline.waitForExist();
return indicatorOffline;
Expand All @@ -277,18 +277,18 @@ export default class FavoritesSidebar extends UplinkMainScreen {
await driver[this.executor].waitUntil(
async () => {
return await favoriteLocator.$(
SELECTORS.FAVORITES_USER_INDICATOR_ONLINE
SELECTORS.FAVORITES_USER_INDICATOR_ONLINE,
);
},
{
timeout: 15000,
timeoutMsg:
"Expected indicator online was never displayed on Favorite User after 15 seconds",
}
},
);

const indicatorOnline = await favoriteLocator.$(
SELECTORS.FAVORITES_USER_INDICATOR_ONLINE
SELECTORS.FAVORITES_USER_INDICATOR_ONLINE,
);
return indicatorOnline;
}
Expand All @@ -314,7 +314,7 @@ export default class FavoritesSidebar extends UplinkMainScreen {
timeout: 15000,
timeoutMsg:
"Expected Context Menu was never displayed after 15 seconds",
}
},
);
}

Expand Down Expand Up @@ -370,7 +370,7 @@ export default class FavoritesSidebar extends UplinkMainScreen {
{
timeout: 15000,
timeoutMsg: "Expected Favorites were never displayed after 15 seconds",
}
},
);
}

Expand All @@ -380,9 +380,8 @@ export default class FavoritesSidebar extends UplinkMainScreen {
}

async validateFavoritesIndicatorOnline(username: string) {
const indicatorOnline = await this.getFavoritesUserIndicatorOnline(
username
);
const indicatorOnline =
await this.getFavoritesUserIndicatorOnline(username);
await indicatorOnline.waitForDisplayed();
}
}
4 changes: 2 additions & 2 deletions tests/screenobjects/chats/QuickProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export default class QuickProfile extends UplinkMainScreen {

get quickProfileUserVolumeLabelText() {
return this.quickProfileUserVolumeLabel.$(
SELECTORS.QUICK_PROFILE_USER_VOLUME_LABEL_TEXT
SELECTORS.QUICK_PROFILE_USER_VOLUME_LABEL_TEXT,
);
}

Expand All @@ -186,7 +186,7 @@ export default class QuickProfile extends UplinkMainScreen {

get quickProfileUserVolumeRangeInput() {
return this.quickProfileUserVolumeRange.$(
SELECTORS.QUICK_PROFILE_USER_VOLUME_RANGE_INPUT
SELECTORS.QUICK_PROFILE_USER_VOLUME_RANGE_INPUT,
);
}

Expand Down
11 changes: 5 additions & 6 deletions tests/screenobjects/chats/SidebarSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export default class SidebarSearch extends UplinkMainScreen {

get sidebarSearchParticipantInGroupResult() {
return this.instance.$$(
SELECTORS.SIDEBAR_SEARCH_PARTICIPANT_IN_GROUP_RESULT
SELECTORS.SIDEBAR_SEARCH_PARTICIPANT_IN_GROUP_RESULT,
);
}

Expand Down Expand Up @@ -309,9 +309,8 @@ export default class SidebarSearch extends UplinkMainScreen {
// Search bar methods

async clickOnGroupResultFromSidebarSearch(result: number) {
const elementToClick = await this.getSidebarSearchGroupResultLocator(
result
);
const elementToClick =
await this.getSidebarSearchGroupResultLocator(result);
await elementToClick.click();
}

Expand Down Expand Up @@ -379,7 +378,7 @@ export default class SidebarSearch extends UplinkMainScreen {

async getSidebarSearchResultsParticipantsInGroups() {
const list = await this.instance.$$(
SELECTORS.SIDEBAR_SEARCH_PARTICIPANT_IN_GROUP_RESULT
SELECTORS.SIDEBAR_SEARCH_PARTICIPANT_IN_GROUP_RESULT,
);
let results = [];
for (let item of list) {
Expand Down Expand Up @@ -407,7 +406,7 @@ export default class SidebarSearch extends UplinkMainScreen {

async getSidebarSearchParticipantInGroupResultLocator(result: number) {
let element = await this.instance.$$(
SELECTORS.SIDEBAR_SEARCH_PARTICIPANT_IN_GROUP_RESULT
SELECTORS.SIDEBAR_SEARCH_PARTICIPANT_IN_GROUP_RESULT,
)[result];
return element;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/screenobjects/settings/SettingsBaseScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ export default class SettingsBaseScreen extends UplinkMainScreen {
}

async getCurrentDriver() {
const currentDriver = await driver[this.executor].capabilities
.automationName;
const currentDriver =
await driver[this.executor].capabilities.automationName;
return currentDriver;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/screenobjects/settings/SettingsDeveloperScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ export default class SettingsDeveloperScreen extends SettingsBaseScreen {
}

async clickOnCompressAndDownloadCache() {
const compressAndDownloadCacheButton = await this
.compressAndDownloadCacheButton;
const compressAndDownloadCacheButton =
await this.compressAndDownloadCacheButton;
await compressAndDownloadCacheButton.click();
}

Expand Down
8 changes: 4 additions & 4 deletions tests/screenobjects/settings/SettingsExtensionsScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,12 @@ export default class SettingsExtensionsScreen extends SettingsBaseScreen {
async clickOnEnableAutomatically() {
const currentDriver = await this.getCurrentDriver();
if (currentDriver === WINDOWS_DRIVER) {
const enableAutomaticallyCheckbox = await this
.enableAutomaticallyCheckbox;
const enableAutomaticallyCheckbox =
await this.enableAutomaticallyCheckbox;
await enableAutomaticallyCheckbox.click();
} else if (currentDriver === MACOS_DRIVER) {
const enableAutomaticallyCheckbox = await this
.enableAutomaticallyCheckbox;
const enableAutomaticallyCheckbox =
await this.enableAutomaticallyCheckbox;
await clickOnSwitchMacOS(enableAutomaticallyCheckbox, this.executor);
}
}
Expand Down
12 changes: 6 additions & 6 deletions tests/screenobjects/settings/SettingsNotificationsScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ export default class SettingsNotificationsScreen extends SettingsBaseScreen {
async clickOnFriendsNotifications() {
const currentDriver = await this.getCurrentDriver();
if (currentDriver === WINDOWS_DRIVER) {
const friendsNotificationsCheckbox = await this
.friendsNotificationsCheckbox;
const friendsNotificationsCheckbox =
await this.friendsNotificationsCheckbox;
await friendsNotificationsCheckbox.click();
} else if (currentDriver === MACOS_DRIVER) {
const locator = await this.friendsNotificationsCheckbox;
Expand All @@ -178,8 +178,8 @@ export default class SettingsNotificationsScreen extends SettingsBaseScreen {
async clickOnMessagesNotifications() {
const currentDriver = await this.getCurrentDriver();
if (currentDriver === WINDOWS_DRIVER) {
const messagesNotificationsCheckbox = await this
.messagesNotificationsCheckbox;
const messagesNotificationsCheckbox =
await this.messagesNotificationsCheckbox;
await messagesNotificationsCheckbox.click();
} else if (currentDriver === MACOS_DRIVER) {
const locator = await this.messagesNotificationsCheckbox;
Expand All @@ -190,8 +190,8 @@ export default class SettingsNotificationsScreen extends SettingsBaseScreen {
async clickOnSettingsNotifications() {
const currentDriver = await this.getCurrentDriver();
if (currentDriver === WINDOWS_DRIVER) {
const settingsNotificationsCheckbox = await this
.settingsNotificationsCheckbox;
const settingsNotificationsCheckbox =
await this.settingsNotificationsCheckbox;
await settingsNotificationsCheckbox.click();
} else if (currentDriver === MACOS_DRIVER) {
const locator = await this.settingsNotificationsCheckbox;
Expand Down
6 changes: 3 additions & 3 deletions tests/specs/01-create-account.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { USER_A_INSTANCE } from "@helpers/constants";
import CreatePinScreen from "@screenobjects/account-creation/CreatePinScreen";
import CreateUserScreen from "@screenobjects/account-creation/CreateUserScreen";
import WelcomeScreen from "@screenobjects/welcome-screen/WelcomeScreen";
let createPinFirstUser = new CreatePinScreen(USER_A_INSTANCE);
let createUserFirstUser = new CreateUserScreen(USER_A_INSTANCE);
let welcomeScreenFirstUser = new WelcomeScreen(USER_A_INSTANCE);
const createPinFirstUser = new CreatePinScreen(USER_A_INSTANCE);
const createUserFirstUser = new CreateUserScreen(USER_A_INSTANCE);
const welcomeScreenFirstUser = new WelcomeScreen(USER_A_INSTANCE);

export default async function createAccount() {
it("Validate warning texts are displayed on screen", async () => {
Expand Down
16 changes: 8 additions & 8 deletions tests/specs/02-chats.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ import FriendsScreen from "@screenobjects/friends/FriendsScreen";
import SettingsProfileScreen from "@screenobjects/settings/SettingsProfileScreen";
import WelcomeScreen from "@screenobjects/welcome-screen/WelcomeScreen";
import { USER_A_INSTANCE } from "@helpers/constants";
let filesScreenFirstUser = new FilesScreen(USER_A_INSTANCE);
let friendsScreenFirstUser = new FriendsScreen(USER_A_INSTANCE);
let chatsSidebarFirstUser = new ChatsSidebar(USER_A_INSTANCE);
let settingsProfileFirstUser = new SettingsProfileScreen(USER_A_INSTANCE);
let slimbarFirstUser = new FavoritesSidebar(USER_A_INSTANCE);
let welcomeScreenFirstUser = new WelcomeScreen(USER_A_INSTANCE);
const filesScreenFirstUser = new FilesScreen(USER_A_INSTANCE);
const friendsScreenFirstUser = new FriendsScreen(USER_A_INSTANCE);
const chatsSidebarFirstUser = new ChatsSidebar(USER_A_INSTANCE);
const settingsProfileFirstUser = new SettingsProfileScreen(USER_A_INSTANCE);
const slimbarFirstUser = new FavoritesSidebar(USER_A_INSTANCE);
const welcomeScreenFirstUser = new WelcomeScreen(USER_A_INSTANCE);

export default async function chats() {
it("Validate Pre Release Indicator is displayed and has correct text", async () => {
await welcomeScreenFirstUser.prereleaseIndicator.waitForExist();
const prereleaseIndicatorText =
await welcomeScreenFirstUser.prereleaseIndicatorText;
await expect(prereleaseIndicatorText).toHaveTextContaining(
"Pre-release | Issues/Feedback"
"Pre-release | Issues/Feedback",
);
});

Expand All @@ -42,7 +42,7 @@ export default async function chats() {
await welcomeScreenFirstUser.addFriendsButton.waitForExist();
const addSomeoneText = await welcomeScreenFirstUser.addSomeoneText;
await expect(addSomeoneText).toHaveTextContaining(
"Things are better with friends."
"Things are better with friends.",
);
});

Expand Down
6 changes: 3 additions & 3 deletions tests/specs/03-files.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import ChatsSidebar from "@screenobjects/chats/ChatsSidebar";
import FilesScreen from "@screenobjects/files/FilesScreen";
import FriendsScreen from "@screenobjects/friends/FriendsScreen";
import { USER_A_INSTANCE } from "@helpers/constants";
let chatsSidebarFirstUser = new ChatsSidebar(USER_A_INSTANCE);
let filesScreenFirstUser = new FilesScreen(USER_A_INSTANCE);
let friendsScreenFirstUser = new FriendsScreen(USER_A_INSTANCE);
const chatsSidebarFirstUser = new ChatsSidebar(USER_A_INSTANCE);
const filesScreenFirstUser = new FilesScreen(USER_A_INSTANCE);
const friendsScreenFirstUser = new FriendsScreen(USER_A_INSTANCE);

export default async function files() {
it("Validate Pre Release Indicator is displayed and has correct text", async () => {
Expand Down
14 changes: 7 additions & 7 deletions tests/specs/04-friends.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import {
USER_A_INSTANCE,
} from "@helpers/constants";
import UplinkMainScreen from "@screenobjects/UplinkMainScreen";
let chatsInputFirstUser = new InputBar(USER_A_INSTANCE);
let chatsLayoutFirstUser = new ChatsLayout(USER_A_INSTANCE);
let chatsSidebarFirstUser = new ChatsSidebar(USER_A_INSTANCE);
let favoritesSidebarFirstUser = new FavoritesSidebar(USER_A_INSTANCE);
let friendsScreenFirstUser = new FriendsScreen(USER_A_INSTANCE);
let uplinkMainFirstUser = new UplinkMainScreen(USER_A_INSTANCE);
const chatsInputFirstUser = new InputBar(USER_A_INSTANCE);
const chatsLayoutFirstUser = new ChatsLayout(USER_A_INSTANCE);
const chatsSidebarFirstUser = new ChatsSidebar(USER_A_INSTANCE);
const favoritesSidebarFirstUser = new FavoritesSidebar(USER_A_INSTANCE);
const friendsScreenFirstUser = new FriendsScreen(USER_A_INSTANCE);
const uplinkMainFirstUser = new UplinkMainScreen(USER_A_INSTANCE);
const users = ["ChatUserB", "ChatUserC", "ChatUserD"];

export default async function friends() {
Expand Down Expand Up @@ -515,7 +515,7 @@ export default async function friends() {

it("Context Menu - Add friend to Favorites and contents displayed on Favorites Sidebar", async () => {
// Open Context Menu from first user listed in Friends List
let friendName = await friendsScreenFirstUser.getUserFromAllFriendsList();
const friendName = await friendsScreenFirstUser.getUserFromAllFriendsList();
await friendsScreenFirstUser.openFriendContextMenu(friendName);

// Select second option "Favorites" from Context Menu
Expand Down
Loading

0 comments on commit d5e788f

Please sign in to comment.