Skip to content

Commit

Permalink
Merge pull request #689 from Satellite-im/luis/flakky-tests
Browse files Browse the repository at this point in the history
test(update): fixes for flaky tests on CI
  • Loading branch information
luisecm authored May 21, 2024
2 parents bfcbe1b + 55affa6 commit 1672433
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 14 deletions.
12 changes: 8 additions & 4 deletions tests/screenobjects/chats/InputBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ class InputBar extends UplinkMainScreen {
async clickOnUploadFile() {
const uploadButton = await this.uploadButton;
await uploadButton.click();
const uploadButtonStorage = await this.uploadButtonStorage;
await uploadButtonStorage.waitForExist();
}

async generateRandomText() {
Expand Down Expand Up @@ -210,13 +212,15 @@ class InputBar extends UplinkMainScreen {
}

async selectUploadFromLocalDisk() {
await this.uploadButtonLocalDisk.waitForDisplayed();
await this.uploadButtonLocalDisk.click();
const uploadButtonLocalDisk = await this.uploadButtonLocalDisk;
await uploadButtonLocalDisk.waitForExist();
await uploadButtonLocalDisk.click();
}

async selectUploadFromStorage() {
await this.uploadButtonStorage.waitForDisplayed();
await this.uploadButtonStorage.click();
const uploadButtonStorage = await this.uploadButtonStorage;
await uploadButtonStorage.waitForExist();
await uploadButtonStorage.click();
}

async typeCodeOnInputBar(language: string, codeToType: string) {
Expand Down
1 change: 1 addition & 0 deletions tests/specs/04-friends.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default async function friendsTests() {

// Go to Friends Screen
await WelcomeScreen.goToFriends();
await FriendsScreen.waitForIsShown(true);

// Validate Pre Release Indicator is displayed
await FriendsScreen.releaseIndicator.waitForExist();
Expand Down
1 change: 1 addition & 0 deletions tests/specs/17-offline-requests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export default async function offlineRequestsTests() {
await launchSecondApplication();
await createNewUser(userB, true);
await WelcomeScreen.goToFriends();
await FriendsScreen.waitForIsShown(true);
});

it("Offline Friend Requests - Send Friend Request to user #1", async () => {
Expand Down
22 changes: 16 additions & 6 deletions tests/specs/reusable-accounts/05-message-attachments.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,14 @@ export default async function messageAttachmentTests() {
// Click on upload button and attach a file to compose attachment
await InputBar.uploadFileFromLocalDisk("./tests/fixtures/testfile.txt");

// Validate contents on Compose Attachments are displayed
await ComposeAttachment.composeAttachmentsFileEmbed.waitForExist();
await ComposeAttachment.composeAttachmentsFileIcon.waitForExist();
await ComposeAttachment.composeAttachmentsFileNameText.waitForExist();
// Validate compose attachments displays the files to be uploaded before sending the message
await ComposeAttachment.validateComposeAttachmentsIsShown();

// Obtain the list of attachments added to Compose Attachment
await ComposeAttachment.validateAttachmentWithFileNameIsAdded(
"testfile.txt",
true,
);
});

it("Send Files on Chats - Delete attachment before sending the message", async () => {
Expand All @@ -176,8 +180,14 @@ export default async function messageAttachmentTests() {
// Click on upload button and attach a file to compose attachment
await InputBar.uploadFileFromLocalDisk("./tests/fixtures/testfile.txt");

// Validate contents on Compose Attachments are displayed
await ComposeAttachment.composeAttachmentsFileEmbed.waitForExist();
// Validate compose attachments displays the files to be uploaded before sending the message
await ComposeAttachment.validateComposeAttachmentsIsShown();

// Obtain the list of attachments added to Compose Attachment
await ComposeAttachment.validateAttachmentWithFileNameIsAdded(
"testfile.txt",
true,
);

// Type a text message and send it
await InputBar.typeMessageOnInput("Attached2");
Expand Down
12 changes: 8 additions & 4 deletions tests/specs/reusable-accounts/06-chat-topbar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ export default async function chatTopbarTests() {
// Click on upload button and attach a file to compose attachment
await InputBar.uploadFileFromLocalDisk("./tests/fixtures/testfile.txt");

// Validate contents on Compose Attachments are displayed
await ComposeAttachment.composeAttachmentsFileEmbed.waitForExist();
await ComposeAttachment.composeAttachmentsFileIcon.waitForExist();
await ComposeAttachment.composeAttachmentsFileNameText.waitForExist();
// Validate compose attachments displays the files to be uploaded before sending the message
await ComposeAttachment.validateComposeAttachmentsIsShown();

// Obtain the list of attachments added to Compose Attachment
await ComposeAttachment.validateAttachmentWithFileNameIsAdded(
"testfile.txt",
true,
);

// Type a text message and send it
await InputBar.typeMessageOnInput("Attached2");
Expand Down
1 change: 1 addition & 0 deletions tests/specs/reusable-accounts/07-quick-profile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export default async function quickProfileTests() {
it("Chat User B - Ensure that Chat User B is not in friends list now", async () => {
// Get current list of All friends and ensure that it does not include the removed user
await WelcomeScreen.goToFriends();
await FriendsScreen.waitForIsShown(true);
const allFriendsList = await FriendsScreen.getAllFriendsList();
const includesFriend = await allFriendsList.includes("ChatUserA");
await expect(includesFriend).toEqual(false);
Expand Down
1 change: 1 addition & 0 deletions tests/specs/reusable-accounts/08-sidebar-chats.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ export default async function chatsSidebarTests() {

// Go to the current list of All friends and then open a Chat conversation with ChatUserA
await WelcomeScreen.goToFriends();
await FriendsScreen.waitForIsShown(true);
await FriendsScreen.validateChatWithFriendButtonIsShown();
await FriendsScreen.hoverOnChatWithFriendButton("ChatUserA");
await FriendsScreen.clickOnChatWithFriend();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default async function multipleUsersTests() {
await launchThirdApplication();
await CreatePinScreen.loginWithTestUser();
await WelcomeScreen.goToFriends();
await FriendsScreen.waitForIsShown(true);
await sendFriendRequestToUser("ChatUserA");
});

Expand Down

0 comments on commit 1672433

Please sign in to comment.