diff --git a/docs/tips-tricks.md b/docs/tips-tricks.md index edc1d57bd..7d675e990 100644 --- a/docs/tips-tricks.md +++ b/docs/tips-tricks.md @@ -1,9 +1,56 @@ # Tips and Tricks -Sometimes, little changes can make a big difference in your project. Here are some test writing tips to keep everything running smoothly. +Sometimes, little changes can make a big difference in your project. +Here are some test writing tips to keep everything running smoothly. ## Actions and action groups +### Use the appropriate action to verify that the 'select' element contains the expected options + +To ensure that your `select` form element contains only expected values: + +- Use the `grabMultiple` action to get all `options` from the `select` element. +- Use the `assertContains` action to verify that the array of `options` contains expected values. +- Use the `assertNotContains` action to verify that the array of `options` does not contain certain values. +- If you need to verify that you have a specific list of `options` in a `select` element, use `assertEquals`. + + +Good + + + ```xml + + + selectOptions + admin_option_1 + + + selectOptions + admin_option_2 + + + + selectOptions + option1 + + + selectOptions + option2 + + ``` + + +Bad + + + ```xml + + + + + + ``` + ### Use parameterized selectors in action groups with argument references Clarity and readability are important factors in good test writing.