Skip to content

Commit

Permalink
chore(appium): adding methods for scroll up and down on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
luisecm committed Jan 11, 2024
1 parent c23886a commit eb67418
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
8 changes: 8 additions & 0 deletions tests/helpers/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,14 @@ export async function hoverOnMacOS(locator: WebdriverIO.Element) {
]);
}

export async function scrollUp(deltaX: number) {
await mouse.scrollUp(deltaX);
}

export async function scrollDown(deltaX: number) {
await mouse.scrollDown(deltaX);
}

export async function saveFileOnMacOS(filename: string) {
// Wait for Save Dialog to be displayed
const savePanel = await $("~save-panel");
Expand Down
4 changes: 2 additions & 2 deletions tests/screenobjects/chats/ChatsLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export default class ChatsLayout extends UplinkMainScreen {
}

async clickOnScrollToBottom() {
const scrollToBottomButton = await this.scrollToBottomButton;
await scrollToBottomButton.click();
await this.scrollToBottomButton.waitForDisplayed();
await this.scrollToBottomButton.click();
}

async validateChatLayoutIsShown() {
Expand Down
14 changes: 13 additions & 1 deletion tests/specs/reusable-accounts/05-message-attachments.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import Topbar from "@screenobjects/chats/Topbar";
import {
launchFirstApplication,
launchSecondApplication,
scrollUp,
} from "@helpers/commands";
const chatsAttachment = new ComposeAttachment();
const chatsInput = new InputBar();
Expand Down Expand Up @@ -181,11 +182,22 @@ export default async function messageAttachmentsTests() {
await chatsInput.typeMessageOnInput("Attached2");
await chatsInput.pressEnterKeyOnInputBar();
await messageLocal.waitForMessageSentToExist("Attached2");

// Click on last file sent timestamp to move cursor into chat conversation
const timestamp = await messageLocal.getLastMessageSentFileName();
await timestamp.click();
});

it("User can scroll to bottom of chat conversation", async () => {
// Scroll up 1000 px to ensure that the scroll to bottom button is displayed
await scrollUp(1000);

// Click on Scroll to Bottom button
await chatsLayout.clickOnScrollToBottom();
await messageLocal.chatMessageFileEmbedLocal.waitForDisplayed();

// Validate that last message is displayed again screen
const lastMessage = await messageLocal.chatMessageFileEmbedLocal;
await lastMessage.waitForDisplayed();
});

it("Send Files on Chats - Message Sent With Attachment - Attachment Contents", async () => {
Expand Down

0 comments on commit eb67418

Please sign in to comment.