diff --git a/tests/invalid_login.robot b/tests/invalid_login.robot new file mode 100644 index 0000000000000000000000000000000000000000..287bb6699b6dc037350e903dfc97042e8910b703 --- /dev/null +++ b/tests/invalid_login.robot @@ -0,0 +1,29 @@ +*** Settings *** +Documentation A test suite for invalid login. +Resource resource.robot +Suite Setup Open Browser To Login Page +Suite Teardown Close Browser +Test Template Login With Invalid Credentials Should Fail +*** Test Cases *** +Invalid Username invalid ${VALID PASSWORD} ${INVALID_U} +Invalid Password ${VALID USER} invalid ${INVALID_P} +Invalid Username And Password invalid whatever ${INVALID_U} +Empty Username ${EMPTY} ${VALID PASSWORD} ${SHORT_U} +Empty Password ${VALID USER} ${EMPTY} ${SHORT_P} +Empty Username And Password ${EMPTY} ${EMPTY} ${SHORT_UP} + +*** Keywords *** +Login With Invalid Credentials Should Fail + [Arguments] ${username} ${password} ${error_text} + Open Login + Input Username ${username} + Input Password ${password} + Submit Credentials Login + Login Should Have Failed ${error_text} + Close Login Screen + +Login Should Have Failed #Checks the error message. + [Arguments] ${error_text} + Element Text Should Be css=h2 ${error_text} + #Title Should Be Error Page #If there's going to be an error page. + diff --git a/tests/resource.robot b/tests/resource.robot new file mode 100644 index 0000000000000000000000000000000000000000..94829d0a25dc28045c03b38b702752bc6dd29386 --- /dev/null +++ b/tests/resource.robot @@ -0,0 +1,121 @@ +*** Settings *** +Documentation A resource file with reusable keywords and variables. +Library SeleniumLibrary run_on_failure=nothing +Library String + +*** Variables *** +${SERVER} %{SITE_URL} +${BROWSER} firefox +${DELAY} 0.5 +${VALID USER} ville +${VALID PASSWORD} koira +${LOGIN URL} http://${SERVER}/ +${WELCOME URL} #You can use this if there's a different page after login page. +${LOC_USER} id=registerUsernameInput #Generated username. +${LOC_PASSWORD} id=registerPasswordInput #Generated password first time. +${LOC_PASSWORD2} id=registerPasswordVerifyInput #Generated password verify. +${ZOOMIN} //*[@id="root"]/div/div[1]/div[2]/div[2]/div[1]/a[1] #Zoom in button location +${ZOOMOUT} //*[@id="root"]/div/div[1]/div[2]/div[2]/div[1]/a[2] #Zoom out button location +${INVALID_U} User does not exist +${INVALID_P} Invalid password +${SHORT_P} Validation failed: password must be longer than or equal to 3 characters +${SHORT_U} Validation failed: name must be longer than or equal to 3 characters +${SHORT_UP} Validation failed: name must be longer than or equal to 3 characters, password must be longer than or equal to 3 characters +${LONG_U} Validation failed: name must be shorter than or equal to 31 characters +${LONG_P} Validation failed: password must be shorter than or equal to 255 characters +${LONG_UP} Validation failed: name must be shorter than or equal to 31 characters, password must be shorter than or equal to 255 characters +${SU_LP} Validation failed: name must be longer than or equal to 3 characters, password must be shorter than or equal to 255 characters +${LU_SP} Validation failed: name must be shorter than or equal to 31 characters, password must be longer than or equal to 3 characters + +*** Keywords *** +#Valid Login +Open Browser To Login Page + Open Browser ${LOGIN URL} ${BROWSER} + Maximize Browser Window + Set Selenium Speed ${DELAY} + Login Page Should be Open + +Login Page Should be Open + Title Should Be React App + + +Go To Login Page + Go To ${LOGIN URL} + Login Page Should be Open + +Open Login + Click Button id=loginButton + +Input Username + [Arguments] ${username} + Input Text id=loginUsernameInput ${username} + +Input Password + [Arguments] ${password} + Input Text id=loginPasswordInput ${password} + +Submit Credentials Login + Click Button id=submitLoginButton + +Welcome Page Should Be Open #You can use this if there's a different page after login page. + Location Should Be ${WELCOME URL} + +Log Out + Click Button id=logoutButton + +Close Login Screen + Click Element id=closeLoginFormX + +Wait For Log Out Button To Appear + Wait Until Page Contains Element id=logoutButton 1 + +#Registration +Open Registration + Click Button id=registerButton + + +Generate Username #Generates a random username lenght=8 chars=[LETTERS][NUMBERS] + [Arguments] ${GNUM_U} + ${GENE_username} = Generate Random String ${GNUM_U} [LETTERS][NUMBERS] + Input Text ${LOC_USER} ${GENE_username} + +Generate Password #Generates a random password lenght=8 chars=[LETTERS][NUMBERS] + [Arguments] ${GNUM_P} + ${GENE_password} = Generate Random String ${GNUM_P} [LETTERS][NUMBERS] + Input Text ${LOC_PASSWORD} ${GENE_password} + Input Text ${LOC_PASSWORD2} ${GENE_password} + +Generate Differing Password + [Arguments] ${GNUM_VP} + ${GENE_dpassword} = Generate Random String ${GNUM_VP} [LETTERS][NUMBERS] + ${GENE_dpassword2} = Generate Random String ${GNUM_VP} [LETTERS][NUMBERS] + Input Text ${LOC_PASSWORD} ${GENE_dpassword} + Input Text ${LOC_PASSWORD2} ${GENE_dpassword2} + +Submit Credentials Registration + Click Button id=submitRegisterButton + +Close Registration Screen + Click Element id=closeRegisterFormX + +#Zoom frontpage +Wait For Zoom Button To Appear + Wait Until Page Contains Element //*[@id="root"]/div/div[1]/div[2]/div[2]/div[1]/a[1] 1 + +Zoom In On Frontpage + Repeat Keyword 3 times Click Element ${ZOOMIN} + + +Zoom Out On Frontpage + Repeat Keyword 3 times Click Element ${ZOOMOUT} + + +Move Around On The Map Frontpage #en saanut toimimaan + #Press Key //*[@id="root"]/div/div[1]/div[1] ARROW_LEFT + Press Combination Key. + + + + + + diff --git a/tests/valid_login.robot b/tests/valid_login.robot new file mode 100644 index 0000000000000000000000000000000000000000..01d1140d5ac71edae110307c7b7dbaac11373325 --- /dev/null +++ b/tests/valid_login.robot @@ -0,0 +1,15 @@ +*** Settings *** +Documentation A test suite for valid login. +... Keywords imported from a resource file. +Resource resource.robot + +*** Test Cases *** +Valid Login + Open Browser To Login Page + Open Login + Input Username ville + Input Password koira + Submit Credentials Login + Wait For Log Out Button To Appear + Log Out + [Teardown] Close Browser \ No newline at end of file diff --git a/tests/valid_registration.robot b/tests/valid_registration.robot new file mode 100644 index 0000000000000000000000000000000000000000..f62f83add9b43e2e855b85d2191bac366c002fc9 --- /dev/null +++ b/tests/valid_registration.robot @@ -0,0 +1,13 @@ +*** Settings *** +Documentation A test suite for valid registration. +Resource resource.robot +Suite Setup Open Browser To Login Page +Suite Teardown Close Browser + +*** Test Cases *** +Registration Process + Open Registration + Generate Username 12 + Generate Password 6 + Submit Credentials Registration + Log Out