Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/_reusable_run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ jobs:
{
echo "## 📊 Allure Report Generated Successfully";
echo "";
echo "**Artifact Name:** \`html-report-${{ github.run_number }}\`";
echo "**Artifact Name:** \`html-report-${{ github.run_number }}-${{ env.SANITIZED_BRANCH }}\`";
echo "";
echo "### 📥 How to View the Report";
echo "";
Expand Down
1 change: 1 addition & 0 deletions WireUI/Sources/WireLocators/Locators.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public enum Locators {
case blockButtonOnBottomSheet
case bottomBarArchivedButton
case accountProfileImageView
case loadBar
}

public enum SettingsPage: String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import UIKit
import WireDesign
import WireLocators
import WireLogging
import WireSystem

Expand Down Expand Up @@ -106,8 +107,9 @@ final class NetworkStatusView: UIView {

override init(frame: CGRect) {
self.connectingView = BreathLoadingBar.withDefaultAnimationDuration()
connectingView.accessibilityIdentifier = "LoadBar"
connectingView.accessibilityIdentifier = Locators.ConversationsPage.loadBar.rawValue
self.offlineView = OfflineBar()
offlineView.accessibilityIdentifier = "offlineLoadbar"

super.init(frame: frame)

Expand Down
2 changes: 1 addition & 1 deletion wire-ios/WireUITests/Pages/ActiveConversationPage .swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ActiveConversationPage: PageModel {
}

var messageLabels: XCUIElementQuery {
app.textViews.matching(identifier: Locators.ActiveConversationPage.message.rawValue)
app.descendants(matching: .any).matching(identifier: Locators.ActiveConversationPage.message.rawValue)
}

func getSenderName() -> String? {
Expand Down
16 changes: 9 additions & 7 deletions wire-ios/WireUITests/Pages/ConversationsPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ class ConversationsPage: PageModel {
app.buttons[Locators.ConversationsPage.accountProfileImageView.rawValue]
}

var loadBar: XCUIElement {
app.descendants(matching: .any)[Locators.ConversationsPage.loadBar.rawValue]
}

func openSettings() throws -> SettingsPage {
settingsButton.tap()
return try SettingsPage()
Expand All @@ -75,7 +79,7 @@ class ConversationsPage: PageModel {
}

func openUserProfilePage() throws -> UserProfilePage {
try VerifyUserIsOnConversationsTab()
try letTheSyncfinish()
accountProfileImageView.waitAndTap()
return try UserProfilePage()
}
Expand All @@ -86,6 +90,7 @@ class ConversationsPage: PageModel {
}

func openPendingRequest() throws -> ConnectionRequestsPage {
try letTheSyncfinish()
XCTAssertTrue(conversationCell.waitForExistence(timeout: 5), "Conversation cell did not appear")

let maxDuration: TimeInterval = 10
Expand All @@ -101,6 +106,7 @@ class ConversationsPage: PageModel {
}

func openConversation() throws -> ActiveConversationPage {
try letTheSyncfinish()
XCTAssertTrue(conversationCell.waitForExistence(timeout: 5), "Conversation cell did not appear")

let maxDuration: TimeInterval = 10
Expand Down Expand Up @@ -130,11 +136,7 @@ class ConversationsPage: PageModel {
conversationCell.label
}

// Problem: Opening the user profile can occasionally fail while sync is in progress after login
// Workaround: Assert the presence of some UI elements to give the sync time to complete.
func VerifyUserIsOnConversationsTab() throws {
XCTAssertTrue(plusButtonToCreateGroup.exists)
XCTAssertTrue(archivedButton.exists)
XCTAssert(settingsButton.exists)
func letTheSyncfinish() throws {
loadBar.waitToDisappear()
}
}
23 changes: 10 additions & 13 deletions wire-ios/WireUITests/Pages/OptionsOnSettingsPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,19 @@ class OptionsOnSettingsPage: PageModel {
return self
}

func enterPasscode(_ pass: String) throws -> ConversationsPage {
func enterPasscode(_ passcode: String) throws -> ConversationsPage {
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
let passcodeField = springboard.secureTextFields["Passcode field"].firstMatch

guard passcodeField.waitAndTap()
else {
XCTFail("Passcode SecureTextField did not appear")
throw XCTSkip("Passcode field not available")
}
try passcodeField.tapIfKeyboardNotFocused().typeText(pass)

let doneButton = springboard.keyboards.buttons["Done"].firstMatch
if doneButton.waitAndTap() {
// Tapped successfully
} else {
springboard.typeText(XCUIKeyboardKey.return.rawValue)
// Sometimes the splashscreen stays visible for unexpectedly long.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: it's good as a workaround, but to me we should investigate what's going on:

  • when does this happen?
  • and extract the app logs when this happens

it could hide a bigger issue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely agree to avoid any workarounds but currently the 2 tests flaky behaviour is weird on Ci not on local:

  • For the test where it fails to open user profile - it simply closes the app when app is in sync doesn;t wait for the next page element which is ~15 seconds
openinguserprofile.mp4
  • Foe the seconds issue: with app lock with passcode - coming from background to foreground, sometime it takes loner on splashscreen so increase the time out and also observed that, without performing tap() if we directly typeText() it works as fallback in case of secureText is not able to locate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found it.. the tap is actually being performed not on the exact button.
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Locally I fail to replicate. This same function is being used few places but all works fine except one test.

if passcodeField.waitAndTap(timeout: 8.0) {
try passcodeField.tapIfKeyboardNotFocused().typeText(passcode)
let doneButton = springboard.keyboards.buttons["Done"].firstMatch
if doneButton.waitAndTap() {
// Tapped successfully
} else {
springboard.typeText(XCUIKeyboardKey.return.rawValue)
}
}
return try ConversationsPage()
}
Expand Down
4 changes: 3 additions & 1 deletion wire-ios/WireUITests/Pages/PhotosAppPage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ class PhotosAppPage: PageModel {
}

func selectConversation(name: String) -> XCUIElement {
photosApp.staticTexts[name].firstMatch
var conversationCell = photosApp.staticTexts[name]
XCTAssertTrue(conversationCell.waitForExistence(timeout: timeout))
return conversationCell.firstMatch
}

@discardableResult
Expand Down
Loading