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

[CI] Fix flaky tests #654

Merged
merged 1 commit into from
Nov 15, 2024
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
4 changes: 4 additions & 0 deletions StreamChatSwiftUITestsAppTests/Pages/MessageListPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ class MessageListPage {
static func giphyCancelButton(in messageCell: XCUIElement) -> XCUIElement {
attachmentActionButton(in: messageCell, label: "Cancel")
}

static func giphyImage(in messageCell: XCUIElement) -> XCUIElement {
messageCell.otherElements["GiphyAttachmentView"].images.firstMatch
}

static func giphyLabel(in messageCell: XCUIElement) -> XCUIElement {
messageCell.staticTexts["GiphyAttachmentView"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ extension UserRobot {
) -> Self {
let cell = messageCell(withIndex: messageCellIndex, file: file, line: line).wait()
XCTAssertTrue(attributes.giphyLabel(in: cell).wait().exists, "Giphy label does not exist")
XCTAssertEqual(0, attributes.giphyButtons(in: cell).count)
XCTAssertTrue(attributes.giphyImage(in: cell).exists, "Giphy image does not exist")
return self
}

Expand Down
2 changes: 1 addition & 1 deletion StreamChatSwiftUITestsAppTests/Robots/UserRobot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ extension UserRobot {
typeText("/giphy")
sendMessage(text, waitForAppearance: false)
}
if send { tapOnSendGiphyButton() }
MessageListPage.Attributes.actionButtons().firstMatch.wait()
if send { tapOnSendGiphyButton() }
return self
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,14 @@ final class Ephemeral_Messages_Tests: StreamTestCase {

func test_userObservesAnimatedGiphy_whenUserAddsGiphyMessage() throws {
linkToScenario(withId: 435)

try XCTSkipIf(
ProcessInfo().operatingSystemVersion.majorVersion > 16,
"The test cannot tap on a `Send` button on iOS 17"
)

GIVEN("user opens a channel") {
userRobot
.login()
.openChannel()
}
WHEN("user sends a giphy using giphy command") {
userRobot.sendGiphy()
userRobot.sendGiphy(useComposerCommand: true)
}
THEN("user observes the animated gif") {
userRobot.assertGiphyImage()
Expand Down Expand Up @@ -141,11 +136,6 @@ final class Ephemeral_Messages_Tests: StreamTestCase {

func test_userObservesAnimatedGiphy_afterAddingGiphyThroughComposerMenu() throws {
linkToScenario(withId: 441)

try XCTSkipIf(
ProcessInfo().operatingSystemVersion.majorVersion > 16,
"The test cannot tap on a `Send` button on iOS 17"
)

GIVEN("user opens a channel") {
userRobot
Expand Down
Loading