Skip to content

Conversation

@jostnes
Copy link
Contributor

@jostnes jostnes commented Jun 16, 2023

Description

Currently, there are a lot of "Failed to launch" errors being logged in Buildkite logs during UI test runs. This was a side effect of deleting the app after each test run.

In this PR, I've removed removeApp() from tearDown() and replaced it with a new launch argument -logout-at-launch that will be called at the start of each test. This will reset the state to log out at the start of every test run.

This change also comes with bonus speed improvements as the app is no longer removed after each test run (previously, the removal happened on the UI level). Below are screenshots to better visualize the before and after of the change:

Before change

(using the current latest trunk build for this comparison)

From .xresults:
image

From Buildkite (build):
image

iPhone total duration: 16m 24s
iPad total duration: 21m 18s

After change

From .xresults:
image

From Buildkite (build):
image

iPhone total duration: 13m 16s (⬇️ 3m 8s)
iPad total duration: 18m 17s (⬇️ 3m 1s)

Testing

Errors like [22:34:12]: ▸ 2023-06-15 22:34:12.514 xcodebuild[1865:17594] iOSSimulator: 5C8F2C2C-3188-492D-B8B5-AF71DED82192: Failed to launch app with identifier: com.automattic.jetpack and options: should no longer be logged in Buildkite logs and the test results file. CI should be 🟢

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jun 16, 2023

WordPress Alpha📲 You can test the changes from this Pull Request in WordPress Alpha by scanning the QR code below to install the corresponding build.
App NameWordPress Alpha WordPress Alpha
ConfigurationRelease-Alpha
Build Numberpr20891-10992b6
Version22.6
Bundle IDorg.wordpress.alpha
Commit10992b6
App Center BuildWPiOS - One-Offs #6011
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jun 16, 2023

Jetpack Alpha📲 You can test the changes from this Pull Request in Jetpack Alpha by scanning the QR code below to install the corresponding build.
App NameJetpack Alpha Jetpack Alpha
ConfigurationRelease-Alpha
Build Numberpr20891-10992b6
Version22.6
Bundle IDcom.jetpack.alpha
Commit10992b6
App Center Buildjetpack-installable-builds #5037
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.

@jostnes jostnes added Testing Unit and UI Tests and Tooling [Type] Task labels Jun 16, 2023
@jostnes jostnes added this to the 22.7 milestone Jun 16, 2023
@jostnes jostnes marked this pull request as ready for review June 16, 2023 05:13
@jostnes jostnes requested a review from a team as a code owner June 16, 2023 05:13
@jostnes jostnes changed the title add logout at launch for ui tests [UI Tests] - Add logout at launch capability Jun 16, 2023

XCTAssert(MySiteScreen.isLoaded())
.verifyMySiteScreenLoaded()
.removeSelfHostedSite()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

logOutDefaultWordPressComAccount works for WordPress accounts; needed to add this additional step for self-hosted sites for this work.

// Unified email login/out
func testWPcomLoginLogout() throws {
let prologueScreen = try PrologueScreen().selectContinue()
try PrologueScreen().selectContinue()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this change is not really necessary for this change but i decided to take advantage to standardize this since there was 1 test in this file that had to be updated to work with this new solution

*/
func testEmailMagicLinkLogin() throws {
let welcomeScreen = try WelcomeScreen().selectLogin()
try WelcomeScreen().selectLogin()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as the above test

let prologueScreen = try PrologueScreen()

try prologueScreen
try PrologueScreen()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as the above test

Copy link
Contributor

@tiagomar tiagomar left a comment

Choose a reason for hiding this comment

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

Nice move using launchArguments to log, @jostnes!
The changes look good and the logs are clean again! 🎉

@jostnes jostnes merged commit f131f5e into trunk Jun 19, 2023
@jostnes jostnes deleted the add-logout-at-launch-cap branch June 19, 2023 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Testing Unit and UI Tests and Tooling [Type] Task

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants