[Precondition]
- Open website: https://demoqa.com/alerts
[Steps]
1. To see alert -> click button“click me”.
2. Click OK in alert.
3. On button click, alert will appear after 5 seconds -> click button “Click me”.
4. Wait 5s then click OK in alert.
5. On button click, confirm box will appear -> click button “click me”.
6. Click cancel in alert.
7. On button click, confirm box will appear -> click button “click me”.
8. Click ok in alert.
9. On button click, prompt box will appear -> click button “Click me”.
10. Input “[email protected]”.
11. Click “Ok” in alert.
[Expected]
1. Alert is displayed.
2. Close Alert & back to screen Alerts
3. Alert is displayed.
4. Close Alert & back to screen Alerts
6. Close Alert -> back to screen Alerts & Text “You selected Cancel” is displayed.
8. Close Alert -> back to screen Alerts & Text “You selected OK” is displayed.
11. Close Alert -> back to screen Alerts & Text “You entered [email protected]” is displayed
Create Test precondition
Open website: https://demoqa.com/alerts
- Click button “Record script” to start making “record” at the website.
- Enter the website link in the text box “Base URL” and Click button “Start Recording”.
Create steps for script
When the URL link is opened, the tool will automatically generate the default steps: open and set window size.
- Comment “Click Button to see alert” command to display part 1.
- Click the first “Click me” button.
- Click the “OK” button in the alert.
- Comment “On button click, alert will appear after 5 seconds” command to display part 2.
- Click the second button “Click me”.
- Click button “OK” in the alert.
- Comment “On button click, confirm box will appear -> Cancel” command to display part 3.
- Click the 3rd “Click me” button.
- Click button “Cancel” in the alert .
- At the command enter “verify text”, point to the text “You selected Cancel”, value = “You selected Cancel” on the website.
- Comment “On button click, confirm box will appear -> OK” command to display part 4.
- Click the 3rd “Click me” button.
- Click button “OK” in the alert .
- At the command enter “verify text”, point to the text “You selected OK”, value = “You selected OK” on the website.
- Comment “On button click, prompt box will appear” command to display part 5.
- Click the 4th “Click me” button.
- In the Input alert box, enter “[email protected]”.
- Click button “OK” in the alert .
- At the command enter “verify text”, point to the text “You entered [email protected]”, value = “You entered [email protected]” on the website.
Run Test script
➩ Test script after complete creation and run successfully.