Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(update): add wait for shown before interacting #565

Merged
merged 1 commit into from
Dec 12, 2023
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
7 changes: 7 additions & 0 deletions tests/specs/reusable-accounts/04-message-input.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
activateFirstApplication,
activateSecondApplication,
} from "@helpers/commands";
import chats from "@specs/02-chats.spec";
const chatsLayoutFirstUser = new ChatsLayout(USER_A_INSTANCE);
const chatsInputFirstUser = new InputBar(USER_A_INSTANCE);
const chatsMessagesFirstUser = new Messages(USER_A_INSTANCE);
Expand All @@ -17,6 +18,7 @@ export default async function messageInputTests() {
it("Chat User A - Message Input - User cannot send empty messages", async () => {
// Ensure that input bar is empty and click on send message button
await activateFirstApplication();
await chatsInputFirstUser.waitForIsShown(true);
await chatsInputFirstUser.clearInputBar();
await chatsInputFirstUser.clickOnInputBar();
await chatsInputFirstUser.clickOnSendMessage();
Expand Down Expand Up @@ -148,6 +150,7 @@ export default async function messageInputTests() {
it("Chat Input Text - Validate messages with bold markdowns were received in expected format", async () => {
// With Chat User B, validate message with with ** markdown was received in bolds
await activateSecondApplication();
await chatsInputFirstUser.waitForIsShown(true);
await chatsMessagesFirstUser.waitForReceivingMessage("Bolds1");

// With Chat User B, validate message with with __ markdown was received in bolds
Expand All @@ -166,6 +169,7 @@ export default async function messageInputTests() {
it("Chat Input Text - Validate text starting with https:// is sent as link", async () => {
// With Chat User A
await activateFirstApplication();
await chatsInputFirstUser.waitForIsShown(true);
await chatsInputFirstUser.typeMessageOnInput("https://www.google.com");
await chatsInputFirstUser.clickOnSendMessage();
await chatsMessagesFirstUser.waitForLinkSentToExist("Google");
Expand Down Expand Up @@ -200,6 +204,7 @@ export default async function messageInputTests() {
it("Chat Input Text - Validate messages with links were received correctly", async () => {
// With Chat User B, validate message with URL starting with https:// was received as link
await activateSecondApplication();
await chatsInputFirstUser.waitForIsShown(true);
await chatsMessagesFirstUser.waitForReceivingLink("Google");

// With Chat User B, validate message with URL starting with www. was received as link
Expand Down Expand Up @@ -229,6 +234,7 @@ export default async function messageInputTests() {
xit("Typing Indicator - Send a long message to trigger typing indicator on remote side", async () => {
// With User A
await activateFirstApplication();
await chatsInputFirstUser.waitForIsShown(true);
// Generate a random text with 100 chars
const shortText = await chatsInputFirstUser.generateShortRandomText();
// Type the text with 90 chars on input bar
Expand All @@ -239,6 +245,7 @@ export default async function messageInputTests() {
xit("Validate Typing Indicator is displayed if remote user is typing", async () => {
// Switch to second user and validate that Typing Indicator is displayed
await activateSecondApplication();
await chatsInputFirstUser.waitForIsShown(true);
await chatsLayoutFirstUser.typingIndicator.waitForExist({
timeout: 30000,
});
Expand Down
10 changes: 10 additions & 0 deletions tests/specs/reusable-accounts/07-quick-profile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import QuickProfile from "@screenobjects/chats/QuickProfile";
import Topbar from "@screenobjects/chats/Topbar";
import SettingsProfileScreen from "@screenobjects/settings/SettingsProfileScreen";
import WelcomeScreen from "@screenobjects/welcome-screen/WelcomeScreen";
import chats from "@specs/02-chats.spec";

const chatsInputFirstUser = new InputBar(USER_A_INSTANCE);
const chatsMessageGroupsFirstUser = new MessageGroup(USER_A_INSTANCE);
Expand Down Expand Up @@ -48,6 +49,7 @@ export default async function quickProfileTests() {
it("Chat User B - Validate contents from remote quick profile", async () => {
// With User B - Validate that message was received
await activateSecondApplication();
await chatsInputFirstUser.waitForIsShown(true);
await chatsInputFirstUser.clickOnInputBar();

// Open quick profile from remote user
Expand All @@ -74,6 +76,7 @@ export default async function quickProfileTests() {
it("Chat User A - Remove Friend", async () => {
// Open quick profile from remote user
await activateFirstApplication();
await chatsInputFirstUser.waitForIsShown(true);
await chatsMessageGroupsFirstUser.openRemoteQuickProfile();
await chatsQuickProfileFirstUser.quickProfile.waitForExist();

Expand All @@ -95,6 +98,7 @@ export default async function quickProfileTests() {
it("Chat User B - Validate friendship was removed", async () => {
// Switch control to User B
await activateSecondApplication();
await welcomeScreenFirstUser.waitForIsShown(true);

// With User B - Go to Friends and wait for User A to remove friendship with User B
await welcomeScreenFirstUser.goToFriends();
Expand All @@ -104,6 +108,7 @@ export default async function quickProfileTests() {
it("Chat User A - Send friend request again to User B", async () => {
// Obtain did key from Chat User B
await activateFirstApplication();
await friendsScreenFirstUser.waitForIsShown(true);
const friendDidKey = await getUserKey("ChatUserB", USER_A_INSTANCE);

// Send friend request to Chat User B
Expand All @@ -117,6 +122,7 @@ export default async function quickProfileTests() {
it("Chat User B - Validate that User A is now a friend", async () => {
// Switch control to User B
await activateSecondApplication();
await friendsScreenFirstUser.waitForIsShown(true);

// With User B - Go to pending requests list, wait for receiving the friend request and accept it
await friendsScreenFirstUser.hoverOnFriendsButton();
Expand All @@ -138,6 +144,7 @@ export default async function quickProfileTests() {
it("Chat User A - Wait until friend request is accepted again", async () => {
// Validate friend is now on all friends list
await activateFirstApplication();
await friendsScreenFirstUser.waitForIsShown(true);

// Validate friend is now on all friends list
await friendsScreenFirstUser.waitUntilUserAcceptedFriendRequest();
Expand All @@ -154,6 +161,7 @@ export default async function quickProfileTests() {
it("Chat User B - Send message to User B", async () => {
// Go to the current list of All friends and then open a Chat conversation with ChatUserA
await activateSecondApplication();
await friendsScreenFirstUser.waitForIsShown(true);
await friendsScreenFirstUser.validateChatWithFriendButtonIsShown();
await friendsScreenFirstUser.hoverOnChatWithFriendButton("ChatUserA");
await friendsScreenFirstUser.clickOnChatWithFriend();
Expand All @@ -169,6 +177,7 @@ export default async function quickProfileTests() {
it("Chat User A - Block Friend", async () => {
// Switch control to User A
await activateFirstApplication();
await chatsInputFirstUser.waitForIsShown(true);

// With User A - Validate that message was received
await chatsMessagesFirstUser.waitForReceivingMessage("Accepted...");
Expand Down Expand Up @@ -199,6 +208,7 @@ export default async function quickProfileTests() {
it("Chat User B - Validate that User A blocked User B", async () => {
// Switch control to User B
await activateSecondApplication();
await chatsInputFirstUser.waitForIsShown(true);

// With User B - Go to Friends and wait for User A to remove friendship with User B
await chatsInputFirstUser.goToFriends();
Expand Down
11 changes: 9 additions & 2 deletions tests/specs/reusable-accounts/08-sidebar-chats.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default async function sidebarChatsTests() {
it("Chat User A - Unblock the other Chat User", async () => {
// Switch to Chat User A window
await activateFirstApplication();
await friendsScreenFirstUser.waitForIsShown(true);

// Unblock Chat User B and go to Friends List to send a new friend request
await friendsScreenFirstUser.validateFriendsScreenIsShown();
Expand Down Expand Up @@ -62,6 +63,7 @@ export default async function sidebarChatsTests() {
it("Chat User B - Validate button badge displays the number of incoming requests", async () => {
// Switch to Chat User B window
await activateSecondApplication();
await friendsScreenFirstUser.waitForIsShown(true);

// Go to pending requests list, wait for receiving the friend request and accept it
await friendsScreenFirstUser.goToFriends();
Expand Down Expand Up @@ -111,6 +113,7 @@ export default async function sidebarChatsTests() {
it("Chat User A - Wait until Chat User B accepts friend request and sends a message", async () => {
// With User A - Wait until user B accepts the friend request
await activateFirstApplication();
await friendsScreenFirstUser.waitForIsShown(true);
await friendsScreenFirstUser.goToAllFriendsList();
await friendsScreenFirstUser.validateAllFriendsListIsShown();
await friendsScreenFirstUser.validateAllFriendsListIsShown();
Expand Down Expand Up @@ -169,12 +172,14 @@ export default async function sidebarChatsTests() {
it("Chat User B - Validate message was received", async () => {
// With User B - Wait until message is received
await activateSecondApplication();
await chatsSidebarFirstUser.waitForIsShown(true);
await chatsMessagesFirstUser.waitForReceivingMessage("Hi...");
});

it("Chat User A - Sidebar - Persists between different sections of the app - Files Screen", async () => {
// Validate on Files Screen that sidebar is displayed
await activateFirstApplication();
await chatsLayoutFirstUser.waitForIsShown(true);
await chatsLayoutFirstUser.goToFiles();
await filesScreenFirstUser.validateFilesScreenIsShown();
await chatsSidebarFirstUser.validateSidebarChatsIsShown();
Expand Down Expand Up @@ -213,6 +218,7 @@ export default async function sidebarChatsTests() {
it("Chat User B - Sidebar - Wait for receiving a a new message", async () => {
// Switch to Chat User B window
await activateSecondApplication();
await chatsInputFirstUser.waitForIsShown(true);

// With User B - Wait until message is received
await chatsMessagesFirstUser.waitForReceivingMessage("Hi...");
Expand All @@ -224,6 +230,7 @@ export default async function sidebarChatsTests() {
it("Chat User A - Sidebar - Context Menu - Delete chat", async () => {
// Switch to Chat User A window
await activateFirstApplication();
await chatsSidebarFirstUser.waitForIsShown(true);

// Open context menu and right click on Delete chat
await chatsSidebarFirstUser.openContextMenuOnSidebar("ChatUserB");
Expand All @@ -234,14 +241,14 @@ export default async function sidebarChatsTests() {
it("Chat User B - Sidebar - If user deletes chat on remote side, it will be removed on local side as well", async () => {
// Switch to Chat User B window
await activateSecondApplication();

// After user deletes chat conversation on remote side, chat is deleted on local side and Welcome Image displayed again
await welcomeScreenFirstUser.validateWelcomeScreenIsShown();
await welcomeScreenFirstUser.waitForIsShown(true);
});

it("Chat User A - Sidebar without messages sent displays No messages yet, sent one", async () => {
// Switch to Chat User A window
await activateFirstApplication();
await welcomeScreenFirstUser.waitForIsShown(true);

// Go to the current list of All friends and then open a Chat conversation with ChatUserA
await welcomeScreenFirstUser.goToFriends();
Expand Down
Loading