medic / care-teams

For Product Management
0 stars 0 forks source link

Script to use the settings and navigate to pages and waits for loading content #115

Closed latin-panda closed 1 month ago

latin-panda commented 2 months ago

Make a script to navigate regardless of the hierarchy and wait for elements to appear.

Continuation of this:

I made a gist with a draft of what this settings file might look like. It will probably get simplified a bit more later. You can see a JSON file containing the settings. The idea is to have one file per config (kenya, uganda, etc), which contains the selectors and values to make the e2e work.

latin-panda commented 2 months ago

This is almost ready (Draft PR) the only thing blocking me is that I can't make the view to scroll automatically to click on elements that at the bottom of the view. I have reached for help to @ralfudx and @Benmuiruri. @Benmuiruri is able to reproduce the same problem I experienced.

I have tried all these things to scroll after the view is fully rendered, but not working:

await $(assert.selector).scrollIntoView();
          // eslint-disable-next-line max-len
          await $('android=new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().textMatches("New Wilbertton Concession").instance(0))');
          // eslint-disable-next-line max-len
          await $('android=new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().textMatches("Concessions").instance(0))');
          // eslint-disable-next-line max-len
          await $('android=new UiScrollable(new UiSelector().scrollable(true).description("Concessions")).scrollIntoView(new UiSelector().textMatches("New Wilbertton Concession").instance(0))');
          // eslint-disable-next-line max-len
          await $('android=new UiScrollable(new UiSelector().scrollable(true).instance(0)).setSwipeDeadZonePercentage(50).scrollIntoView(new UiSelector().textMatches("New Wilbertton Concession").instance(0))');
          // eslint-disable-next-line max-len
          await $('android=new UiScrollable(new UiSelector().scrollable(true).instance(0)).setSwipeDeadZonePercentage(50).scrollIntoView(new UiSelector().textMatches("Concessions").instance(0))');
          // eslint-disable-next-line max-len
          await $('android=new UiScrollable(new UiSelector().scrollable(true)).scrollForward()');
          await $('android=new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollToEnd(1)');
          await $('android=new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollForward()');

If we help the test to scroll manually, the navigation works. But we must make it scroll automatically.

latin-panda commented 1 month ago

All details and video have been posted here.

Pull request here

I'm just waiting for the reviewers. If no feedback by tomorrow. Then we move it to next week.

latin-panda commented 1 month ago

Completed!, the work was merged into Rafa's branch. He can continue with the navigation stuff and other feedback from Diana, etc... while I'm working on the script for forms