Skip to content
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

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

kbo001
Copy link
Contributor

@kbo001 kbo001 commented Jul 13, 2022

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

  • If the PR is high risk, "High Risk" label is set
  • I have confidence that this PR will not introduce a regression for the reasons below
  • Do we need to enhance manual QA test coverage ? If yes, "QA Note" label is set correctly

Automated test coverage

This testcase covers the below scenarios:

  1. opens the form Video with valid reference , checks if the video is already downloaded while installing the app (if not already present then downloads it), plays the video, moves to next page and verifies that the video player is present and then submits the form.
  2. opens the form Video with no reference , checks the video is not downloaded while installing the app, tries to download the video, gets error "Media not found in the application", moves to next page and verifies that the video player is missing and then submits the form.

Safety story

Executed in local AVD, ran successfully.

@dimagimon
Copy link
Collaborator

1 Warning
⚠️ This PR does not contain any JIRA issue keys in the PR title or commit messages (e.g. KEY-123)

Generated by 🚫 Danger

Copy link
Contributor

@shubham1g5 shubham1g5 left a 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.

Comment on lines 75 to 77
InstrumentationUtility.stubIntentWithAction(Intent.ACTION_VIEW)
onView(withId(R.id.video_button)).perform(ViewActions.click())
InstrumentationUtility.nextPage()
Copy link
Contributor

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 ?

Copy link
Contributor Author

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

R.drawable.update_download_icon
)
).isPresent()
InstrumentationUtility.stubIntentWithAction(Intent.ACTION_SEND)
Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

@kbo001 FYI

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@damagatchi
Copy link

Can one of the admins verify this patch?

@shubham1g5
Copy link
Contributor

@damagatchi retest this please

1 similar comment
@shubham1g5
Copy link
Contributor

@damagatchi retest this please

@shubham1g5
Copy link
Contributor

@damagatchi retest this please

1 similar comment
@shubham1g5
Copy link
Contributor

@damagatchi retest this please

@shubham1g5
Copy link
Contributor

@kbo001 Are the changes here complete now ?
@damagatchi retest this please

@kbo001
Copy link
Contributor Author

kbo001 commented Sep 15, 2022

@shubham1g5 I did not get the time yesterday, working on it today.

….kt, updated test steps in testVideosWithValidReference()
@kbo001
Copy link
Contributor Author

kbo001 commented Sep 15, 2022

@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())
Copy link
Contributor

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 ?

Copy link
Contributor Author

@kbo001 kbo001 Sep 15, 2022

Choose a reason for hiding this comment

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

yes.

Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

@shubham1g5
Copy link
Contributor

lazy_videos_test.ccz can be removed now ?


@Before
fun setup() {
if (CommCareApplication.instance().currentApp == null) {
Copy link
Contributor

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 ?

Copy link
Contributor Author

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.

Copy link
Contributor

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)))
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

shubham1g5
shubham1g5 previously approved these changes Sep 15, 2022
Copy link
Contributor

@shubham1g5 shubham1g5 left a 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

@shubham1g5
Copy link
Contributor

@kbo001 Seems like DateWidgetTests are failing again repeatedly blocking pass on this test. Would you be able to take a look.
@damagatchi retest this please

@kbo001
Copy link
Contributor Author

kbo001 commented Sep 16, 2022

@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.

@kbo001
Copy link
Contributor Author

kbo001 commented Sep 16, 2022

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()){
Copy link
Contributor

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 ?

Copy link
Contributor Author

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.

Copy link
Contributor

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"))
Copy link
Contributor

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.

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 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.

Copy link
Contributor

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()){
Copy link
Contributor

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 ?

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 reason as the one before. Sometimes the videos for the other questions may not get downloaded properly.

@kbo001
Copy link
Contributor Author

kbo001 commented Sep 21, 2022

@shubham1g5 I have commented the sleep and if statements, can you verify if the test is passing in BS?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants