Robot framework selenium test

Hello I use robot framework to do BDD, generally I use tag id or xpath to test with selenium. But your ids are automatically generated and the random path.
How to make testable the code generated by Aurélia ?
Is it possible to have testId ?

Thank you for your opinions.

1 Like

We use cypress for e2e testing. We had similar problems when targeting specific elements.
We end up defining custom ID’s for each element, and used that ID both in the view model and view, and in the cypress test. That way we didn’t have to hard-code the id’s.

Similar to this case, we have created a “mockBuilder” to mock all XHR requests. The route for each API was defined as a constant as well, and used on both places (API service and e2e mock).

1 Like

@mroeling Thanks a lot for your feedback. I guess you may put your own IDs in the HTML templates developed with Aurelia. Do you know whether there is an usual way, or even a hacker way, to automatically generate only once such custom, stable IDs for testing purposes? For example: test-id="…"
It would be a very useful convenience to test a legacy webapp, that is to say having no automated UI test coverage.

1 Like

Unfortunately no. The difficulty is that a pure e2e test like Cypress and Selenium, it is independent of the running application itself. So only by sharing the manual defined constants we were able to target the elements.

I’m open for suggestions as well :slight_smile:

1 Like