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
added testcases for LazyVideos and the corresponding .ccz as well #2568
base: master
Are you sure you want to change the base?
Conversation
Generated by 🚫 Danger |
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.
@kbo001 I was reading the steps on manual test plan for this and it seems to state that we need to repeat the steps for all questions in the form (steps 3.6 and 5.3 in test plan). In comparison this test only seem to test the lazy download for the first question in the form.
InstrumentationUtility.stubIntentWithAction(Intent.ACTION_VIEW) | ||
onView(withId(R.id.video_button)).perform(ViewActions.click()) | ||
InstrumentationUtility.nextPage() |
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.
Should this code(L75-77) be outside else as it looks valid even when we downloaded the video as part of the test ?
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.
yes. Removing the else statement
app/instrumentation-tests/src/org/commcare/androidTests/LazyVideosTests.kt
Outdated
Show resolved
Hide resolved
R.drawable.update_download_icon | ||
) | ||
).isPresent() | ||
InstrumentationUtility.stubIntentWithAction(Intent.ACTION_SEND) |
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.
I don't think we need to do this as Intent.ACTION_SEND
never gets fired during this workflow.
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.
@kbo001 FYI
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.
removed
Can one of the admins verify this patch? |
@damagatchi retest this please |
1 similar comment
@damagatchi retest this please |
@damagatchi retest this please |
1 similar comment
@damagatchi retest this please |
@kbo001 Are the changes here complete now ? |
@shubham1g5 I did not get the time yesterday, working on it today. |
….kt, updated test steps in testVideosWithValidReference()
@shubham1g5 I changed the ccz file and updated the test steps according to the testplan. |
InstrumentationUtility.login("test1", "123") | ||
InstrumentationUtility.openForm(1, 0) | ||
InstrumentationUtility.waitForView(withId(R.id.video_button)) | ||
if ((onView(withTagValue(CoreMatchers.`is`(R.drawable.update_download_icon))).isPresent()) |
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.
this should always be present now right ?
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.
yes.
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.
we should not put this in if
condition 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.
But if we keep it, then even if the .ccz is updated then also this will work. Thats what I thought of. If you think it should be removed, I can do that.
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.
We should remove it as we don't want to paas this test unless it goes through the download workflow.
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.
removed
…ion from testVideosWithValidReference()
|
|
||
@Before | ||
fun setup() { | ||
if (CommCareApplication.instance().currentApp == null) { |
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.
curious why are not we using the norma installApp()
method as other tests ?
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.
if installApp()
is used then the app is not uninstalled everytime and the videos remains in the app, hence failing the tests.
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.
got it, it would be good to add a comment above this line stating this as It's not very obvious.
InstrumentationUtility.waitForView(withSubstring("Download in Progress")) | ||
InstrumentationUtility.waitForView(withSubstring("Download complete")) | ||
InstrumentationUtility.waitForView(withTagValue(CoreMatchers.`is`(android.R.drawable.ic_media_play))) | ||
// } |
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.
remove
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.
removed
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.
Approved given the test pass on BS
@kbo001 Seems like DateWidgetTests are failing again repeatedly blocking pass on this test. Would you be able to take a look. |
…deo code for the remaining questions
@shubham1g5 the dateWidgetTests seems to be passing but the lazy videos is failing as in the third question the video was still not available. I have added some wait time during the video download and also added the video download code for the remaining questions. Can you execute it once on BS as its already passing at my end. |
I see that the test is passing now |
@@ -126,6 +138,15 @@ class LazyVideosTests : BaseTest() { | |||
R.drawable.icon_info_outline_lightcool | |||
) | |||
).perform(click()) | |||
if(onView(withTagValue(CoreMatchers.`is`(R.drawable.update_download_icon))).isPresent()){ |
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.
is the download icon not always present ?
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.
The test was failing earlier because of this, instead of the play icon there was the download icon, maybe the video for this question was not downloaded properly. This time when the test is executed the download icon was not present as earlier. This might happen again so I kept this condition for both the last questions.
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.
If we put these in a if
we are bypassing the normal test steps to download media and a pass here won't guarantee that the underlying download workflow works properly risking a bug into the mobile release.
@@ -93,14 +93,17 @@ class LazyVideosTests : BaseTest() { | |||
onView(withTagValue(CoreMatchers.`is`(R.drawable.update_download_icon))).check(matches(isDisplayed())) | |||
InstrumentationUtility.stubIntentWithAction(Intent.ACTION_SEND) | |||
onView(withTagValue(CoreMatchers.`is`(R.drawable.update_download_icon))).perform(click()) | |||
onView(withId(R.id.video_button)).perform(click()) | |||
InstrumentationUtility.sleep(1) | |||
InstrumentationUtility.waitForView(withSubstring("Download started")) |
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.
this should be immediate after click, wait before and after this should not be required.
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.
This video button will be available only when the download is completed. L104 is doing that task here. Once the download is complete we click on the video button and verify the intent. We don't need it here as we will be clicking on R.drawable.update_download_icon
and start the download.
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.
I am talking about InstrumentationUtility.sleep()
statements, I don't think they should be required before and after this statement since we are already using waitForView
here.
@@ -114,6 +117,15 @@ class LazyVideosTests : BaseTest() { | |||
R.drawable.icon_info_outline_lightcool | |||
) | |||
).perform(click()) | |||
if(onView(withTagValue(CoreMatchers.`is`(R.drawable.update_download_icon))).isPresent()){ |
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.
why do we have a if
here ?
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.
Same reason as the one before. Sometimes the videos for the other questions may not get downloaded properly.
@shubham1g5 I have commented the sleep and if statements, can you verify if the test is passing in BS? |
Summary
Automated the testcases for VideosWithValidReferences and VideosWithNoReference in the Lazy Videos Tab of the Mobile Test Plan:
https://docs.google.com/spreadsheets/d/1X9YAf_g1Cq9vZZdCkcBLnRSFrhZuk_vEyCSM3sD5QvM/edit#gid=1556040007
Also added it corresponding .ccz file
Feature Flag
Product Description
Safety Assurance
Automated test coverage
This testcase covers the below scenarios:
Safety story
Executed in local AVD, ran successfully.