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

chore(#6669): Search by barcode e2e test #8732

Closed
wants to merge 52 commits into from

Conversation

lorerod
Copy link
Contributor

@lorerod lorerod commented Nov 28, 2023

Description

Closes #8716

Code review checklist

  • Readable: Concise, well named, follows the style guide, documented if necessary.
  • Documented: Configuration and user documentation on cht-docs
  • Tested: Unit and/or e2e where appropriate
  • Internationalised: All user facing text
  • Backwards compatible: Works with existing data and configuration or includes a migration. Any breaking changes documented in the release notes.

Compose URLs

If Build CI hasn't passed, these may 404:

License

The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.

@lorerod lorerod marked this pull request as draft November 29, 2023 16:26
@lorerod
Copy link
Contributor Author

lorerod commented Nov 29, 2023

I'm still trying to figure out a couple of things.
In the performBarcodeSearch method in tests/page-objects/default-mobile/search/search.wdio.page.js
I need to manipulate the DOM of the input web element to make it interactable and be able to set the value. I´m not a fan of doing this.

In tests/e2e/default-mobile/wdio.conf.js, I changed beforeSuite to beforeHook as testing this locally in DEBUG mode, I experience that when a test fails, the emulateDevice method loses the mobile view and switches back to desktop.

/*In this case the upload file button is hidden,
then we need to manipulate the DOM of the respective webelement to make it interactable.*/
browser.execute(function () {
document.getElementsByClassName('barcode-scanner-input')[0].style.display = 'block';
Copy link
Member

Choose a reason for hiding this comment

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

Not a fain of this either, because it will definitely obscure if the actual button that makes the input selection no longer works, or is not displayed. So the test only validates the functionality partially.
Is there no way to use the elements that are displayed on the page to upload the image?

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 you click on the barcode icon, the OS upload file dialog appears, and Webdriverio has no control over it. I'm investigating how to setValue to a web element that is not interactable without modifying the DOM.

Copy link
Member

Choose a reason for hiding this comment

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

Yea, I went through that search as well and in the end I couldn't find anything. The idea is that wdio really wants to simulate as close to user interaction as possible.
Maybe we should just leave it like this.

document.getElementsByClassName('barcode-scanner-input')[0].style.display = 'block';
});
await (await barcodeSearchInput()).setValue(barcodeImagePath);
await browser.pause(1000);
Copy link
Member

Choose a reason for hiding this comment

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

What is the reason for the 1s delay?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We experienced some delay when uploading and processing the barcode image. But I only tried the e2e test with the wait; It may be unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I try without the wait, and the test fails because it doesn't have time to process the search and show results. This validation fails.

@lorerod
Copy link
Contributor Author

lorerod commented Dec 4, 2023

I need help to make the test work on CI. I have tried various formats to set the emulated device capability, each working on my local machine but not on CI.

On CI, you can tell it is not charging the capability because of the screenshot (the barcode scanner icon isn't shown). The icon is shown when it is on mobile.
image

  • Running the test locally:
    image

@tatilepizs @dianabarsan can you please give it a try running this test locally? to confirm what I'm experiencing.
Thanks!

@tatilepizs
Copy link
Contributor

Hi @lorerod,

I was trying to run the test locally but it is failing for me, it is not seeing the barcode scanner icon, the same thing that happened on the CI.

image

Let me know if there is anything else can do to help.
Good luck 🤞

@garethbowen garethbowen changed the title (chore #6669) Search by barcode e2e test chore(#6669): Search by barcode e2e test Jan 25, 2024
@lorerod
Copy link
Contributor Author

lorerod commented Feb 13, 2024

The Barcode Scanner API is not supported on Linux, which means this test will not work on CI.

@lorerod lorerod closed this Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants