code property

Map<String, String>? code
final

Code to generate in representation of page object and any element inside. Used by WebDriver Test Creator (go/webdriver-test-creator).

The key can be an action, like 'click', 'value' or 'type', or it can be any code that may be generated without the config. The first case means it should generate that piece of code instead of inspecting any further for the given action. The second case is more powerful, it will find the chain as usual, and the generated code will be replaced accordingly.

One example for case 1, typing in a MaterialInputPO named moneyInput should produce await moneyInput.type() (or await moneyInput.clearAndType()) instead of await moneyInput.input.type() etc. So it should have something like @PageObject(code: {'type': 'clearAndType'})

One example for case 2, clicking on the submit and cancel button on a dialog, if the buttons themselves are hidden. So the default code would be like await dialog._submit.click(), but it should be await dialog.submit(). So it can be specified as

@PageObject(code: { '_submit.click': 'submit', '_cancel.click': 'cancel' })

Implementation

final Map<String, String>? code;