mvysny / karibu-testing

Vaadin Server-Side Browserless Containerless Unit Testing
Apache License 2.0
105 stars 14 forks source link

expectRow() doesn't allow for dynamic content #123

Closed mvysny closed 1 year ago

mvysny commented 1 year ago

Sometimes the Grid contains links that are either randomly generated, or contain database identifiers which are generated by the database. In such case the expectRow() can not be used since it requires to either hard-code the IDs into tests, or you need to figure them out in the test upfront.

Maybe the solution could be to have an expectRow() variant which accepts regex? Opening the ticket to brainstorm possible ideas.

mvysny commented 1 year ago

Workaround would be to call _getFormattedRow() to obtain the row as a list of strings, then compare the list manually: perhaps remove/ignore the generated columns, or similar.

mvysny commented 1 year ago

Added expectRowRegex() which expects a list of regexps. Added in Karibu-Testing 1.3.18.