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
Fix ui tests and create a primitive backend mock #24
Conversation
@@ -14,8 +15,8 @@ class CreatePersonalAccountViewPagerAdapter( | |||
override fun getCount(): Int = titles.size | |||
|
|||
override fun getItem(position: Int): Fragment = | |||
//TODO add phone fragment | |||
CreatePersonalAccountEmailFragment.newInstance() | |||
if (position == PHONE_TAB_POSITION) CreatePersonalAccountPhoneFragment.newInstance() |
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.
espresso was complaining about ambiguous resources (since there were 2 instances of the same fragment). so I created this empty fragment, which will be filled soon :)
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.
Please add the TODO()
then :)
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.
There's a TODO in xml layout
@@ -14,7 +14,7 @@ | |||
app:layout_constraintGuide_percent="0.228" /> | |||
|
|||
<androidx.appcompat.widget.AppCompatTextView | |||
android:id="@+id/createPersonalAccountTitleTextView" | |||
android:id="@+id/createPersonalAccountHeaderTextView" |
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.
due to duplicate naming
@@ -17,6 +17,7 @@ | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:hint="@string/create_personal_account_with_email_edit_text_hint" | |||
android:imeOptions="flagNoExtractUi" |
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.
for the weird keyboard behaviour in landscape mode.
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.
Good Job, although I will request changes to make sure that a discussion happens here.
We need to evaluate which is the best way to do end-to-end testing that involves networks requests.
This is one option (good job in any case) but also maybe for a more realistic scenario we use a mockServer
?
I would also like to include contract testing at some point in time to make sure we are testing against the right contract of the api.
A bunch of resources that are worth reading:
...androidTest/kotlin/com/wire/android/feature/auth/registration/CreateAccountActivityUITest.kt
Outdated
Show resolved
Hide resolved
...androidTest/kotlin/com/wire/android/feature/auth/registration/CreateAccountActivityUITest.kt
Outdated
Show resolved
Hide resolved
@@ -14,8 +15,8 @@ class CreatePersonalAccountViewPagerAdapter( | |||
override fun getCount(): Int = titles.size | |||
|
|||
override fun getItem(position: Int): Fragment = | |||
//TODO add phone fragment | |||
CreatePersonalAccountEmailFragment.newInstance() | |||
if (position == PHONE_TAB_POSITION) CreatePersonalAccountPhoneFragment.newInstance() |
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.
Please add the TODO()
then :)
9e57adf
to
a665d4a
Compare
@android10 yes, I actually added this PR to start a discussion. This is not very ideal, but setting up a mock BE can consume time, and this does the job for now. I added an item in Collective. Will take a look at the readings by then, thanks :) |
a665d4a
to
e00da67
Compare
I'm closing this PR since it's a bit outdated and we need to re-investigate other options too |
Our UI tests normally connect to live backend since they use the default implementation. That brings about some things to consider:
In this PR, I made a very primitive mocking mechanism with koin-test. It uses Mockito to mock Repository instances. There is a limitation here: we hit the "Mockito cannot mock final classes" problem again with Mockito & Kotlin. However, for androidTests, MockMaker fix does not work, so we need to mock the Repository interface altogether, instead of concrete final RemoteDataSource class (which is our main problem). A solution to this problem would be to hide the RemoteDataSource behind an interface as well, but that sort of creates an unnecessary layer in production code.