3 ms·
For selecting things, I've found that allowing a "data-test='user-name-input'" type attribute is useful for a lot of cases, when doing Gauge/Taiko tests. It mi
by chris_st 6y ago
For selecting things, I've found that allowing a "data-test='user-name-input'" type attribute is useful for a lot of cases, when doing Gauge/Taiko tests.
It might make sense to allow/recognize these to save trying to find things that way, rather than via CSS-type selectors that may change.
- tmcneal 6y agoTotally! If you have data-test* attributes set up, we will use those first when generating selectors for each action. The full list of data-test attributes we use is listed here: https://reflect.run/docs/recording-tests/creating-resilient-tests/#selectors https://reflect.run/docs/recording-tests/creating-resilient-.... If we don't find data-test* attributes we'll also look for other attributes that tend to have a good degree of specificity, like alt, rel, schema.org, and aria-* attributes.
- inglor 6y agoI recomment considering learning between test runs and I encourage you to train a relatively simple model for selection on top of http-archive and tagged data. "off the shelf" machine learning makes it pretty easy to create very robust selectors. I gave a talk about it in GDG Israel and was supposed to speak about it in HalfStack that got delayed cancelled because of COVID19 - but the principle is pretty simple. It's amazing how much RoI you can get from relatively simple models of reinforcement learning. Here are some ideas: https://docs.google.com/presentation/d/1OViIwDJJw1kjVJH5Z2N5chz5Usw3kOf41hCiwZXu0ng/edit?usp=sharing https://docs.google.com/presentation/d/1OViIwDJJw1kjVJH5Z2N5... Good luck :]
- chris_st 6y agoFantastic! I like inglor's idea too.
- vmware513 6y agoActually you can use the whole attribute name as selector, like data-test-user-name-input, and if you need a dynamic id, you can add as a value: data-test-product-item="book" ;)
- chris_st 6y agoCool idea, thanks!