Rayrun
← Back to Discord Forum

DevExtreme

oscarlagattaposted in #help-playwright
Open in Discord
oscarlagatta
oscarlagatta

Having issues with the components developed by DevExpress called DevExtreme. Would anyone know how to use Playwright or best practices using these UI components ? https://js.devexpress.com/Overview/Angular/ as it's difficult to fine a common approach, or use a data-id attribute.

This thread is trying to answer question "No question provided in the thread."

12 replies
tphillips8117

Have you had a go at recording some tests and seeing how Playwright identifies the components?

tphillips8117

Have a look through this page for best practice: https://playwright.dev/docs/best-practices

What issues do you have? Sometimes I used some JavaScript functions to access celos columna in grids or some complex components

oscarlagatta
oscarlagatta

thank you, basically the componnets won't let me add data-id attributes, or perhaps they will create the components dynamicall where it's difficult to assign an attribute, (eg. radio button group creates the radio buttons on the fly based on an array list of items) https://js.devexpress.com/Demos/WidgetsGallery/Demo/RadioGroup/Overview/Angular/Light/ and it creates; based on the selected radio button; an input checked with the selected option, not even a checked with state

I think developers can add datatest-id to most of the elements with this code [elementAttr]="{ datates-id: 'elementId'}"

<dx-radio-group [items]="priorities" [value]="priorities[1]" [disabled]="true" [elementAttr]="{ id: 'elementId'}" >

Too you can try to access by text or delete the random id and try to check how codegen access

Or worse case if you can't muck with the internals of the control from the devexpress, as i thnk there is more than one cat to skin.... No reason you can't do:

<div data-test-id='...'> <dx-radio-group [items]="priorities" [value]="priorities[1]" [disabled]="true" [elementAttr]="{ id: 'elementId'}" > </div>

Not pretty but as a last resort this will get you to each respective control. From there at least if you have the immediate parent for the controls in question, you should have easy access to identify and have a deterministic way to get the control.

While that said now it matter if they have an open or closed dom model,... But worse case if you can't update the source for the control you have now have a generic way to handle all control in a standard way, You will probably want your own controls to wrap each of the DevExpress for: dx-text dx-options dx-link ...

oscarlagatta
oscarlagatta

thank you so much great views in your comments

oscarlagatta
oscarlagatta

the dx-radio-group generates the items, and the elementId not sure where to get it from

oscarlagatta
oscarlagatta

but will figure it out, as it's not an actual radio, it's a hidden input with its value

For dx-radio-group is generated in parent element, so you can chain after to find by text.

oscarlagatta
oscarlagatta

thanks @apis3445

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.