Skip to content

Convert UI tests screens to be ScreenObject subclasses – Part 4 of many#17360

Merged
mokagio merged 9 commits intodevelopfrom
convert-to-screen-objects-p4
Nov 15, 2021
Merged

Convert UI tests screens to be ScreenObject subclasses – Part 4 of many#17360
mokagio merged 9 commits intodevelopfrom
convert-to-screen-objects-p4

Conversation

@mokagio
Copy link
Contributor

@mokagio mokagio commented Oct 25, 2021

See #17221, #17348, and #17359.

I made this on top of #17359 for ease of review.

Regression Notes

  1. Potential unintended areas of impact
    N.A.

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    N.A.

  3. What automated tests I added (or what prevented me from doing so)
    N.A.


  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes. N.A.
  • I have considered adding accessibility improvements for my changes. N.A.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary. N.A.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Oct 25, 2021

You can trigger an installable build for these changes by visiting CircleCI here.

@peril-wordpress-mobile
Copy link

peril-wordpress-mobile bot commented Oct 25, 2021

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@mokagio mokagio marked this pull request as ready for review October 25, 2021 10:17
@mokagio mokagio force-pushed the convert-to-screen-objects-p4 branch from 1e271fc to a7206d0 Compare October 25, 2021 10:17
@mokagio mokagio added the Testing Unit and UI Tests and Tooling label Oct 25, 2021
@mokagio mokagio added this to the 18.6 milestone Oct 25, 2021
@mokagio mokagio changed the title Convert UI tests screens to be a ScreenObject subclasses – Part 4 of many Convert UI tests screens to be ScreenObject subclasses – Part 4 of many Oct 26, 2021
@oguzkocer oguzkocer modified the milestones: 18.6, 18.7 Nov 1, 2021
Base automatically changed from convert-to-screen-objects-p3 to develop November 4, 2021 10:10
@mokagio mokagio enabled auto-merge November 10, 2021 00:48
@mokagio mokagio requested a review from pachlava November 10, 2021 00:49
@mokagio mokagio modified the milestones: 18.7, 18.8 Nov 11, 2021
@mokagio mokagio force-pushed the convert-to-screen-objects-p4 branch from a7206d0 to 2608300 Compare November 11, 2021 04:38
if !element.isFullyVisibleOnScreen {
XCTFail("Unable to scroll element into view")
}
element.scrollIntoView(within: scrollView, threshold: threshold)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

You might notice that this code is part of BaseScreen, which this train of work aims to remove.

This change here moved the logic to a dedicated extension (feb932e) so that both BaseScreen and ScreenObject could share it in the context of this project.

Better than copy-pasting, in particular because this code is fit to live in the XCUITestHelpers project.

@mokagio mokagio force-pushed the convert-to-screen-objects-p4 branch from 2608300 to a3a3c03 Compare November 15, 2021 04:42
@pachlava
Copy link
Contributor

pachlava commented Nov 15, 2021

A question not related to the code affected by PR - is using Xcode 13 now mandatory?

I'm seeing these, which, I suppose, have something to do with me still using 12.5.1:

Screenshot 2021-11-15 at 12 15 04

EDIT: the error is gone after updating to Xcode 13 and using iOS 15.

@pachlava
Copy link
Contributor

pachlava commented Nov 15, 2021

Not a part of this PR: it looks like switching to Xcode 13 (and iOS 15) slows down the tests dramatically. Latest execution while still using Xcode 12.5.1 took 557 seconds, while the next already using Xcode 13.0 takes 956 😢 . On the surface it looks like there's an extra delay between all events (key presses, taps, assertions). This is what I mean (my local Xcode 13.1 + iOS 15):

Screen.Recording.2021-11-15.at.17.40.00.mov

I'm installing Simulator 14.5 (which was lost during update) to see if the slowness is related to Xcode or to iOS version.

@pachlava
Copy link
Contributor

Using Xcode 13.1 in combination with iOS 14.5 solves the speed issue.

I found the similar report here (it's an Appium repo, but the root cause is in XCTest). According to one comment from there, the issue also gets fixed in iOS 15.2 (available with code 13.2 which is still beta).

Copy link
Contributor

@pachlava pachlava left a comment

Choose a reason for hiding this comment

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

I executed the tests on iPhone 12 (first with iOS 15, then with 14.5) - they passed. The changes in all files made sense to me and I noticed no issues 👍 Thank you, @mokagio !

@mokagio mokagio merged commit 9216288 into develop Nov 15, 2021
@mokagio mokagio deleted the convert-to-screen-objects-p4 branch November 15, 2021 16:47
@mokagio
Copy link
Contributor Author

mokagio commented Nov 15, 2021

Thanks @pachlava!

I might try Xcode 13.2 beta and see how it compares 🤞

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants