From f3c13752ffa0d70d5a268df3631a484a87290d14 Mon Sep 17 00:00:00 2001 From: Donald Booth Date: Tue, 11 Jun 2019 13:05:26 -0500 Subject: [PATCH 1/2] Added latest tip. --- docs/tips-tricks.md | 46 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/docs/tips-tricks.md b/docs/tips-tricks.md index edc1d57bd..9b66f75b9 100644 --- a/docs/tips-tricks.md +++ b/docs/tips-tricks.md @@ -4,6 +4,52 @@ Sometimes, little changes can make a big difference in your project. Here are so ## 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. From 8979dc02f147be06f7becb6a87631783329bce3a Mon Sep 17 00:00:00 2001 From: Donald Booth Date: Fri, 14 Jun 2019 11:28:31 -0500 Subject: [PATCH 2/2] Formatting. --- docs/tips-tricks.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/tips-tricks.md b/docs/tips-tricks.md index 9b66f75b9..7d675e990 100644 --- a/docs/tips-tricks.md +++ b/docs/tips-tricks.md @@ -1,6 +1,7 @@ # 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