Examples: Login - amauran/project-giskard GitHub Wiki
First tests
Note: These are all done with Chrome only at this point, and using built-in keywords from SeleniumLibrary
1. Open / Close
- open browser and then close it
2. Open / Go to page / Close
- open browser
- enter specific URL
- in this case the Dreamwidth login page
- check the correct page was found
- used keyword
Title Should Be
+ text Log in
- used keyword
- close browser
3. Open / Attempt login (empty) / Close
- open browser
- enter specific URL (login page)
- click 'login' without filling boxes
- used keyword
Click Element
+ path to element
- used keyword
- check that you got error message
- used keyword
Page Should Contain Element
+ path to element
- used keyword
- close browser
4. Open / Attempt login (filled) / Close
Note:
Before this I moved the path information to a separate YAML file from which they are accessed. Also created a YAML file for the login information
Note 2:
This test could not be done properly since the test environment wasn't set up yet, and it's not good to attempt logins to a real site too many times...
-
open browser
-
enter specific URL (login page)
-
find username box and enter text from file
- used keyword
Set Focus To Element
+ path (variable from file) - used keyword
Input Text
+ path (variable from file)
- used keyword
-
find password box and enter password from file
- used keyword
Set Focus To Element
+ variable from file - used keyword
Input Password
+ path (variable from file)
- used keyword
-
press login button
- used keyword
Click Element
+ path (variable from file)
- used keyword
-
check if you got in or got error message
- used keywords
Page Should Not Contain Element
+ path (if login failed)Page Should Contain Element
+ path (if login succeeded)
- used keywords
-
close browser
Pass / Fail
- Test 1 Pass
- Test 2 Pass
- Test 3 Pass (as the test expected the login to fail with empty fields)
- Test 4 Fail
- entering username worked
- entering password did not
- waiting for proper test environment to continue