-
Notifications
You must be signed in to change notification settings - Fork 338
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
POC of using page object pattern #7017
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @niklasberglund)
android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/page/LoginPage.kt
line 19 at r1 (raw file):
fun tapLoginButton(): LoginPage { val accountTextField = device.findObjectWithTimeout(By.clazz("android.widget.EditText")) val loginButton = accountTextField.parent.findObject(By.clazz(Button::class.java))
I don't really understand this, should this not find all buttons in the login screen? Is it possible to do both type and text?
android/test/e2e/src/main/kotlin/net/mullvad/mullvadvpn/test/e2e/LoginTest.kt
line 26 at r1 (raw file):
LoginPage(device) .enterAccountNumber(validTestAccountNumber)
⭐
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Pururun)
android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/page/LoginPage.kt
line 19 at r1 (raw file):
Previously, Pururun (Jonatan Rhodin) wrote…
I don't really understand this, should this not find all buttons in the login screen? Is it possible to do both type and text?
For this POC I just moved the existing code to this page function. The identification of this button could definitely be improved, but I kept down the scope of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @niklasberglund and @Pururun)
android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/page/LoginPage.kt
line 19 at r1 (raw file):
Previously, niklasberglund (Niklas Berglund) wrote…
For this POC I just moved the existing code to this page function. The identification of this button could definitely be improved, but I kept down the scope of this PR.
Could also do this maybe?
Code snippet:
fun tapLoginButton(): LoginPage {
val loginButton = device.findObject(By.clazz(Button::class.java).text("Login"))
loginButton.wait(Until.enabled(true), DEFAULT_TIMEOUT)
loginButton.click()
return this
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Pururun)
android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/page/LoginPage.kt
line 19 at r1 (raw file):
Previously, kl (Kalle Lindström) wrote…
Could also do this maybe?
IMHO test tags are more robust because text labels and class types can change, but that's another discussion and refactoring maybe 😊 Anyways if it breaks now it would only need to be updated in one place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @niklasberglund)
android/test/common/src/main/kotlin/net/mullvad/mullvadvpn/test/common/page/LoginPage.kt
line 19 at r1 (raw file):
For this POC I just moved the existing code to this page function. The identification of this button could definitely be improved, but I kept down the scope of this PR.
Right, than just ignore what I said. :)
POC of using page object pattern for the login tests. Basically moving UI automator interactions to page classes with abstract functions representing user actions in test cases. Automated tests read like manual test cases and code is reused more.
In this POC PR I have not updated the detekt config but if we go with something like this we probably would like to set up some rules for
Page
subclasses?This change is