Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions e2e/pageobjects/Home/ForYouScreen.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@ class ForYouScreen {
get notificationsTab() {
return $('~NotificationsTab');
}
get messagingTab() {
return $('~MessagesTab');
}

async switchToNotificationsTab() {
await this.notificationsTab.waitForDisplayed();
await this.notificationsTab.click();
}

async switchToMessagingTab() {
await this.messagingTab.waitForDisplayed();
await this.messagingTab.click();
}

async openSideMenu() {
await this.sideMenuButton.waitForDisplayed();
await this.sideMenuButton.click();
Expand Down
5 changes: 5 additions & 0 deletions e2e/pageobjects/Home/SidebarScreen.page.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ class SidebarScreen {
await this.profileButton.click();
}

async goToChat() {
await this.chatButton.waitForDisplayed();
await this.chatButton.click();
}

async isDisplayed() {
return (
(await this.logoutButton.isDisplayed()) &&
Expand Down
111 changes: 111 additions & 0 deletions e2e/pageobjects/Messages/ChatScreen.page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import { $, $$, browser, driver } from '@wdio/globals';

class ChatScreen {
get noMessagesText() {
return $('android=new UiSelector().text("No messages yet. Start the conversation.")');
}

get messageInput() {
return $('~chat-input');
}

get sendMessageButton() {
return $('~send-message-button');
}

get scrollBottomButton() {
return $('~scroll-bottom-chat');
}

get messageContent() {
return $$('~message-content');
}

get messageSent() {
return $('android=new UiSelector().textContains("Sent")');
}

async isNoMessagesYetDisplayed() {
return this.noMessagesText.isDisplayed();
}

async isCorrectUsernameDisplayed(username) {
const usernameSelector = $(`android=new UiSelector().text("${username}")`);
await usernameSelector.waitForDisplayed();
return usernameSelector.isDisplayed();
}

async isCorrectDisplayNameDisplayed(displayName) {
const displayNameSelector = $(`android=new UiSelector().text("${displayName}")`);
await displayNameSelector.waitForDisplayed();
return displayNameSelector.isDisplayed();
}

async typeMessage(message) {
await this.messageInput.waitForDisplayed();
await this.messageInput.setValue(message);
}

async sendMessage() {
await this.sendMessageButton.waitForDisplayed();
await this.sendMessageButton.click();
}

async scrollToBottom() {
await this.scrollBottomButton.waitForDisplayed();
await this.scrollBottomButton.click();
}

async isScrollBottomDisplayed() {
return this.scrollBottomButton.isDisplayed();
}

async isMessageDisplayed(message) {
const messageSelector = $(`android=new UiSelector().text("${message}")`);
await messageSelector.waitForDisplayed();
return messageSelector.isDisplayed();
}

async isMessageSentDisplayed() {
await this.messageSent.waitForDisplayed();
return this.messageSent.isDisplayed();
}

async goToUserProfile(displayName) {
const displayNameSelector = $(`android=new UiSelector().text("${displayName}")`);
await displayNameSelector.waitForDisplayed();
await displayNameSelector.click();
}

async scrollUp() {
const { width, height } = await browser.getWindowRect();

const anchorX = width * 0.5;
const startY = height * 0.2;
const endY = height * 0.7;

await browser.performActions([
{
type: 'pointer',
id: 'finger1',
parameters: { pointerType: 'touch' },
actions: [
{ type: 'pointerMove', duration: 0, x: anchorX, y: startY },
{ type: 'pointerDown', button: 0 },
{ type: 'pause', duration: 100 },
{ type: 'pointerMove', duration: 800, x: anchorX, y: endY },
{ type: 'pointerUp', button: 0 },
],
},
]);

await browser.pause(800);
}

async goBack() {
await driver.back();
await driver.pause(500);
}
}

export default new ChatScreen();
117 changes: 117 additions & 0 deletions e2e/pageobjects/Messages/MessagesScreen.page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
import { $, $$, browser, driver } from '@wdio/globals';

class MessagesScreen {
get screenTitle() {
return $('android=new UiSelector().text("Messages")');
}

get noConvosMessage() {
return $('android=new UiSelector().text("No conversations")');
}

get newMessageButton() {
return $('~new-message-button');
}

get cancelNewMessageButton() {
return $('android=new UiSelector().text("Cancel")');
}

get newMessageSearchInput() {
return $('~new-message-search-input');
}

get newMessageBackdrop() {
return $('~new-message-backdrop');
}

get newMessageRecipients() {
return $$('~new-message-recipient');
}

get recipientDisplayNames() {
return $$('~recipient-display-name');
}

get recipientUsernames() {
return $$('~recipient-username');
}

get sideMenuButton() {
return $('~open-drawer-button');
}

get noUsersFound() {
return $('android=new UiSelector().text("No users found")');
}

get conversations() {
return $$('~conversation-list-item');
}

get conversationUsernames() {
return $$('~conversation-username');
}

get conversationPreviews() {
return $$('~conversation-preview');
}

get conversationUnreadIndicator() {
return $$('~conversation-unread');
}

get badgeCount() {
return $('~badge-count');
}

async openSideMenu() {
await this.sideMenuButton.waitForDisplayed();
await this.sideMenuButton.click();
}

async clickNewMessageButton() {
await this.newMessageButton.waitForDisplayed();
await this.newMessageButton.click();
}

async cancelNewMessage() {
await this.cancelNewMessageButton.waitForDisplayed();
await this.cancelNewMessageButton.click();
}

async searchFor(username) {
await this.newMessageSearchInput.waitForDisplayed();
await this.newMessageSearchInput.setValue(username);
}

async refresh() {
await browser.swipe({
direction: 'down',
percent: 1, // 100%
});
}

async goBack() {
await driver.back();
await driver.pause(500);
}

async isNewMessageDrawerDisplayed() {
return (
this.newMessageBackdrop.isDisplayed() &&
this.newMessageSearchInput.isDisplayed() &&
this.cancelNewMessageButton.isDisplayed()
);
}

async isNoUsersFoundDisplayed() {
return this.noUsersFound.waitForDisplayed();
}

async isNoConversationsMessageDisplayed() {
return this.noConvosMessage.isDisplayed();
}
}

export default new MessagesScreen();
Loading