wdi5
wdi5 copied to clipboard
docs: add new recipe on `interaction` on a selector
@vobu what do you think about this? havent had the time yet to try this out, will to later
@vobu what do you think about this? havent had the time yet to try this out, will to later
i like!
i'd even say you could slide the testcases from the .md
into the testsuite itself, maybe as
/examples/ui5-js-app/webapp/test/e2e/locators-interactions.test.js
, similar to
https://github.com/js-soft/wdi5/blob/main/examples/ui5-js-app/webapp/test/e2e/locators-basic.test.js
@vobu
i added the two new tests
then i tried to find a difference between interaction: "focus"
and interaction: "press"
but could not find a difference at glance on the object or html or press event as described at https://github.com/SAP/ui5-uiveri5/blob/master/docs/usage/locators.md#interaction-adapters
How can i find a difference and test this difference?
The test for getPlaceholder()
is quite generic and has, in my opinion, nothing to do with interaction
.
@vobu i added the two new tests then i tried to find a difference between
interaction: "focus"
andinteraction: "press"
but could not find a difference at glance on the object or html or press event as described at https://github.com/SAP/ui5-uiveri5/blob/master/docs/usage/locators.md#interaction-adaptersHow can i find a difference and test this difference? The test for
getPlaceholder()
is quite generic and has, in my opinion, nothing to do withinteraction
.
@hmanchev can you jump in and help @marianfoo out here please?
Hi @marianfoo, the difference between focus and press is when you have a control which have several elements and the one which holds the default focus is different than the one, which receives the press.
For example, SearchField is such control - the default focus is to the input element, but the press event will be received by the button with the magnifier icon, like the description you are pointing to: https://github.com/SAP/ui5-uiveri5/blob/master/docs/usage/locators.md#interaction-adapters
For more details about press action, look here: https://sapui5.hana.ondemand.com/#/api/sap.ui.test.actions.Press
If you still have any misunderstanding, please be more specific and I will try to point you to the right document.
Hi @hmanchev ,
thank you for your answer.
In principle, this also makes sense to me, but I have two problems:
I try to find a difference when I apply the different selectors and use press
for example.
Therefore I also have a problem to develop different test cases to test whether to find the different focus locators.
As you can see in this testcase, i try to understand what is different between those two selectors: https://github.com/js-soft/wdi5/blob/24716f2421ad52f6e8b998eae375a8a437dafdde/examples/ui5-js-app/webapp/test/e2e/locators-basic.test.js#L59-L99
I guess the plain HTML is still the same, but press
still selects the Input Field for both.
Do you have a suggestion which test case I could develop here?
Hello @marianfoo,
I am not sure whether wdi5 is using similar approach as the actions in UiVeri5 and OPA5, but if this is the case, there are an action adapters which help the action to be executed to the correct element: https://sapui5.hana.ondemand.com/#/api/sap.ui.test.actions.Press
So if you select element with interaction "focus" or "press", when you execute the press action on the selected element, the adapters will help the correct control to receive the press action, in the case of SearchField this is the button. I suppose that this interaction properties are useful for controls which don't have adapters in the press and that's why there is no difference between "focus" or "press" interaction combined with press action.
Maybe @vobu can give more details on how press action is implemented in wdi5?
Maybe @vobu can give more details on how press action is implemented in wdi5?
it is using wdio
's .click()
under the hood: https://github.com/ui5-community/wdi5/blob/2f0f95bba03f631739312cb8a041fe37b6ff9ca6/src/lib/wdi5-control.ts#L197
so probably we'd need to change the interaction depending on the type of control that is clicked.
For the SearchField
in this thread, we might have to do it similarly to the enterText
implementation:
https://github.com/ui5-community/wdi5/blob/2f0f95bba03f631739312cb8a041fe37b6ff9ca6/src/lib/wdi5-control.ts#L178
let me give that a quick try and see if that's feasible 😀
so my idea worked :) will add some more UI5 controls for receiving the special focus/press interaction, then get this in.
hey @marianfoo - can you glance over the current state of this, please? @Siolto - please doublecheck with the upcoming Error Log fix! Thanks you 2! 👬