├── .gitignore ├── README.md ├── slide ├── 01.ATDD.pdf ├── 02.ROBOT-FRAMEWORK-INSTALLATION.pdf ├── 03.ROBOT-FRAMEWORK-INTRODUCTION.pdf ├── 04.ROBOT-FRAMEWORK-STANDARD-LIBRARY.pdf ├── 05.ROBOT-FRAMEWORK-TEST-STRUCTURE.pdf ├── 06.LOGIN-DEMO.pdf ├── 07.ROBOT-FRAMEWORK-FEATURES.pdf ├── 08.ROBOT-FRAMEWORK-COMMAND-LINE.pdf ├── 09.ROBOT-FRAMEWORK-MULTIPLE-BROWSER.pdf ├── 10.SPRINT3R-SCRUM4DEV-GIT.pdf ├── 11-CI-ATDD.pdf ├── 12.ROBOT-FRAMEWORK-IMAP.pdf ├── 13.ANDROID-CALABASH.pdf ├── 14.ROBOT-FRAMEWORK-RERUN-FAILURE-TESTS.pdf ├── 15.LOGIN-DEMO-WITH-TEMPLATE.pdf ├── 16.READABLE-SCRIPT.pdf ├── 17.ROBOT-FRAMEWORK-REST-INSTALLATION.pdf ├── 18-SCK-ROBOT-FRAMEWORK.pdf ├── SCK-DESIGN-DEVELOP-APIS.pdf ├── SCK-ROBOT-FRAMEWORK-2023.pdf ├── SCK-ROBOT-FRAMEWORK-2024.pdf ├── SCK-ROBOT-FRAMEWORK-2025.pdf └── SCK-ROBOT-FRAMEWORK.pdf └── workshop ├── 00_structure.txt ├── 01_structure.txt ├── 02_hello.txt ├── 03_chrome.txt ├── 04_all_browser.txt ├── 04_ie.txt ├── 04_param.txt ├── 04_safari.txt ├── 05_proxy_firefox.txt ├── 05_proxy_firefox_2.txt ├── 06_proxy_chrome.txt ├── 07_google.txt ├── 08_todo.txt ├── 09_invalid_login.txt ├── 09_resource.txt ├── 09_valid_login.txt ├── 09_valid_login_01.txt ├── 09_valid_login_02.txt ├── 09_valid_login_03.txt ├── 10_basic_grade.txt ├── 10_example_grade.txt ├── 11_keyword.txt ├── 12_tag.txt ├── 13_setup.txt ├── 14_library_buildin.txt ├── 15_table.txt ├── browser.txt ├── calculate_grade.txt ├── calculate_grade_with_dictionary.txt ├── cnx_demo ├── browser.txt ├── facebook.txt ├── hello.txt ├── lazada.txt ├── login_failure.txt ├── login_failure_2.txt ├── login_failure_3.txt ├── login_success.txt └── resources │ └── login.txt ├── compare.txt ├── csv ├── CSVLibrary.py ├── demo_csv.robot ├── demo_read_data_from_csv.robot ├── login_fail_with_csv.robot └── sample.csv ├── cupcake_test.txt ├── demo-login ├── html │ └── demo.css └── server.py ├── demo ├── workshop-brink │ ├── WebDemo-20150901.zip │ ├── facebook.robot │ ├── google.robot │ ├── google2.robot │ ├── hello.robot │ ├── login_fail.robot │ ├── login_fail2.robot │ ├── pages │ │ ├── error.robot │ │ └── login.robot │ ├── resources │ │ └── google.robot │ ├── somkiat.jpg │ ├── somkiat2.jpg │ ├── split_data.robot │ └── upload_file.robot └── workshop-brink02 │ ├── api.yaml │ ├── demo.robot │ ├── facebook_register.robot │ ├── google.robot │ ├── google_v2.robot │ ├── httpbin_api.robot │ ├── output.json │ ├── sample_01.jpg │ ├── sample_02.jpg │ └── upload_success.robot ├── ebola.txt ├── facebook.txt ├── gmail.txt ├── google.txt ├── google_num_01.txt ├── google_num_02.txt ├── grade.txt ├── grade2.txt ├── grade3.txt ├── hello.txt ├── hello_world.txt ├── kaidee.txt ├── kaidee_post.txt ├── login_fail.txt ├── login_fail_fast.txt ├── login_fail_template.txt ├── login_failure.txt ├── login_pass.txt ├── parkko_login.txt ├── resource_grade.txt ├── resources └── login_resource.txt ├── swpark-20180819 ├── api.robot ├── google │ └── keyword.robot ├── hello.robot ├── hello2.robot ├── hello3.robot ├── hello4.robot ├── images │ ├── file01.png │ ├── file02.png │ └── file03.png ├── upload.robot ├── upload2.robot └── xpath.txt ├── tarad.txt ├── test1.csv ├── test2.csv ├── variable_01.txt ├── variable_02.txt ├── variable_03.txt ├── variable_04.txt └── xxx.txt /.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.xml 3 | *.png 4 | *.key 5 | .DS_Store 6 | login/ 7 | workshop/robotframework-selenium2library-master.zip 8 | workshop/robotframework-selenium2library-master/ 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Course Robotframework 2 days 2 | Workshop and examples of RobotFramework course 3 | 4 | ## Topics 5 | * [ ] Testing in general 6 | * [ ] Introduction to ATDD (Acceptance Test-Driven Development) 7 | * [ ] Why should you automated ? 8 | * [ ] Robotframework and architecture 9 | * [ ] Installation 10 | * [ ] Write first test case with Robotframework 11 | * [ ] Let's start with readable test cases 12 | * [ ] Tips and Tricks 13 | * [ ] Manage test cases in Version control 14 | * [ ] Working with [Stubby4j](https://github.com/azagniotov/stubby4j) 15 | * [ ] REST API Testing 16 | * [Requests Library](https://github.com/MarketSquare/robotframework-requests) 17 | * [RestInstance](https://github.com/asyrjasalo/RESTinstance/) 18 | * [Postman](https://www.postman.com/) 19 | * [ ] Working with Continuous Integration Server (Jenkins) 20 | 21 | ## More courses 22 | * [Advance Robotframework](https://github.com/up1/course-advance-robotframework) 23 | 24 | ## Demo for workshop 25 | * [Web Login with Docker](https://github.com/up1/demo-login-workshop) 26 | 27 | # Keep learning 28 | * [Robotframework Website](http://robotframework.org/) 29 | * [Demo of API testing](https://github.com/up1/go-restful-api) 30 | 31 | # List of Libraries 32 | * [Builds-in Library](http://robotframework.org/robotframework/latest/libraries/BuiltIn.html) 33 | * [Collections Library](http://robotframework.org/robotframework/latest/libraries/Collections.html) 34 | * [String Library](http://robotframework.org/robotframework/latest/libraries/String.html) 35 | * [Selenium Library](http://robotframework.org/SeleniumLibrary/SeleniumLibrary.html) 36 | * [Requests Library](https://github.com/bulkan/robotframework-requests) 37 | * [Faker Library](https://pypi.org/project/robotframework-faker/) 38 | 39 | # Mock API Server Tools 40 | * [Stubby4Node](https://github.com/mrak/stubby4node) 41 | * [Stubby4j](https://github.com/azagniotov/stubby4j) 42 | * [Postman Mock Server](https://learning.postman.com/docs/designing-and-developing-your-api/mocking-data/setting-up-mock/) 43 | * [WireMock](http://wiremock.org/) 44 | * [Json Server](https://github.com/typicode/json-server) 45 | * [MBTest](http://www.mbtest.org/) 46 | 47 | 48 | # Resources 49 | * [RobotCon 2024](https://www.youtube.com/watch?v=A91zc7-TCc0&list=PLSK6YK5OGX1CECNLS7E9H2iTsWPMZrHmA) 50 | * [RoboCon 2023](https://www.youtube.com/watch?v=lKu-9WKtYcg&list=PLSK6YK5OGX1DYqe35OX0_CqE1DEP7dI9I) 51 | * [RoboCon 2019](https://www.youtube.com/playlist?list=PLSK6YK5OGX1D-QpVap5C7NlfurQ1dsGbt) 52 | * [RoboCon](https://robocon.io/#previous-talks) 53 | 54 | All codes and documents in this repository are free to use under the [MIT Licence](https://opensource.org/licenses/MIT). 55 | -------------------------------------------------------------------------------- /slide/01.ATDD.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/01.ATDD.pdf -------------------------------------------------------------------------------- /slide/02.ROBOT-FRAMEWORK-INSTALLATION.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/02.ROBOT-FRAMEWORK-INSTALLATION.pdf -------------------------------------------------------------------------------- /slide/03.ROBOT-FRAMEWORK-INTRODUCTION.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/03.ROBOT-FRAMEWORK-INTRODUCTION.pdf -------------------------------------------------------------------------------- /slide/04.ROBOT-FRAMEWORK-STANDARD-LIBRARY.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/04.ROBOT-FRAMEWORK-STANDARD-LIBRARY.pdf -------------------------------------------------------------------------------- /slide/05.ROBOT-FRAMEWORK-TEST-STRUCTURE.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/05.ROBOT-FRAMEWORK-TEST-STRUCTURE.pdf -------------------------------------------------------------------------------- /slide/06.LOGIN-DEMO.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/06.LOGIN-DEMO.pdf -------------------------------------------------------------------------------- /slide/07.ROBOT-FRAMEWORK-FEATURES.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/07.ROBOT-FRAMEWORK-FEATURES.pdf -------------------------------------------------------------------------------- /slide/08.ROBOT-FRAMEWORK-COMMAND-LINE.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/08.ROBOT-FRAMEWORK-COMMAND-LINE.pdf -------------------------------------------------------------------------------- /slide/09.ROBOT-FRAMEWORK-MULTIPLE-BROWSER.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/09.ROBOT-FRAMEWORK-MULTIPLE-BROWSER.pdf -------------------------------------------------------------------------------- /slide/10.SPRINT3R-SCRUM4DEV-GIT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/10.SPRINT3R-SCRUM4DEV-GIT.pdf -------------------------------------------------------------------------------- /slide/11-CI-ATDD.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/11-CI-ATDD.pdf -------------------------------------------------------------------------------- /slide/12.ROBOT-FRAMEWORK-IMAP.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/12.ROBOT-FRAMEWORK-IMAP.pdf -------------------------------------------------------------------------------- /slide/13.ANDROID-CALABASH.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/13.ANDROID-CALABASH.pdf -------------------------------------------------------------------------------- /slide/14.ROBOT-FRAMEWORK-RERUN-FAILURE-TESTS.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/14.ROBOT-FRAMEWORK-RERUN-FAILURE-TESTS.pdf -------------------------------------------------------------------------------- /slide/15.LOGIN-DEMO-WITH-TEMPLATE.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/15.LOGIN-DEMO-WITH-TEMPLATE.pdf -------------------------------------------------------------------------------- /slide/16.READABLE-SCRIPT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/16.READABLE-SCRIPT.pdf -------------------------------------------------------------------------------- /slide/17.ROBOT-FRAMEWORK-REST-INSTALLATION.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/17.ROBOT-FRAMEWORK-REST-INSTALLATION.pdf -------------------------------------------------------------------------------- /slide/18-SCK-ROBOT-FRAMEWORK.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/18-SCK-ROBOT-FRAMEWORK.pdf -------------------------------------------------------------------------------- /slide/SCK-DESIGN-DEVELOP-APIS.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/SCK-DESIGN-DEVELOP-APIS.pdf -------------------------------------------------------------------------------- /slide/SCK-ROBOT-FRAMEWORK-2023.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/SCK-ROBOT-FRAMEWORK-2023.pdf -------------------------------------------------------------------------------- /slide/SCK-ROBOT-FRAMEWORK-2024.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/SCK-ROBOT-FRAMEWORK-2024.pdf -------------------------------------------------------------------------------- /slide/SCK-ROBOT-FRAMEWORK-2025.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/SCK-ROBOT-FRAMEWORK-2025.pdf -------------------------------------------------------------------------------- /slide/SCK-ROBOT-FRAMEWORK.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/slide/SCK-ROBOT-FRAMEWORK.pdf -------------------------------------------------------------------------------- /workshop/00_structure.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | 3 | *** Variables *** 4 | 5 | *** Testcases *** 6 | 7 | *** Keywords *** -------------------------------------------------------------------------------- /workshop/01_structure.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | 6 | 7 | *** Testcases *** 8 | My first test case 9 | Open Browser http://www.kcprofessional.com 10 | Maximize Browser Window 11 | Input Text q test ทดสอบ 12 | Click Element xpath=//div[2][@class='btn_search']/input 13 | Wait Until Page Contains No Results 14 | Close Browser 15 | 16 | My second test case 17 | Open Browser http://www.kcprofessional.com 18 | Maximize Browser Window 19 | Input Text q KLEENEX 20 | #Click Link My Product List 21 | Click Element xpath=//div[2][@class='btn_search']/input 22 | Wait Until Page Contains Site Search Result 23 | Element Should Contain resInfo-0 About 1,970 results 24 | Close Browser 25 | 26 | 27 | *** Keywords *** -------------------------------------------------------------------------------- /workshop/02_hello.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | 5 | *** Testcases *** 6 | Hello World 7 | Open Browser http://www.google.com -------------------------------------------------------------------------------- /workshop/03_chrome.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Testcases *** 5 | Test with Chrome 6 | Open Browser http://www.google.com chrome 7 | #[Teardown] Close Browser -------------------------------------------------------------------------------- /workshop/04_all_browser.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | 5 | *** Testcases *** 6 | Test run all browser 7 | @{all browsers}= Create List firefox chrome safari 8 | :FOR ${browser} IN @{all browsers} 9 | \ Open Browser http://www.google.com ${browser} 10 | \ Close Browser -------------------------------------------------------------------------------- /workshop/04_ie.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | 5 | *** Testcases *** 6 | Test with Internet Explorer 7 | Open Browser http://www.google.com ie 8 | Close Browser -------------------------------------------------------------------------------- /workshop/04_param.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | ${BROWSER} firefox 6 | 7 | *** Testcases *** 8 | Test browser from command line 9 | Open Browser http://www.google.com ${BROWSER} 10 | Input Text id=gbqfq ทดสอบ 11 | Click Button id=gbqfb 12 | Wait Until Page Contains ทดสอบ 13 | Close Browser -------------------------------------------------------------------------------- /workshop/04_safari.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Library OperatingSystem 4 | 5 | 6 | *** Testcases *** 7 | Test with Safari 8 | #Set Environment Variable SELENIUM_SERVER_JAR /Users/somkiat/data/slide/robot-framework/sprinter-01-2014-08-16/demo/selenium-server-standalone-2.42.2.jar 9 | Open Browser http://www.google.com safari 10 | #Close Browser -------------------------------------------------------------------------------- /workshop/05_proxy_firefox.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Library OperatingSystem 4 | Library Collections 5 | 6 | 7 | *** Testcases *** 8 | Test with Chrome 9 | ${proxy}= Evaluate sys.modules['selenium.webdriver'].Proxy() sys, selenium.webdriver 10 | ${proxy.http_proxy}= Set Variable localhost:8888 11 | Create Webdriver Firefox proxy=${proxy} 12 | Go To http://www.google.com 13 | Wait Until Page Contains Google 14 | Close All Browsers -------------------------------------------------------------------------------- /workshop/05_proxy_firefox_2.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Library OperatingSystem 4 | Library Collections 5 | 6 | *** Variables *** 7 | ${firefox profile path} /Users/spock/somkiat/training/KIMBERLY-CLARK/robotframework/demo 8 | 9 | 10 | *** Testcases *** 11 | Test with Chrome 12 | Open Browser http://www.google.com ff_profile_dir=${firefox profile path} 13 | Wait Until Page Contains Google 14 | Close All Browsers -------------------------------------------------------------------------------- /workshop/06_proxy_chrome.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Library OperatingSystem 4 | Library Collections 5 | 6 | 7 | *** Testcases *** 8 | Test with Chrome 9 | Set Environment Variable webdriver.chrome.driver /usr/local/bin/chromedriver 10 | 11 | #${chrome dc}= Evaluate selenium.webdriver.DesiredCapabilities.CHROME selenium 12 | #Dictionary Should Not Contain Key ${chrome dc} proxy 13 | #${desired capabilities}= --proxy-server:http://user:password@proxy.com:8080 14 | ${proxy}= Evaluate {'proxy': {'proxyType': 'MANUAL', 'sslProxy': 'user:password@proxy.com:8080'}} 15 | ${chrome_switches} = Create List enable-logging 16 | ${desired_capabilities} = Create Dictionary chrome.switches ${chrome_switches} 17 | Open Browser http://www.google.com/ gc remote_url=http://localhost:4444/wd/hub desired_capabilities=${desired capabilities} 18 | Wait Until Page Contains Google 19 | Close All Browsers -------------------------------------------------------------------------------- /workshop/07_google.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | 5 | *** Testcases *** 6 | Search Data From Google.com 7 | Open Browser http://google.com 8 | Input Text gbqfq Somkiat 9 | Click Button gbqfb 10 | Wait Until Page Contains Somkiat 11 | #Close Browser -------------------------------------------------------------------------------- /workshop/08_todo.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | 5 | *** Testcases *** 6 | Add New My TODO with count 7 | Set Selenium Speed 1 8 | Open Browser http://up1todo.appspot.com/ 9 | Wait Until Page Contains Element todo_text 10 | 11 | ${before count}= Get Matching Xpath Count //li 12 | Input Text todo_text My TODO... 13 | Click Button todo_button 14 | ${after count}= Get Matching Xpath Count //li 15 | ${result}= Evaluate ${after count}-${before count} 16 | Should Be Equal As Integers 1 ${result} 17 | Close Browser 18 | 19 | Check First Page 20 | Open Browser http://up1todo.appspot.com/ 21 | Wait Until Page Contains My TODO 22 | Wait Until Page Contains Element todo_text 23 | Wait Until Page Contains Element todo_button 24 | Close Browser 25 | 26 | Add New My TODO 27 | Open Browser http://up1todo.appspot.com/ 28 | Input Text todo_text First TODO... 29 | Click Button todo_button 30 | Wait Until Page Contains First TODO... 31 | Close Browser 32 | 33 | Mark Success status of Latest My TODO 34 | Open Browser http://up1todo.appspot.com/ 35 | Wait Until Page Contains Element todo_text 36 | ${count}= Get Matching Xpath Count //li 37 | Click Element xpath=//li[${count}] 38 | -------------------------------------------------------------------------------- /workshop/09_invalid_login.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Suite Setup Open the login page 3 | Test Setup Go to login page 4 | Test Template Login With Invalid Credentials Should Fail 5 | Suite Teardown Close Browser 6 | Resource 09_resource.txt 7 | 8 | *** Test Cases *** User Name Password 9 | Invalid Username invalid mode 10 | Invalid Password demo invalid 11 | Invalid Username And Password invalid whatever 12 | Empty Username ${EMPTY} xxx 13 | Empty Password demo ${EMPTY} 14 | Empty Username And Password ${EMPTY} ${EMPTY} 15 | 16 | 17 | *** Keywords *** 18 | Login With Invalid Credentials Should Fail 19 | [Arguments] ${username} ${password} 20 | Fill in username ${username} 21 | Fill in password ${password} 22 | Submit data to system 23 | Login Should Have Failed -------------------------------------------------------------------------------- /workshop/09_resource.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | ${LOGIN_URL} http://localhost:7272/html 6 | ${WELCOME_URL} ${LOGIN_URL}/welcome.html 7 | ${ERROR_URL} ${LOGIN_URL}/error.html 8 | 9 | *** Keywords *** 10 | Open the login page 11 | Open Browser ${LOGIN_URL} 12 | Maximize Browser Window 13 | Set Selenium Speed 0 14 | 15 | Go to login page 16 | Go TO ${LOGIN_URL} 17 | 18 | Fill in username 19 | [Arguments] ${username} 20 | Input Text username_field ${username} 21 | 22 | Fill in password 23 | [Arguments] ${password} 24 | Input Text password_field ${password} 25 | 26 | Submit data to system 27 | Click Button login_button 28 | 29 | Welcome page should be open 30 | Location Should Be ${WELCOME_URL} 31 | Title Should Be Welcome Page 32 | Page Should Contain Login succeeded 33 | 34 | Login Should Have Failed 35 | Location Should Be ${ERROR_URL} 36 | Title Should Be Error Page 37 | -------------------------------------------------------------------------------- /workshop/09_valid_login.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Test Setup Open login page 4 | Test Teardown Close Browser 5 | Resource resources/login.txt 6 | 7 | *** Testcases *** 8 | Valid Login 9 | Fill in user name and password 10 | Submit 11 | Welcome page is show 12 | 13 | *** Keywords *** 14 | Fill in user name and password 15 | Input Text username_field demo1 16 | Input Text password_field mode 17 | 18 | Welcome page is show 19 | Location Should Be ${LOGIN PAGE}/welcome.html 20 | Title Should Be Welcome Page 21 | Page Should Contain Login succeeded 22 | Element Should Contain xpath=//div/h1 Welcome Page 23 | -------------------------------------------------------------------------------- /workshop/09_valid_login_01.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | ${LOGIN_URL} http://localhost:7272/html 6 | ${WELCOME_URL} ${LOGIN_URL}/welcome.html 7 | 8 | 9 | *** Testcases *** 10 | Valid Login 11 | Open Browser ${LOGIN_URL} 12 | 13 | Input Text username_field demo 14 | Input Text password_field mode 15 | Click Button login_button 16 | 17 | Location Should Be ${WELCOME_URL} 18 | Title Should Be Welcome Page 19 | Page Should Contain Login succeeded 20 | 21 | Close Browser -------------------------------------------------------------------------------- /workshop/09_valid_login_02.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | ${LOGIN_URL} http://localhost:7272/html 6 | ${WELCOME_URL} ${LOGIN_URL}/welcome.html 7 | 8 | 9 | *** Testcases *** 10 | Valid Login 11 | Open the login page 12 | Fill in username demo 13 | Fill in password mode 14 | Submit data to system 15 | Welcome page should be open 16 | Close Browser 17 | 18 | *** Keywords *** 19 | Open the login page 20 | Open Browser ${LOGIN_URL} 21 | 22 | Fill in username 23 | [Arguments] ${username} 24 | Input Text username_field ${username} 25 | 26 | Fill in password 27 | [Arguments] ${password} 28 | Input Text password_field ${password} 29 | 30 | Submit data to system 31 | Click Button login_button 32 | 33 | Welcome page should be open 34 | Location Should Be ${WELCOME_URL} 35 | Title Should Be Welcome Page 36 | Page Should Contain Login succeeded 37 | -------------------------------------------------------------------------------- /workshop/09_valid_login_03.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Resource 09_resource.txt 3 | 4 | *** Testcases *** 5 | Valid Login 6 | Open the login page 7 | Fill in username demo 8 | Fill in password mode 9 | Submit data to system 10 | Welcome page should be open 11 | Close Browser -------------------------------------------------------------------------------- /workshop/10_basic_grade.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | #Test Teardown Close Browser 4 | 5 | *** Variables *** 6 | ${HOME_URL} http://demo-jenkins-web.herokuapp.com 7 | 8 | *** Test Cases *** 9 | Convert score 50 to grade D 10 | Open browser to home page 11 | Fill in score 50 12 | I should see result D 13 | [Teardown] Close Browser 14 | 15 | Convert score 80 to grade D 16 | Open browser to home page 17 | Fill in score 80 18 | I should see result A 19 | [Teardown] Close Browser 20 | 21 | *** Keywords *** 22 | Flow for convert score to grade 23 | [Arguments] ${score} ${expected_result} 24 | Open browser to home page 25 | Fill in score ${score} 26 | I should see result ${expected_result} 27 | 28 | Open browser to home page 29 | Open Browser ${HOME_URL} 30 | Maximize Browser Window 31 | Title Should Be Demo Web :: Grade Converter 32 | 33 | Fill in score 34 | [Arguments] ${score} 35 | Input Text score ${score} 36 | Click Button convert 37 | 38 | Fill in data 39 | [Arguments] ${id} ${value} 40 | 41 | I should see result 42 | [Arguments] ${expected_result} 43 | Wait Until Page Contains ${expected_result} 44 | 45 | -------------------------------------------------------------------------------- /workshop/10_example_grade.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Suite Teardown Close Browser 4 | 5 | *** Variables *** 6 | ${HOME_URL} http://demo-jenkins-web.herokuapp.com 7 | 8 | *** Test Cases *** 9 | Rule for Convert score to grade 10 | [Template] Flow for convert score to grade 11 | #----------------# 12 | # Score | Grade # 13 | #----------------# 14 | 0 F 15 | 40 F 16 | 50 D 17 | 60 C 18 | 70 B 19 | 80 A 20 | 100 A 21 | 22 | *** Keywords *** 23 | Flow for convert score to grade 24 | [Arguments] ${score} ${expected_result} 25 | Open browser to home page 26 | Fill in score ${score} 27 | I should see result ${expected_result} 28 | [Teardown] Close Browser 29 | 30 | Open browser to home page 31 | Open Browser ${HOME_URL} 32 | Maximize Browser Window 33 | Title Should Be Demo Web :: Grade Converter 34 | 35 | Fill in score 36 | [Arguments] ${score} 37 | Input Text score ${score} 38 | Click Button convert 39 | 40 | I should see result 41 | [Arguments] ${expected_result} 42 | Wait Until Page Contains ${expected_result} 43 | -------------------------------------------------------------------------------- /workshop/11_keyword.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Testcases **** 5 | Valid login 6 | Goto login page 7 | Fill in username demo 8 | Fill in password mode 9 | 10 | *** Keywords *** 11 | Goto login page 12 | Open Browser http://localhost:7272/html 13 | 14 | Fill in username 15 | [Arguments] ${username} 16 | Input Text username_field ${username} 17 | 18 | Fill in password 19 | [Arguments] ${password} 20 | Input Text password_field ${password} 21 | -------------------------------------------------------------------------------- /workshop/12_tag.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | Force Tags FunctionalTest 5 | Default Tags ValidTest 6 | 7 | *** Testcases **** 8 | Valid login 9 | Goto login page 10 | Fill in username demo 11 | Fill in password mode 12 | 13 | Invalid login with wrong password 14 | [Tags] InvalidTest 15 | Goto login page 16 | Fill in username demo 17 | Fill in password xxxx 18 | 19 | *** Keywords *** 20 | Goto login page 21 | Open Browser http://localhost:7272/html 22 | 23 | Fill in username 24 | [Arguments] ${username} 25 | Input Text username_field ${username} 26 | 27 | Fill in password 28 | [Arguments] ${password} 29 | Input Text password_field ${password} 30 | -------------------------------------------------------------------------------- /workshop/13_setup.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | Test Setup Goto login page 5 | Test Teardown Close Browser 6 | 7 | *** Testcases **** 8 | Valid login 9 | Fill in username demo 10 | Fill in password mode 11 | 12 | Invalid login with wrong password 13 | Fill in username demo 14 | Fill in password xxxx 15 | 16 | *** Keywords *** 17 | Goto login page 18 | Open Browser http://localhost:7272/html 19 | 20 | Fill in username 21 | [Arguments] ${username} 22 | Input Text username_field ${username} 23 | 24 | Fill in password 25 | [Arguments] ${password} 26 | Input Text password_field ${password} 27 | -------------------------------------------------------------------------------- /workshop/14_library_buildin.txt: -------------------------------------------------------------------------------- 1 | *** Test Cases *** 2 | Demo 3 | @{my_words}= Create List Hello Robot SPRINT3R X Framework 4 | Log \n@{my_words} console=True 5 | 6 | ${length}= Get Length ${my_words} 7 | Log \nLength = ${length} console=True 8 | 9 | Length Should Be ${my_words} 5 10 | 11 | :FOR ${word} IN @{my_words} 12 | \ Run Keyword If '${word}' == 'X' Exit For Loop 13 | 14 | \ ${length}= Get Length ${word} 15 | \ Log \n${word} have length ${length} console=True -------------------------------------------------------------------------------- /workshop/15_table.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Suite Setup Open Browser http://up1-table.herokuapp.com/ 4 | Test Teardown Go To http://up1-table.herokuapp.com/ 5 | Suite Teardown Close All Browsers 6 | 7 | 8 | *** Testcases *** 9 | Get total item 10 | ${all item} Get Text xpath=//span 11 | Should Be True '${all item} == 11' 12 | 13 | Check first page 14 | ${current page} Get Text xpath=//li[@class='footable-page active']/a 15 | Should Be True '${current page} == 1' 16 | 17 | First page of table 18 | ${count}= Get Matching Xpath Count xpath=//tr[@style='display: table-row;'] 19 | Should Be True '${count} == 3' -------------------------------------------------------------------------------- /workshop/browser.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | ${browser} firefox 6 | 7 | *** Testcases *** 8 | Test browser 9 | Open Browser http://localhost:7272/html ${browser} -------------------------------------------------------------------------------- /workshop/calculate_grade.txt: -------------------------------------------------------------------------------- 1 | *** Testcases *** 2 | Grade Calculator 3 | [Template] Calculate my grade 4 | 88 A 5 | 80 A 6 | 70 B 7 | 60 C 8 | 50 D 9 | 40 F 10 | 11 | 12 | *** Keywords *** 13 | Calculate my grade 14 | [Arguments] ${score} ${expected grade} 15 | ${grade}= Set Variable If 16 | ... ${score} >= 80 A 17 | ... ${score} >= 70 B 18 | ... ${score} >= 60 C 19 | ... ${score} >= 50 D 20 | ... ${score} < 50 F 21 | 22 | Should Be Equal As Strings ${expected grade} ${grade} 23 | Log \nScore=${score} got grade ${grade} console=yes -------------------------------------------------------------------------------- /workshop/calculate_grade_with_dictionary.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Collections 3 | 4 | *** Testcases *** 5 | Grade Calculator 6 | [Template] Calculate my grade 7 | 88 A 8 | 80 A 9 | 70 B 10 | 60 C 11 | 50 D 12 | 45 D 13 | 40 F 14 | 30 F 15 | 16 | 17 | *** Keywords *** 18 | Calculate my grade 19 | [Arguments] ${score} ${expected grade} 20 | ${actual grade}= Set Variable Unknown 21 | ${grade mapping}= Create Dictionary 40 F 50 D 60 C 70 B 80 A 22 | 23 | ${items}= Get Dictionary Items ${grade mapping} 24 | :FOR ${key} ${value} IN @{items} 25 | \ ${actual grade}= Set Variable ${value} 26 | \ Exit For Loop If '${score}' <= '${key}' 27 | 28 | 29 | Should Be Equal As Strings ${expected grade} ${actual grade} -------------------------------------------------------------------------------- /workshop/cnx_demo/browser.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | ${BROWSER} firefox 6 | 7 | *** Testcases *** 8 | Test multi browser 9 | Open Browser http://www.google.com browser=${BROWSER} -------------------------------------------------------------------------------- /workshop/cnx_demo/facebook.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Test Teardown Close Browser 4 | 5 | *** Variables *** 6 | ${expected result} ขออภัย ดูเหมือนว่า somkiat_spns@hotmail.com จะเป็นของบัญชีที่มีอยู่แล้ว คุณต้องการ ? หรือไม่ 7 | 8 | *** Testcases *** 9 | Failure register with existing email 10 | Open register page 11 | Fill in user information 12 | Sign up 13 | I will see error with existing email account 14 | 15 | *** Keywords *** 16 | Open register page 17 | Open Browser https://www.facebook.com/ 18 | Maximize Browser Window 19 | 20 | Fill in user information 21 | Input Text firstname somkiat 22 | Input Text lastname puisungnoen 23 | Input Text reg_email__ somkiat_spns@hotmail.com 24 | Input Text reg_email_confirmation__ somkiat_spns@hotmail.com 25 | Input Text reg_passwd__ 1234567890 26 | Select From List By Value birthday_day 10 27 | Select From List By Value birthday_month 12 28 | Select From List By Value birthday_year 1981 29 | Select Radio Button sex 2 30 | 31 | Sign up 32 | Click Button สมัครใช้งาน 33 | 34 | I will see error with existing email account 35 | Wait Until Page Contains ขออภัย ดูเหมือนว่า somkiat_spns@hotmail.com จะเป็นของบัญชีที่มีอยู่แล้ว 36 | Wait Until Element Is Visible reg_error_inner 37 | 38 | Wait Until Element Contains reg_error_inner ขออภัย ดูเหมือนว่า somkiat_spns@hotmail.com จะเป็นของบัญชีที่มีอยู่แล้ว คุณต้องการ ? หรือไม่ 39 | 40 | ${actual result}= Get Text id=reg_error_inner 41 | Should Be Equal ${expected result} ${actual result} 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /workshop/cnx_demo/hello.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | 6 | *** Testcases *** 7 | Search data from google 8 | [Documentation] create by somkiat 9 | Open google.com 10 | Fill in keyword is ยี่เป็ง 11 | Press search button 12 | I see ยี่เป็ง เชียงใหม่ และ ลอยกระทง 13 | Close Browser 14 | 15 | *** Keywords *** 16 | Open google.com 17 | Open Browser http://www.google.com 18 | 19 | Fill in keyword is ยี่เป็ง 20 | Input Text q ยี่เป็ง 21 | 22 | Press search button 23 | Click Button btnG 24 | 25 | I see ยี่เป็ง เชียงใหม่ และ ลอยกระทง 26 | Wait Until Page Contains ยี่เป็ง 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /workshop/cnx_demo/lazada.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | #Test Teardown Close Browser 4 | 5 | 6 | *** Testcases *** 7 | Search product by keyword 8 | Open first page 9 | Fill in iphone6s 10 | Search product 11 | I will see result of iphone6s 12 | Click product 13 | 14 | See product detail 15 | [Tags] dev 16 | Open first page 17 | Fill in iphone6s 18 | Search product 19 | I will see result of iphone6s 20 | Click product 21 | Add to cart 22 | Payment 23 | 24 | Checkout process 25 | Open Browser http://www.lazada.co.th/apple-iphone-6s-128gb-47-rose-gold-2154232.html 26 | Maximize Browser Window 27 | 28 | 29 | 30 | *** Keywords *** 31 | Payment 32 | Wait Until Element Is Visible xpath=//div/div[2]/div/div[3]/div/a/span 33 | Click Element xpath=//div/div[2]/div/div[3]/div/a/span 34 | 35 | Add to cart 36 | Wait Until Element Is Visible xpath=//div[3]/div[2]/div/div[2]/div/div[3]/span 37 | Click Element xpath=//div[3]/div[2]/div/div[2]/div/div[3]/span 38 | Click Button AddToCart 39 | 40 | 41 | Click product 42 | Wait Until Page Contains Element xpath=//div[@class='catalog__main__content']/div[2]/div[2]/a/div[3]/div[1]/span 43 | Click Element xpath=//div[@class='catalog__main__content']/div[2]/div[2]/a/div[3]/div[1]/span 44 | 45 | Open first page 46 | Open Browser https://www.lazada.co.th/ 47 | Maximize Browser Window 48 | 49 | Fill in iphone6s 50 | Input Text searchInput iphone6s 51 | 52 | Search product 53 | Click Element xpath=//*[@id="search"]/div 54 | 55 | I will see result of iphone6s 56 | Title Should Be iPhone 6s ซื้อไอโฟน 6s พลัส ราคาดีที่สุด I Lazada.co.th 57 | Wait Until Page Contains Element xpath=//div/h1[@class='catalog__title'] 58 | Wait Until Element Contains xpath=//div/h1[@class='catalog__title'] iPhone 6s 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /workshop/cnx_demo/login_failure.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Test Teardown Close Browser 4 | 5 | *** Testcases *** 6 | Wrong username 7 | เปิดหน้า login 8 | กรอก username และ password demo1 mode 9 | เข้าสู่ระบบ 10 | I see error page 11 | 12 | Wrong password 13 | เปิดหน้า login 14 | กรอก username และ password demo mode1 15 | เข้าสู่ระบบ 16 | I see error page 17 | 18 | Wrong username and password 19 | เปิดหน้า login 20 | กรอก username และ password demo1 mode1 21 | เข้าสู่ระบบ 22 | I see error page 23 | 24 | Empty username 25 | เปิดหน้า login 26 | กรอก username และ password ${EMPTY} mode 27 | เข้าสู่ระบบ 28 | I see error page 29 | 30 | Empty password 31 | เปิดหน้า login 32 | กรอก username และ password demo ${EMPTY} 33 | เข้าสู่ระบบ 34 | I see error page 35 | 36 | Empty username and password 37 | เปิดหน้า login 38 | กรอก username และ password ${EMPTY} ${EMPTY} 39 | เข้าสู่ระบบ 40 | I see error page 41 | 42 | *** Keywords *** 43 | เปิดหน้า login 44 | Open Browser http://localhost:7272/html/ 45 | 46 | กรอก username และ password 47 | [Arguments] ${username} ${password} 48 | Input Text username_field ${username} 49 | Input Text password_field ${password} 50 | 51 | เข้าสู่ระบบ 52 | Click Button LOGIN 53 | 54 | I see error page 55 | Wait Until Page Contains Error Page 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /workshop/cnx_demo/login_failure_2.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Resource resources/login.txt 4 | Suite Setup เปิดหน้า login 5 | Test Setup Go to login page 6 | Suite Teardown Close Browser 7 | 8 | *** Testcases *** 9 | Wrong username 10 | กรอก username และ password demo1 mode 11 | เข้าสู่ระบบ 12 | I see error page 13 | 14 | Wrong password 15 | กรอก username และ password demo mode1 16 | เข้าสู่ระบบ 17 | I see error page 18 | 19 | Wrong username and password 20 | กรอก username และ password demo1 mode1 21 | เข้าสู่ระบบ 22 | I see error page 23 | 24 | Empty username 25 | กรอก username และ password ${EMPTY} mode 26 | เข้าสู่ระบบ 27 | I see error page 28 | 29 | Empty password 30 | กรอก username และ password demo ${EMPTY} 31 | เข้าสู่ระบบ 32 | I see error page 33 | 34 | Empty username and password 35 | กรอก username และ password ${EMPTY} ${EMPTY} 36 | เข้าสู่ระบบ 37 | I see error page 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /workshop/cnx_demo/login_failure_3.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Resource resources/login.txt 4 | Suite Setup Login.เปิดหน้า login 5 | Test Setup Login.Go to login page 6 | Suite Teardown Close Browser 7 | Test Template Flow of login fail 8 | 9 | *** Testcases *** USER PASS 10 | Wrong username demo1 mode 11 | Wrong password demo mode1 12 | Wrong username and password demo1 mode1 13 | Empty username ${EMPTY} mode 14 | Empty password demo1 ${EMPTY} 15 | Empty username and password ${EMPTY} ${EMPTY} 16 | 17 | *** Keywords *** 18 | Flow of login fail 19 | [Arguments] ${username} ${password} 20 | Login.กรอก username และ password ${username} ${password} 21 | Login.เข้าสู่ระบบ 22 | Login.I see error page 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /workshop/cnx_demo/login_success.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Test Teardown Close Browser 4 | 5 | *** Testcases *** 6 | Login sucess 7 | เปิดหน้า login 8 | กรอก username และ password 9 | เข้าสู่ระบบ 10 | User logged in success 11 | 12 | *** Keywords *** 13 | เปิดหน้า login 14 | Open Browser http://localhost:7272/html/ 15 | 16 | กรอก username และ password 17 | Input Text username_field demo 18 | Input Text password_field mode 19 | 20 | เข้าสู่ระบบ 21 | Click Button LOGIN 22 | 23 | User logged in success 24 | Wait Until Page Contains Welcome Page 25 | Page Should Contain Link link=logout 26 | Click Link link=logout 27 | Wait Until Page Contains Login Page 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /workshop/cnx_demo/resources/login.txt: -------------------------------------------------------------------------------- 1 | *** Keywords *** 2 | Go to login page 3 | Go To http://localhost:7272/html/ 4 | 5 | เปิดหน้า login 6 | Open Browser http://localhost:7272/html/ 7 | 8 | กรอก username และ password 9 | [Arguments] ${username} ${password} 10 | Input Text username_field ${username} 11 | Input Text password_field ${password} 12 | 13 | เข้าสู่ระบบ 14 | Click Button LOGIN 15 | 16 | I see error page 17 | Wait Until Page Contains Error Page -------------------------------------------------------------------------------- /workshop/compare.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library OperatingSystem 3 | 4 | 5 | *** Test cases *** 6 | Compare 2 csv file with size 7 | ${file_1_size}= Get File Size test1.csv 8 | ${file_2_size}= Get File Size test2.csv 9 | Should Be Equal ${file_1_size} ${file_2_size} 10 | 11 | Compare 2 csv file with content 12 | ${file_1_content}= Get File test1.csv 13 | ${file_2_content}= Get File test2.csv 14 | Should Be Equal ${file_1_content} ${file_2_content} 15 | 16 | 17 | -------------------------------------------------------------------------------- /workshop/csv/CSVLibrary.py: -------------------------------------------------------------------------------- 1 | import csv 2 | from robot.api import logger 3 | 4 | class CSVLibrary(object): 5 | 6 | def read_csv_file(self, filename): 7 | f = open(filename, 'r') 8 | csvfile = csv.reader(f) 9 | f.close 10 | return [row for row in csvfile] -------------------------------------------------------------------------------- /workshop/csv/demo_csv.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library CSVLibrary.py 3 | 4 | *** Testcases *** 5 | Read file from csv 6 | ${all users}= Read CSV File sample.csv 7 | :FOR ${user} in @{all users} 8 | \ Log @{user}[0] - @{user}[1] 9 | -------------------------------------------------------------------------------- /workshop/csv/demo_read_data_from_csv.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library CSVLibrary.py 3 | 4 | *** Testcases *** 5 | Read file from csv 6 | [Template] demo of datas from csv 7 | [Setup] prepare data 8 | :FOR ${user} in @{all users} 9 | \ @{user}[0] @{user}[1] 10 | 11 | 12 | *** Keywords *** 13 | prepare data 14 | ${all users}= Read CSV File sample.csv 15 | Set Test Variable ${all users} ${all users} 16 | 17 | Demo of datas from csv 18 | [Arguments] ${username} ${password} 19 | Log ${username} - ${password} 20 | -------------------------------------------------------------------------------- /workshop/csv/login_fail_with_csv.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Library Collections 4 | Library CSVLibrary.py 5 | Test Setup Open login page 6 | Test Teardown Close Browser 7 | 8 | *** Testcases *** 9 | Rule of login failure 10 | [Template] Flow of login failure 11 | :FOR ${user} in @{all users} 12 | \ @{user}[0] @{user}[1] 13 | 14 | *** Keywords *** 15 | Flow of login failure 16 | [Arguments] ${username} ${password} 17 | Fill in information ${username} ${password} 18 | Login to system 19 | I will see Error page 20 | Go To http://localhost:7272/html/ 21 | 22 | Prepare data 23 | ${all users}= read_csv_file sample.csv 24 | Set Test Variable ${all users} ${all users} 25 | 26 | Open login page 27 | Prepare data 28 | Open Browser http://localhost:7272/html/ 29 | 30 | Fill in information 31 | [Arguments] ${username} ${password} 32 | Input Text username_field ${username} 33 | Input Text password_field ${password} 34 | 35 | Login to system 36 | Click Button LOGIN 37 | 38 | I will see Error page 39 | Wait Until Page Contains Error Page 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /workshop/csv/sample.csv: -------------------------------------------------------------------------------- 1 | demo1,mode 2 | demo,mode1 3 | demo1,mode1 4 | ,mode 5 | demo, 6 | , -------------------------------------------------------------------------------- /workshop/cupcake_test.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | 6 | *** Testcases *** 7 | Search cupcake 8 | [Teardown] Close Browser 9 | เข้า Google 10 | ค้นหา keyword ว่า cupcake 11 | ต้องเจอคำว่า cupcake 12 | 13 | *** Keywords *** 14 | เข้า Google 15 | Open Browser http://www.google.com 16 | 17 | ค้นหา keyword ว่า cupcake 18 | Input Text q cupcake 19 | Click Button btnG 20 | 21 | ต้องเจอคำว่า cupcake 22 | Wait Until Page Contains cupcake1 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /workshop/demo-login/html/demo.css: -------------------------------------------------------------------------------- 1 | /* Simple styles for demo 2 | * 3 | * Setting text-align is a workaround for IE. See for example 4 | * http://bluerobot.com/web/css/center1.html 5 | */ 6 | 7 | body { 8 | font-family: sans-serif; 9 | color: black; 10 | background: #DDDDDD; 11 | text-align: center; 12 | } 13 | #container { 14 | width: 30em; 15 | height: 15em; 16 | margin: 5em auto; 17 | background: white; 18 | border: 1px solid gray; 19 | padding: 10px 30px; 20 | text-align: left; 21 | } 22 | -------------------------------------------------------------------------------- /workshop/demo-login/server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Copyright 2008-2011 Nokia Siemens Networks Oyj 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | """Simple HTTP server requiring only Python and no other preconditions. 18 | 19 | Server is started by running this script with argument 'start' and 20 | optional port number (default port 7272). Server root is the same 21 | directory where this script is situated. Server can be stopped either 22 | using Ctrl-C or running this script with argument 'stop' and same port 23 | number as when starting it. 24 | """ 25 | 26 | import os 27 | import sys 28 | import httplib 29 | import BaseHTTPServer 30 | import SimpleHTTPServer 31 | 32 | 33 | DEFAULT_PORT = 7272 34 | DEFAULT_HOST = 'localhost' 35 | 36 | 37 | class StoppableHttpServer(BaseHTTPServer.HTTPServer): 38 | 39 | def serve_forever(self): 40 | self.stop = False 41 | while not self.stop: 42 | try: 43 | self.handle_request() 44 | except KeyboardInterrupt: 45 | break 46 | 47 | 48 | class StoppableHttpRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): 49 | 50 | def do_QUIT(self): 51 | self.send_response(200) 52 | self.end_headers() 53 | self.server.stop = True 54 | 55 | def do_POST(self): 56 | # We could also process paremeters here using something like below. 57 | # length = self.headers['Content-Length'] 58 | # print self.rfile.read(int(length)) 59 | self.do_GET() 60 | 61 | 62 | def start_server(host=DEFAULT_HOST, port=DEFAULT_PORT): 63 | print "Demo application starting on port %s" % port 64 | root = os.path.dirname(os.path.abspath(__file__)) 65 | os.chdir(root) 66 | server = StoppableHttpServer((host, int(port)), StoppableHttpRequestHandler) 67 | server.serve_forever() 68 | 69 | def stop_server(host=DEFAULT_HOST, port=DEFAULT_PORT): 70 | print "Demo application on port %s stopping" % port 71 | conn = httplib.HTTPConnection("%s:%s" % (host, port)) 72 | conn.request("QUIT", "/") 73 | conn.getresponse() 74 | 75 | def print_help(): 76 | print __doc__ 77 | 78 | 79 | if __name__ == '__main__': 80 | try: 81 | {'start': start_server, 82 | 'stop': stop_server, 83 | 'help': print_help}[sys.argv[1]](*sys.argv[2:]) 84 | except (IndexError, KeyError, TypeError): 85 | print 'Usage: %s start|stop|help [port]' % os.path.basename(sys.argv[0]) 86 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink/WebDemo-20150901.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/workshop/demo/workshop-brink/WebDemo-20150901.zip -------------------------------------------------------------------------------- /workshop/demo/workshop-brink/facebook.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Test Teardown Close Browser 4 | 5 | *** Testcases *** 6 | Names on Facebook can't contain a large number of repeating characters 7 | ไปที่หน้าแรกของ facebook 8 | กรอกข้อมูลส่วนตัวของ Somkiat 9 | สร้าง account ใหม่ 10 | แสดง error message 11 | 12 | *** Keywords *** 13 | แสดง error message 14 | Wait Until Element Contains id=reg_error_inner ชื่อบน${SPACE*1}Facebook ไม่สามารถมีอักขระที่ซ้ำกันเป็นจำนวนมากได้ 15 | 16 | สร้าง account ใหม่ 17 | Click Element name=websubmit 18 | 19 | กรอกข้อมูลส่วนตัวของ Somkiat 20 | Input Text name=firstname Somkiat 21 | Input Text name=lastname ddd 22 | Input Text name=reg_email__ 0868696209 23 | Input Text name=reg_passwd__ 1kdkrfmDsdfj 24 | กรอกข้อมูลวันเดือนปีเกิด 10 12 1981 25 | Select Radio Button sex 2 26 | 27 | กรอกข้อมูลวันเดือนปีเกิด 28 | [Arguments] ${day} ${month} ${year} 29 | Select From List By Value name=birthday_day ${day} 30 | Select From List By Value name=birthday_month ${month} 31 | Select From List By Value name=birthday_year ${year} 32 | 33 | ไปที่หน้าแรกของ facebook 34 | Open Browser http://www.facebook.com browser=gc 35 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink/google.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | 6 | *** Testcases *** 7 | หาแฟนผ่าน google 8 | เปิด browser ไปที่ google 9 | ใส่คำว่า หาแฟน 10 | ต้องเจอ url www.houseoflover.com/hol/home/friendfind.aspx 11 | [Teardown] Close Browser 12 | 13 | หาแฟนผ่าน google 2 14 | [Tags] testing 15 | เปิด browser ไปที่ google 16 | ใส่คำว่า หาแฟน 17 | ต้องเจอ url www.houseoflover.com/hol/home/friendfind.aspx 18 | [Teardown] Close Browser 19 | 20 | หาแฟนผ่าน google 3 21 | [Tags] testing 22 | เปิด browser ไปที่ google 23 | ใส่คำว่า หาแฟน 24 | ต้องเจอ url www.houseoflover.com/hol/home/friendfind.aspx 25 | [Teardown] Close Browser 26 | 27 | *** Keywords *** 28 | ใส่คำว่า หาแฟน 29 | Input Text name=q หาแฟน 30 | Press Key name=q \\13 31 | 32 | ต้องเจอ url www.houseoflover.com/hol/home/friendfind.aspx 33 | Page Should Contain www.houseoflover.com/hol/home/friendfind.aspx 34 | 35 | เปิด browser ไปที่ google 36 | Open Browser http://www.google.com browser=gc 37 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink/google2.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Resource resources/google.robot 3 | Suite Setup เปิด browser ไปที่ google 4 | Suite Teardown Close Browser 5 | Test Teardown ไปหน้าแรก 6 | 7 | *** Testcases *** 8 | หาแฟนผ่าน google 9 | ใส่คำว่า หาแฟน 10 | ต้องเจอ url www.houseoflover.com/hol/home/friendfind.aspx 11 | 12 | หาแฟนผ่าน google 2 13 | ใส่คำว่า หาแฟน 14 | ต้องเจอ url www.houseoflover.com/hol/home/friendfind.aspx 15 | 16 | หาแฟนผ่าน google 3 17 | ใส่คำว่า หาแฟน 18 | ต้องเจอ url www.houseoflover.com/hol/home/friendfind.aspx 19 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink/hello.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | 5 | *** Testcases *** 6 | Hello 7 | Open Browser http://www.google.com browser=chrome 8 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink/login_fail.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Suite Setup เปิดหน้า login 4 | Suite Teardown Close Browser 5 | Test Setup ไปยังหน้า login 6 | Test Template Flow of Login fail 7 | 8 | *** Variables *** 9 | ${LOGIN URL} http://localhost:7272/ 10 | 11 | *** Testcases *** Username Password 12 | User Name ผิด demo1 mode 13 | Password ผิด demo mode1 14 | ผิดทั้งคู่ demo1 mode1 15 | User Name ว่าง ${EMPTY} mode 16 | 17 | *** Keywords *** 18 | Flow of Login fail 19 | [Arguments] ${username} ${password} 20 | ทำการกรอกข้อมูล ${username} ${password} 21 | แสดงหน้า Error 22 | 23 | แสดงหน้า Error 24 | Wait Until Page Contains Error Page 25 | 26 | ทำการกรอกข้อมูล 27 | [Arguments] ${username} ${password} 28 | Input Text username_field ${username} 29 | Input Text username_field ${password} 30 | Click Button LOGIN 31 | 32 | ไปยังหน้า login 33 | Go to ${LOGIN URL} 34 | 35 | เปิดหน้า login 36 | Open Browser ${LOGIN URL} browser=gc 37 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink/login_fail2.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Resource pages/login.robot 4 | Resource pages/error.robot 5 | 6 | Suite Setup เปิดหน้า login 7 | Suite Teardown Close Browser 8 | Test Setup ไปยังหน้า login 9 | Test Template Flow of Login fail 10 | 11 | *** Variables *** 12 | ${LOGIN URL} http://localhost:7272/ 13 | 14 | *** Testcases *** Username Password 15 | User Name ผิด demo1 mode 16 | Password ผิด demo mode1 17 | ผิดทั้งคู่ demo1 mode1 18 | User Name ว่าง ${EMPTY} mode 19 | 20 | *** Keywords *** 21 | Flow of Login fail 22 | [Arguments] ${username} ${password} 23 | login.กรอกข้อมูล ${username} ${password} 24 | login.กดปุ่ม login 25 | error.แสดงหน้า Error 26 | 27 | ไปยังหน้า login 28 | Go to ${LOGIN URL} 29 | 30 | เปิดหน้า login 31 | Open Browser ${LOGIN URL} browser=gc 32 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink/pages/error.robot: -------------------------------------------------------------------------------- 1 | *** Keywords *** 2 | แสดงหน้า Error 3 | Wait Until Page Contains Error Page 4 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink/pages/login.robot: -------------------------------------------------------------------------------- 1 | *** Keywords *** 2 | กรอกข้อมูล 3 | [Arguments] ${username} ${password} 4 | Input Text username_field ${username} 5 | Input Text username_field ${password} 6 | 7 | กดปุ่ม login 8 | Click Button LOGIN 9 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink/resources/google.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | ${URL} http://www.google.com 6 | 7 | *** Keywords *** 8 | ไปหน้าแรก 9 | Go To ${URL} 10 | 11 | ใส่คำว่า หาแฟน 12 | Input Text name=q หาแฟน 13 | Press Key name=q \\13 14 | 15 | ต้องเจอ url www.houseoflover.com/hol/home/friendfind.aspx 16 | Page Should Contain www.houseoflover.com/hol/home/friendfind.aspx 17 | 18 | เปิด browser ไปที่ google 19 | Open Browser ${URL} browser=gc 20 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink/somkiat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/workshop/demo/workshop-brink/somkiat.jpg -------------------------------------------------------------------------------- /workshop/demo/workshop-brink/somkiat2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/workshop/demo/workshop-brink/somkiat2.jpg -------------------------------------------------------------------------------- /workshop/demo/workshop-brink/split_data.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library String 3 | 4 | *** Testcases *** 5 | Split date 10/12/2017 6 | @{words}= Split String 08/12/2017 \/ 7 | Log to console @{words}[0] 8 | ${temp}= Convert to integer @{words}[0] 9 | Log to console ${temp} 10 | Log to console @{words}[1] 11 | Log to console @{words}[2] 12 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink/upload_file.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Testcases *** 5 | Upload 1 ไฟล์ 6 | เปิดหน้า upload file 7 | เลือกไฟล์ somkiat.jpg 8 | ข้อมูลไฟล์ต้องมีใน Upload queue 1 ไฟล์ 9 | ทำการ upload file 10 | Queue progress ต้องแสดง 100% 11 | 12 | Upload 2 ไฟล์ 13 | [Tags] testing 14 | เปิดหน้า upload file 15 | เลือกไฟล์ somkiat.jpg 16 | เลือกไฟล์ somkiat2.jpg 17 | ข้อมูลไฟล์ต้องมีใน Upload queue 2 ไฟล์ 18 | ทำการ upload file 19 | Queue progress ต้องแสดง 100% 20 | 21 | ตรวจสอบหน้าหลักของการ upload file 22 | เปิดหน้า upload file 23 | ต้องมี Select files ทางด้านซ้าย 24 | # ต้องมี Upload queue ทางด้านขวา 25 | Queue progress ต้องแสดง 0% 26 | ต้องมี 3 ปุ่มที่กดไม่ได้คือ Upload all, Cancel all และ Remove all 27 | 28 | *** Keywords *** 29 | ทำการ upload file 30 | Click Element 31 | ... xpath=//*[@id="ng-app"]/body/div/div[2]/div[2]/div/button[1] 32 | 33 | ข้อมูลไฟล์ต้องมีใน Upload queue 2 ไฟล์ 34 | Xpath Should Match X Times 35 | ... //table/tbody/tr 36 | ... 2 37 | 38 | ข้อมูลไฟล์ต้องมีใน Upload queue 1 ไฟล์ 39 | Xpath Should Match X Times 40 | ... //table/tbody/tr 41 | ... 1 42 | 43 | เลือกไฟล์ 44 | [Arguments] ${filename} 45 | Choose File 46 | ... xpath=//*[@id="ng-app"]/body/div/div[2]/div[1]/input[2] 47 | ... /Users/somkiat/data/slide/robot-framework/workshop-brink/${filename} 48 | 49 | Queue progress ต้องแสดง 50 | [Arguments] ${percent} 51 | Wait Until Page Contains Element 52 | ... xpath=//div[@class="progress"]/div[@style="width: ${percent};"] 53 | 54 | ต้องมี 3 ปุ่มที่กดไม่ได้คือ Upload all, Cancel all และ Remove all 55 | Wait Until Page Contains Element xpath=//div/button[1] 56 | Element Should Be Disabled xpath=//div/button[1] 57 | 58 | Xpath Should Match X Times 59 | ... //div/button 60 | ... 3 61 | 62 | ต้องมี Select files ทางด้านซ้าย 63 | Wait Until Page Contains Element 64 | ... xpath=//div[@class="col-md-3"]/h3 65 | 66 | Wait Until Element Contains 67 | ... xpath=//div[@class="col-md-3"]/h3 68 | ... Select files 69 | 70 | เปิดหน้า upload file 71 | Open Browser 72 | ... http://nervgh.github.io/pages/angular-file-upload/examples/simple/ 73 | ... browser=gc 74 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink02/api.yaml: -------------------------------------------------------------------------------- 1 | - request: 2 | method: GET 3 | url: /v1/customer/1 4 | 5 | response: 6 | status: 200 7 | headers: 8 | content-type: application/json 9 | file: output.json 10 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink02/demo.robot: -------------------------------------------------------------------------------- 1 | *** Variables *** 2 | ${URL} my url 3 | ${ACTION} my action 4 | 5 | *** Testcases *** 6 | Test Concat 7 | Log to console ${URL}-${ACTION} 8 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink02/facebook_register.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Testcases *** 5 | Password too short 6 | Go to registration page 7 | Fill in name 8 | Fill in email 9 | Fill in password 10 | Choose birthdate 11 | Choose gender 12 | Register 13 | Should show error message with password too short 14 | 15 | *** Keywords *** 16 | Should show error message with password too short 17 | Wait Until Element Is Visible id=reg_error_inner 18 | Wait Until Element Contains id=reg_error_inner โปรดเลือกรหัสผ่านที่ปลอดภัยกว่านี้ รหัสผ่านควรมีความยาว 6 อักขระขึ้นไป และเป็นรหัสที่คุณจดจำได้ง่ายแต่คนอื่นคาดเดาได้ยาก 19 | 20 | Register 21 | # Click Element name=websubmit 22 | Click Button name=websubmit 23 | 24 | Choose gender 25 | Select Radio Button sex 2 26 | Click Element id=u_0_7 27 | Click Element xpath=//*[@id="u_0_7"] 28 | 29 | Choose birthdate 30 | Select From List By Value name=birthday_day 10 31 | Select From List By Value name=birthday_month 12 32 | Select From List By Value name=birthday_year 1981 33 | 34 | Fill in password 35 | Input Text name=reg_passwd__ 12345678 36 | 37 | Fill in email 38 | Input Text name=reg_email__ somkiat.p@gmail.com 39 | Input Text name=reg_email_confirmation__ somkiat.p@gmail.com 40 | 41 | Fill in name 42 | Input Text name=firstname Somkiat 43 | Input Text name=lastname Puisungnoen 44 | 45 | Go to registration page 46 | Open Browser https://www.facebook.com browser=chrome 47 | Maximize Browser Window 48 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink02/google.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Test Teardown Close Browser 4 | 5 | *** Variables *** 6 | ${BASE_URL} https://www.google.co.th 7 | 8 | *** Testcases *** 9 | Find robot-wikipedia in google 10 | Go to google.com 11 | Search robot 12 | Find text Robot - Wikipedia 13 | 14 | Find หวย in google 2 15 | [Tags] test 16 | Go to google.com 17 | Search หวย 18 | Find text ตรวจสลากกินแบ่งรัฐบาล 19 | 20 | *** Keywords *** 21 | Search 22 | [Arguments] ${word} 23 | Input Text name=q ${word} 24 | Press Key name=q \\13 25 | 26 | Find text 27 | [Arguments] ${expected_result} 28 | Page Should Contain ${expected_result} 29 | # Wait Until Element Contains xpath=//*[@id="rso"]/div[1]/div/div[2]/div/div/h3/a Robot${SPACE}- Wikipedia 30 | 31 | 32 | Go to google.com 33 | Open Browser ${BASE_URL} browser=gc 34 | Maximize Browser Window 35 | Capture Page Screenshot 36 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink02/google_v2.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Suite Setup Go to google.com 4 | Suite Teardown Close Browser 5 | Test Setup Back to google.com 6 | Test Template Flow to find data in google 7 | 8 | *** Variables *** 9 | ${BASE_URL} https://www.google.co.th 10 | 11 | *** Testcases *** 12 | TC01 robot Robot - Wikipedia 13 | TC02 หวย ตรวจสลากกินแบ่งรัฐบาล 14 | 15 | *** Keywords *** 16 | Flow to find data in google 17 | [Arguments] ${word} ${expected_result} 18 | Search ${word} 19 | Find text ${expected_result} 20 | 21 | Search 22 | [Arguments] ${word} 23 | Input Text name=q ${word} 24 | Press Key name=q \\13 25 | 26 | Find text 27 | [Arguments] ${expected_result} 28 | Page Should Contain ${expected_result} 29 | # Wait Until Element Contains xpath=//*[@id="rso"]/div[1]/div/div[2]/div/div/h3/a Robot${SPACE}- Wikipedia 30 | 31 | Go to google.com 32 | Open Browser ${BASE_URL} browser=gc 33 | Maximize Browser Window 34 | Capture Page Screenshot 35 | 36 | Back to google.com 37 | Go To ${BASE_URL} 38 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink02/httpbin_api.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Collections 3 | Library RequestsLibrary 4 | 5 | *** Testcases *** 6 | Try to test 7 | [Tags] dev 8 | Create Session local http://localhost:8882 9 | ${response}= Get Request local /v1/customer/1 10 | ${json}= Set Variable ${response.json()} 11 | 12 | Should Be Equal As Strings 200 ${response.status_code} 13 | Should Be Equal As Strings somkiat ${json["names"][0]} 14 | Should Be Equal As Strings pui ${json["names"][1]} 15 | Should Be Equal As Strings spns ${json["names"][2]} 16 | 17 | 18 | Get API 19 | Create Session httpbin http://httpbin.org 20 | ${response}= Get Request httpbin /get 21 | Log to console ${response} 22 | Log to console ${response.status_code} 23 | Log to console ${response.json()} 24 | ${json}= Set Variable ${response.json()} 25 | 26 | Should Be Equal As Strings 200 ${response.status_code} 27 | Should Be Equal As Strings 125.25.106.216 ${json["origin"]} 28 | 29 | Get API with parameter name=somkiat 30 | [Tags] test 31 | Create Session httpbin http://httpbin.org 32 | &{names}= Create List somkiat pui spns 33 | &{params}= Create Dictionary name=${names} 34 | ${response}= Get Request httpbin /get params=${params} 35 | ${json}= Set Variable ${response.json()} 36 | 37 | Should Be Equal As Strings 200 ${response.status_code} 38 | Should Be Equal As Strings somkiat ${json["args"]["name"]} 39 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink02/output.json: -------------------------------------------------------------------------------- 1 | { 2 | "names": [ 3 | "somkiat", 4 | "pui", 5 | "spns" 6 | ], 7 | "age": 30, 8 | "status": "single" 9 | } 10 | -------------------------------------------------------------------------------- /workshop/demo/workshop-brink02/sample_01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/workshop/demo/workshop-brink02/sample_01.jpg -------------------------------------------------------------------------------- /workshop/demo/workshop-brink02/sample_02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/workshop/demo/workshop-brink02/sample_02.jpg -------------------------------------------------------------------------------- /workshop/demo/workshop-brink02/upload_success.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Test Teardown Close Browser 4 | 5 | *** Testcases *** 6 | Upload single file with upload 7 | [Tags] done 8 | Go to upload file page 9 | Select a file sample_01.jpg 10 | Should have files in table 1 11 | Upload 12 | Should success 13 | 14 | Upload 2 files with upload all 15 | [Tags] test 16 | Go to upload file page 17 | Select a file sample_01.jpg 18 | Select a file sample_02.jpg 19 | Should have files in table 2 20 | Upload all 21 | Should success 22 | 23 | *** Keywords *** 24 | Should success 25 | Wait Until Page Contains Element xpath=//div[@style="width: 100%;"] 26 | 27 | Upload all 28 | Wait Until Element Is Enabled xpath=//*[@id="ng-app"]/body/div/div[2]/div[2]/div/button[1] 29 | Click Element xpath=//*[@id="ng-app"]/body/div/div[2]/div[2]/div/button[1] 30 | 31 | Upload 32 | Wait Until Element Is Enabled xpath=//*[@id="ng-app"]/body/div/div[2]/div[2]/table/tbody/tr/td[5]/button[1] 33 | Click Element xpath=//*[@id="ng-app"]/body/div/div[2]/div[2]/table/tbody/tr/td[5]/button[1] 34 | 35 | Should have files in table 36 | [Arguments] ${number of file} 37 | Xpath Should Match X Times //*[@id="ng-app"]/body/div/div[2]/div[2]/table/tbody/tr ${number of file} 38 | 39 | Select a file 40 | [Arguments] ${filename} 41 | Choose File xpath=//*[@id="ng-app"]/body/div/div[2]/div[1]/input[2] /Users/somkiat/data/slide/robot-framework/workshop-brink02/${filename} 42 | # Xpath Should Match X Times //*[@id="ng-app"]/body/div/div[2]/div[2]/table/tbody/tr ${number of file} 43 | # Wait Until Element Contains xpath=//table/tbody/tr/td[1] sample_01.jpg 44 | # Wait Until Element Contains xpath=//table/tbody/tr/td[2] 0.12 MB 45 | # Element Should Be Enabled xpath=//table/tbody/tr/td[5]/button[1] 46 | # Element Should Be Disabled xpath=//table/tbody/tr/td[5]/button[2] 47 | # Element Should Be Enabled xpath=//table/tbody/tr/td[5]/button[3] 48 | 49 | 50 | Go to upload file page 51 | Open Browser http://nervgh.github.io/pages/angular-file-upload/examples/simple/ browser=chrome 52 | Wait Until Element Is Enabled xpath=//*[@id="ng-app"]/body/div/div[2]/div[1]/input[2] 53 | -------------------------------------------------------------------------------- /workshop/ebola.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Documentation ค้นหาข้อมูลจากระบบ google.com 3 | Library Selenium2Library 4 | Test Teardown Close All Browsers 5 | 6 | *** Variables *** 7 | ${GOOGLE URL} http://www.google.com 8 | 9 | *** Testcases *** 10 | ค้นหาข้อมูลโรคติดต่อจาก google 11 | [Template] ค้นหาข้อมูล 12 | #-----------------------------------# 13 | # Keyword | Expected Result # 14 | #-----------------------------------# 15 | อีโบลา อีโบลา 16 | 17 | *** Keywords *** 18 | ค้นหาข้อมูล 19 | [Arguments] ${keyword} ${expected result} 20 | 21 | เปิดหน้าแรกของ google 22 | ใส่คำที่ต้องการค้นหา ${keyword} 23 | เจอคำที่ต้องการค้นหา ${expected result} 24 | 25 | 26 | เปิดหน้าแรกของ google 27 | Open Browser ${GOOGLE URL} 28 | 29 | ใส่คำที่ต้องการค้นหา 30 | [Arguments] ${keyword} 31 | Input Text id=gbqfq ${keyword} 32 | Click Button id=gbqfb 33 | 34 | เจอคำที่ต้องการค้นหา 35 | [Arguments] ${expected result} 36 | Wait Until Page Contains ${expected result} 37 | 38 | -------------------------------------------------------------------------------- /workshop/facebook.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | 5 | *** Testcases *** 6 | Post message in facebook 7 | [Tags] done 8 | Login to facebook with my account 9 | 10 | Click Element u_0_1t 11 | Input Text u_0_1t ดึกๆ ทำ Kata Robot framework ไป รอดูบอลไป 12 | Click Button Post 13 | 14 | Post comment in facebook 15 | [Tags] develop 16 | Login to facebook with my account 17 | Go To https://www.facebook.com/somkiatspns/posts/10152516553143588 18 | Wait Until Element Is Visible add_comment_text 19 | Input Text add_comment_text นี่คือการเขียน comment จาก robot framework นะ 20 | Wait Until Element Is Visible js_1 timeout=10 21 | Press Key js_1 \\13 22 | 23 | 24 | *** Keywords *** 25 | Login to facebook with my account 26 | Open Browser http://www.facebook.com 27 | Input Text email 28 | Input Text pass 29 | Click Element u_0_n -------------------------------------------------------------------------------- /workshop/gmail.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | 6 | 7 | *** Testcases *** 8 | Login and Logout 9 | Open Browser http://www.gmail.com 10 | Maximize Browser Window 11 | Input Text Email somkiat.p@gmail.com 12 | Input Text Passwd 13 | Click Button signIn 14 | Wait Until Page Contains Element xpath=//div[1]/a/span[@class='gb_W gbii'] 10 15 | Click Element xpath=//div[1]/a/span[@class='gb_W gbii'] 16 | Wait Until Element Is Visible xpath=//div[1]/a/span[@class='gb_W gbii'] 17 | Click Link gb_71 18 | Wait Until Page Contains Sign in to continue to Gmail 19 | 20 | 21 | Compose New Email 22 | Open Browser http://www.gmail.com 23 | Maximize Browser Window 24 | Input Text Email somkiat.p@gmail.com 25 | Input Text Passwd 26 | Click Button signIn 27 | Wait Until Page Contains Element xpath=//div[@class='z0']/div 10 28 | Click Element xpath=//div[@class='z0']/div 29 | 30 | Wait Until Page Contains Element xpath=//div[@class='wO nr l1']/textarea 31 | Input Text xpath=//div[@class='wO nr l1']/textarea somkiat.p@gmail.com 32 | Input Text xpath=//div[@class='aoD az6']/input ทดสอบ 33 | 34 | Wait Until Element Is Visible xpath=//div[@class='Am Al editable']/iframe 35 | Select Frame xpath=//div[@class='Am Al editable']/iframe 36 | Wait Until Element Is Visible xpath=//body 37 | Execute JavaScript document.body.innerHTML = "some html"; 38 | Unselect Frame 39 | 40 | Wait Until Page Contains Element xpath=//div[@class='J-J5-Ji']/div[@class='T-I J-J5-Ji aoO T-I-atl L3'] 41 | Click Element xpath=//div[@class='J-J5-Ji']/div[@class='T-I J-J5-Ji aoO T-I-atl L3'] -------------------------------------------------------------------------------- /workshop/google.txt: -------------------------------------------------------------------------------- 1 | *** Setting *** 2 | Library Selenium2Library 3 | 4 | *** Testcases *** 5 | Google 6 | Open Browser http://www.google.com 7 | Input Text xxxx iphone 6 8 | Click Button yyyy 9 | Wait Until Page Contains iphone 6 10 | Xpath Should Match X Times xpath=//[@id="newsbox"]/div[1]/a/em 11 | -------------------------------------------------------------------------------- /workshop/google_num_01.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | ${GOOGLE URL} http://www.google.com 6 | ${KEYWORD INPUT} lst-ib 7 | ${SEARCH BUTTON} btnG 8 | 9 | *** Testcases *** 10 | ทดสอบค้นหา Google 11 | ค้นหาและตรวจสอบผลการค้นหา สยามชำนาญกิจ สยามชำนาญกิจ 12 | ค้นหาและตรวจสอบผลการค้นหา สถาบันไอเอ็มซี สถาบันไอเอ็มซี 13 | 14 | *** Keywords *** 15 | ค้นหาและตรวจสอบผลการค้นหา 16 | [Arguments] ${KEYWORD} ${EXPECTED RESULT} 17 | Open Browser ${GOOGLE URL} 18 | Input Text ${KEYWORD INPUT} ${KEYWORD} 19 | Click Button ${SEARCH BUTTON} 20 | Wait Until Page Contains ${EXPECTED RESULT} 21 | Close Browser -------------------------------------------------------------------------------- /workshop/google_num_02.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | ${GOOGLE URL} http://www.google.com 6 | ${KEYWORD INPUT} lst-ib 7 | ${SEARCH BUTTON} btnG 8 | 9 | *** Testcases *** 10 | ทดสอบค้นหา Google 11 | [Template] ค้นหาและตรวจสอบผลการค้นหา 12 | #---------------------------------------------------------------------------------------------# 13 | # Keyword | Expected result # 14 | #---------------------------------------------------------------------------------------------# 15 | สยามชำนาญกิจ สยามชำนาญกิจ 16 | สถาบันไอเอ็มซี สถาบันไอเอ็มซี 17 | 18 | *** Keywords *** 19 | ค้นหาและตรวจสอบผลการค้นหา 20 | [Arguments] ${KEYWORD} ${EXPECTED RESULT} 21 | Open Browser ${GOOGLE URL} 22 | Input Text ${KEYWORD INPUT} ${KEYWORD} 23 | Click Button ${SEARCH BUTTON} 24 | Wait Until Page Contains ${EXPECTED RESULT} 25 | Close Browser -------------------------------------------------------------------------------- /workshop/grade.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | ${DEMO URL} http://demo-jenkins-web.herokuapp.com 6 | 7 | *** Testcases *** 8 | For A 9 | Open Browser ${DEMO URL} 10 | Maximize Browser Window 11 | Input Text score 80 12 | Click Element convert 13 | Wait Until Page Contains A 14 | Close Browser 15 | 16 | For B 17 | Open Browser ${DEMO URL} 18 | Maximize Browser Window 19 | Input Text score 75 20 | Click Element convert 21 | Wait Until Page Contains B 22 | Close Browser 23 | 24 | For C 25 | Open Browser ${DEMO URL} 26 | Maximize Browser Window 27 | Input Text score 68 28 | Click Element convert 29 | Wait Until Page Contains C 30 | Close Browser 31 | 32 | For D 33 | Open Browser ${DEMO URL} 34 | Maximize Browser Window 35 | Input Text score 52 36 | Click Element convert 37 | Wait Until Page Contains D 38 | Close Browser 39 | 40 | For F 41 | Open Browser ${DEMO URL} 42 | Maximize Browser Window 43 | Input Text score 13 44 | Click Element convert 45 | Wait Until Page Contains F 46 | Close Browser -------------------------------------------------------------------------------- /workshop/grade2.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | ${DEMO URL} http://demo-jenkins-web.herokuapp.com 6 | 7 | *** Testcases *** 8 | For A 9 | Go to grade page 10 | Enter score 80 11 | Expected grade result A 12 | 13 | For B 14 | Go to grade page 15 | Enter score 75 16 | Expected grade result B 17 | 18 | *** Keywords *** 19 | Go to grade page 20 | Open Browser ${DEMO URL} 21 | Maximize Browser Window 22 | 23 | Enter score 24 | [Arguments] ${score} 25 | Input Text score ${score} 26 | Click Element convert 27 | 28 | Expected grade result 29 | [Arguments] ${expected_grade} 30 | Wait Until Page Contains ${expected_grade} 31 | Close Browser 32 | 33 | 34 | -------------------------------------------------------------------------------- /workshop/grade3.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Resource resource_grade.txt 3 | 4 | *** Testcases *** 5 | Rule for Convert score to grade 6 | [Template] Flow for convert score to grade 7 | #---------------------# 8 | # Score | Grade # 9 | #---------------------# 10 | 80 A 11 | 70 B 12 | 60 C 13 | 50 D 14 | 15 | 16 | -------------------------------------------------------------------------------- /workshop/hello.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | 3 | *** Variables *** 4 | ${MESSAGE} Robot framework 5 | 6 | *** Testcases *** 7 | Hello robot framework 8 | Say hi robot 9 | 10 | *** Keywords *** 11 | Say hi robot 12 | Log to console ${MESSAGE} -------------------------------------------------------------------------------- /workshop/hello_world.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | 6 | *** Testcases *** 7 | ตรวจสอบ password ที่ปลอดภัย 8 | เปิด browser ไปยังหน้าสมัครสมาชิก 9 | กรอก password 10 | แสดงเครื่องหมายถูก สีเขียว 11 | 12 | *** Keywords *** 13 | เปิด browser ไปยังหน้าสมัครสมาชิก 14 | Open Browser http://www.facebook.com 15 | 16 | กรอก password 17 | Input Text u_0_a 1234 18 | Click Button ลงทะเบียน 19 | 20 | แสดงเครื่องหมายถูก สีเขียว 21 | Wait Until Page Contains คุณชื่ออะไร 22 | 23 | 24 | -------------------------------------------------------------------------------- /workshop/kaidee.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | #Test Teardown Close Browser 4 | 5 | 6 | *** Testcases *** 7 | Post my book on Kaidee 8 | Open Browser http://www.kaidee.com/posting/ 9 | Maximize Browser Window 10 | Input Text item_topic [Test] my book 11 | Choose File input_uploadfile selenium-screenshot-1.png 12 | Input Text item_price 500 13 | Select From List By Label province นครราชสีมา 14 | Select From List By Value province นครราชสีมา 15 | Select From List By Index province นครราชสีมา 16 | -------------------------------------------------------------------------------- /workshop/kaidee_post.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | #Test Teardown Close Browser 4 | 5 | *** Test cases *** 6 | Test 7 | Open Browser http://www.kaidee.com/posting/ gc 8 | Set Selenium Speed 1 seconds 9 | #Click Element province 10 | #Execute Javascript window.document.getElementById('province').scrollTop = window.document.getElementById('province').scrollHeight; 11 | Select From List By Value province 71 12 | #//*[@id="province"]/option[78] 13 | 14 | #Click Element xpath=//[@id="province"]/option[78] -------------------------------------------------------------------------------- /workshop/login_fail.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Resource resources/login_resource.txt 3 | Test Teardown Close Browser 4 | 5 | *** Testcases *** 6 | Not input username and password 7 | เข้าหน้า login 8 | ทำการ login ${EMPTY} ${EMPTY} 9 | ผู้ใช้งานต้องไปหน้า error 10 | 11 | Input only username 12 | เข้าหน้า login 13 | ทำการ login demo ${EMPTY} 14 | ผู้ใช้งานต้องไปหน้า error 15 | 16 | Login with wrong username 17 | เข้าหน้า login 18 | ทำการ login demo1 mode 19 | ผู้ใช้งานต้องไปหน้า error 20 | 21 | Login with wrong password 22 | เข้าหน้า login 23 | ทำการ login demo 123 24 | ผู้ใช้งานต้องไปหน้า error 25 | 26 | Input only password 27 | เข้าหน้า login 28 | ทำการ login ${EMPTY} mode 29 | ผู้ใช้งานต้องไปหน้า error 30 | 31 | Alter username and password 32 | เข้าหน้า login 33 | ทำการ login mode demo 34 | ผู้ใช้งานต้องไปหน้า error 35 | 36 | 37 | *** Keywords *** 38 | ผู้ใช้งานต้องไปหน้า error 39 | Title Should Be Error Page 40 | -------------------------------------------------------------------------------- /workshop/login_fail_fast.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Resource resources/login_resource.txt 3 | Suite Setup เข้าหน้า login 4 | Test Template Workflow of login failure 5 | Suite Teardown Close Browser 6 | 7 | *** Testcases *** username password 8 | Not input username and password ${EMPTY} ${EMPTY} 9 | Input only username demo ${EMPTY} 10 | Login wrong username demo1 mode 11 | Login wring password demo 123 12 | Input only password ${EMPTY} mode 13 | Alter username and password mode demo 14 | 15 | *** Keywords *** 16 | Workflow of login failure 17 | [Arguments] ${username} ${password} 18 | Go To ${BASE URL} 19 | ทำการ login ${username} ${password} 20 | ผู้ใช้งานต้องไปหน้า error 21 | 22 | ผู้ใช้งานต้องไปหน้า error 23 | Title Should Be Error Page 24 | -------------------------------------------------------------------------------- /workshop/login_fail_template.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Resource resources/login_resource.txt 3 | Suite Teardown Close All Browsers 4 | 5 | *** Testcases *** 6 | Rule of login failure 7 | [Template] Workflow of login failure 8 | #-----------------+------------------# 9 | # username | password # 10 | #-----------------+------------------# 11 | ${EMPTY} ${EMPTY} 12 | demo ${EMPTY} 13 | demo1 mode 14 | demo 123 15 | ${EMPTY} mode 16 | mode demo 17 | 18 | 19 | *** Keywords *** 20 | Workflow of login failure 21 | [Arguments] ${username} ${password} 22 | เข้าหน้า login 23 | ทำการ login ${username} ${password} 24 | ผู้ใช้งานต้องไปหน้า error 25 | 26 | ผู้ใช้งานต้องไปหน้า error 27 | Title Should Be Error Page 28 | -------------------------------------------------------------------------------- /workshop/login_failure.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Test Setup Open login page 4 | Test Teardown Close Browser 5 | Resource resources/login.txt 6 | 7 | *** Testcases *** 8 | Invalid Login 9 | [Template] Invalid login flow 10 | #---User name---|----Password ----| 11 | ${EMPTY} ${EMPTY} 12 | demo ${EMPTY} 13 | ${EMPTY} mode 14 | 15 | *** Keywords *** 16 | Invalid login flow 17 | [Arguments] ${user name} ${password} 18 | Input Text username_field ${user name} 19 | Input Text password_field ${password} 20 | Submit 21 | Error page is show 22 | Go to login page 23 | 24 | Error page is show 25 | Location Should Be ${LOGIN PAGE}/error.html 26 | Title Should Be Error Page 27 | Element Should Contain xpath=//div/h1 Error Page 28 | -------------------------------------------------------------------------------- /workshop/login_pass.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Resource resources/login_resource.txt 3 | Test Teardown Close Browser 4 | 5 | *** Testcases *** 6 | Login pass 1 :: Stable 7 | [Tags] group01 8 | เข้าหน้า login 9 | ทำการ login demo mode 10 | ผู้ใช้งานต้องไปหน้า welcome 11 | 12 | Login pass 2 :: Unstable 13 | [Tags] group02 14 | เข้าหน้า login 15 | ทำการ login demo mode1 16 | ผู้ใช้งานต้องไปหน้า welcome -------------------------------------------------------------------------------- /workshop/parkko_login.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Test Setup เข้าไปที่หน้า login 4 | Test Teardown Close All Browsers 5 | Resource xxx.txt 6 | 7 | *** Variables *** 8 | ${LOGIN PAGE} http://localhost:7272/html/ 9 | 10 | *** Testcases *** 11 | Login ผ่าน 12 | กรอกชื่อ demo 13 | กรอกรหัสผ่าน mode 14 | กดปุ่ม Login 15 | ต้องเจอหน้า Welcome Page 16 | -------------------------------------------------------------------------------- /workshop/resource_grade.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | ${DEMO URL} http://demo-jenkins-web.herokuapp.com 6 | 7 | *** Keywords *** 8 | Flow for convert score to grade 9 | [Arguments] ${score} ${expected_grade} 10 | Go to grade page 11 | Enter score ${score} 12 | Expected grade result ${expected_grade} 13 | 14 | Go to grade page 15 | Open Browser ${DEMO URL} 16 | Maximize Browser Window 17 | 18 | Enter score 19 | [Arguments] ${score} 20 | Input Text score ${score} 21 | Click Element convert 22 | 23 | Expected grade result 24 | [Arguments] ${expected_grade} 25 | Wait Until Page Contains ${expected_grade} 26 | Close Browser -------------------------------------------------------------------------------- /workshop/resources/login_resource.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | 4 | *** Variables *** 5 | ${BASE URL} http://localhost:7272/html/ 6 | 7 | 8 | *** Keywords *** 9 | เข้าหน้า login 10 | Open Browser ${BASE URL} 11 | 12 | ทำการ login 13 | [Arguments] ${user name} ${password} 14 | Input Text username_field ${user name} 15 | Input Text password_field ${password} 16 | Click Button LOGIN 17 | 18 | ผู้ใช้งานต้องไปหน้า welcome 19 | Title Should Be Welcome Page 20 | Page Should Contain Link xpath=//p/a 21 | ${link text}= Get Text xpath=//p/a 22 | Should be equal as strings ${link text} logout 23 | Location Should Be ${BASE URL}welcome.html 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /workshop/swpark-20180819/api.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library RequestsLibrary 3 | 4 | *** Testcases *** 5 | Post data to httpbin 6 | Create Session hb http://httpbin.org 7 | &{headers}= Create Dictionary 8 | ... Content-Type=application/json 9 | &{data}= Create Dictionary name1=somkiat 10 | ${response}= 11 | ... Post Request hb /post 12 | ... data=${data} headers=${headers} 13 | Should Be Equal ${response.status_code} ${200} 14 | Log to console ${response.json()} 15 | Should Be Equal 16 | ... ${response.json()["json"]["name1"]} somkiat 17 | 18 | Get data from httpbin 19 | Create Session hb http://httpbin.org 20 | &{param}= Create Dictionary 21 | ... name1=somkiat name2=pui 22 | ${response}= 23 | ... Get Request hb /get params=${param} 24 | Should Be Equal ${response.status_code} ${200} 25 | Log to console ${response.json()} 26 | Should Be Equal 27 | ... ${response.json()["args"]["name1"]} somkiat -------------------------------------------------------------------------------- /workshop/swpark-20180819/google/keyword.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library SeleniumLibrary 3 | 4 | *** Variables *** 5 | ${BROWSER} chrome 6 | 7 | *** Keywords *** 8 | ใส่ค่า 9 | [Arguments] ${keyword} 10 | Input Text name:q ${keyword} 11 | SeleniumLibrary.Capture Page Screenshot 12 | 13 | ต้องเจอ Wikipedia ของ Robot 14 | SeleniumLibrary.Capture Page Screenshot 15 | Wait Until Element Contains 16 | ... xpath://*[@id="rso"]/div[1]/div/div/div/h3 17 | ... Robot - Wikipedia 18 | Click Element 19 | ... xpath://*[@id="rso"]/div[1]/div/div/div/h3/a 20 | SeleniumLibrary.Capture Page Screenshot 21 | Location Should Be https://en.wikipedia.org/wiki/Robot 22 | SeleniumLibrary.Capture Page Screenshot 23 | 24 | กดค้นหา 25 | Press Key name:q \\13 26 | 27 | เปิด browser ไปที่ google thailand 28 | SeleniumLibrary.Open Browser https://www.google.co.th browser=${BROWSER} 29 | SeleniumLibrary.Capture Page Screenshot 30 | 31 | -------------------------------------------------------------------------------- /workshop/swpark-20180819/hello.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library SeleniumLibrary 3 | Test Teardown Close Browser 4 | 5 | *** Variables *** 6 | 7 | *** Testcases *** 8 | Search by robot 9 | [Tags] done 10 | เปิด browser ไปที่ google thailand 11 | ใส่ค่า robot 12 | กดค้นหา 13 | # ต้องเจอ Wikipedia ของ Robot 14 | 15 | Search by xyz 16 | [Tags] testing 17 | เปิด browser ไปที่ google thailand 18 | 19 | # ต้องเจอ Wikipedia ของ Robot 20 | 21 | *** Keywords *** 22 | ต้องเจอ Wikipedia ของ Robot 23 | SeleniumLibrary.Capture Page Screenshot 24 | Wait Until Element Contains 25 | ... xpath://*[@id="rso"]/div[1]/div/div/div/h3 26 | ... Robot - Wikipedia 27 | Click Element 28 | ... xpath://*[@id="rso"]/div[1]/div/div/div/h3/a 29 | SeleniumLibrary.Capture Page Screenshot 30 | Location Should Be https://en.wikipedia.org/wiki/Robot 31 | SeleniumLibrary.Capture Page Screenshot 32 | 33 | กดค้นหา 34 | Press Key name:q \\13 35 | 36 | ใส่ค่า robot 37 | Input Text name:q robot 38 | SeleniumLibrary.Capture Page Screenshot 39 | 40 | เปิด browser ไปที่ google thailand 41 | SeleniumLibrary.Open Browser https://www.google.co.th browser=gc 42 | SeleniumLibrary.Capture Page Screenshot 43 | 44 | -------------------------------------------------------------------------------- /workshop/swpark-20180819/hello2.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library SeleniumLibrary 3 | Test Teardown Close Browser 4 | 5 | *** Variables *** 6 | ${BROWSER} chrome 7 | 8 | *** Testcases *** 9 | Search by robot 10 | [Tags] done 11 | เปิด browser ไปที่ google thailand 12 | ใส่ค่า robot 13 | กดค้นหา 14 | 15 | Search by xyz 16 | [Tags] testing 17 | เปิด browser ไปที่ google thailand 18 | ใส่ค่า xyz 19 | กดค้นหา 20 | 21 | *** Keywords *** 22 | ใส่ค่า 23 | [Arguments] ${keyword} 24 | Input Text name:q ${keyword} 25 | SeleniumLibrary.Capture Page Screenshot 26 | 27 | 28 | ต้องเจอ Wikipedia ของ Robot 29 | SeleniumLibrary.Capture Page Screenshot 30 | Wait Until Element Contains 31 | ... xpath://*[@id="rso"]/div[1]/div/div/div/h3 32 | ... Robot - Wikipedia 33 | Click Element 34 | ... xpath://*[@id="rso"]/div[1]/div/div/div/h3/a 35 | SeleniumLibrary.Capture Page Screenshot 36 | Location Should Be https://en.wikipedia.org/wiki/Robot 37 | SeleniumLibrary.Capture Page Screenshot 38 | 39 | กดค้นหา 40 | Press Key name:q \\13 41 | 42 | เปิด browser ไปที่ google thailand 43 | SeleniumLibrary.Open Browser https://www.google.co.th browser=${BROWSER} 44 | SeleniumLibrary.Capture Page Screenshot 45 | 46 | -------------------------------------------------------------------------------- /workshop/swpark-20180819/hello3.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library SeleniumLibrary 3 | Test Setup เปิด browser ไปที่ google thailand 4 | Test Teardown Close Browser 5 | 6 | *** Variables *** 7 | ${BROWSER} chrome 8 | 9 | *** Testcases *** 10 | Search by robot 11 | [Template] Search template 12 | #----------------------------# 13 | # Input | Expected result # 14 | #----------------------------# 15 | robot robot 16 | xyz xyz 17 | robot robot 18 | 19 | *** Keywords *** 20 | Search template 21 | [Arguments] ${keyword} ${expected} 22 | ใส่ค่า ${keyword} 23 | กดค้นหา 24 | Go To https://www.google.co.th 25 | 26 | ใส่ค่า 27 | [Arguments] ${keyword} 28 | Input Text name:q ${keyword} 29 | SeleniumLibrary.Capture Page Screenshot 30 | 31 | 32 | ต้องเจอ Wikipedia ของ Robot 33 | SeleniumLibrary.Capture Page Screenshot 34 | Wait Until Element Contains 35 | ... xpath://*[@id="rso"]/div[1]/div/div/div/h3 36 | ... Robot - Wikipedia 37 | Click Element 38 | ... xpath://*[@id="rso"]/div[1]/div/div/div/h3/a 39 | SeleniumLibrary.Capture Page Screenshot 40 | Location Should Be https://en.wikipedia.org/wiki/Robot 41 | SeleniumLibrary.Capture Page Screenshot 42 | 43 | กดค้นหา 44 | Press Key name:q \\13 45 | 46 | เปิด browser ไปที่ google thailand 47 | SeleniumLibrary.Open Browser https://www.google.co.th browser=${BROWSER} 48 | SeleniumLibrary.Capture Page Screenshot 49 | 50 | -------------------------------------------------------------------------------- /workshop/swpark-20180819/hello4.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Resource google/keyword.robot 3 | Test Setup เปิด browser ไปที่ google thailand 4 | Test Teardown Close Browser 5 | Test Template Search template 6 | 7 | *** Testcases *** 8 | #-------------------------------------# 9 | # TC Name | Input | Expected result # 10 | #-------------------------------------# 11 | TC01 robot robot 12 | TC02 xyz xyz 13 | TC03 robot robot 14 | 15 | *** Keywords *** 16 | Search template 17 | [Arguments] ${keyword} ${expected} 18 | ใส่ค่า ${keyword} 19 | กดค้นหา 20 | Go To https://www.google.co.th -------------------------------------------------------------------------------- /workshop/swpark-20180819/images/file01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/workshop/swpark-20180819/images/file01.png -------------------------------------------------------------------------------- /workshop/swpark-20180819/images/file02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/workshop/swpark-20180819/images/file02.png -------------------------------------------------------------------------------- /workshop/swpark-20180819/images/file03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/up1/course-robotframework/375c1fac8845c6f882fd9dfcd27b5cfa3cd357e4/workshop/swpark-20180819/images/file03.png -------------------------------------------------------------------------------- /workshop/swpark-20180819/upload.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library SeleniumLibrary 3 | 4 | *** Variables *** 5 | 6 | *** Testcases *** 7 | Upload single file 8 | เปิด browser ไปที่หน้าหลัก 9 | เลือกไฟล์ file01.png 10 | Upload file 1 11 | ต้อง Upload สำเร็จนะ 12 | 13 | Upload two file 14 | [Tags] testing 15 | เปิด browser ไปที่หน้าหลัก 16 | เลือกไฟล์ file01.png 17 | เลือกไฟล์ file02.png 18 | Upload file 1 19 | Upload file 2 20 | ต้อง Upload สำเร็จนะ 21 | 22 | *** Keywords *** 23 | Upload file 24 | [Arguments] ${row number} 25 | Click Element 26 | ... xpath://table/tbody/tr[${row number}]/td[5]/button[1] 27 | 28 | เลือกไฟล์ 29 | [Arguments] ${file name} 30 | SeleniumLibrary.Choose File 31 | ... xpath://div[2]/div[1]/input[2] 32 | ... ${CURDIR}/images/${file name} 33 | Clear Element Text xpath://div[2]/div[1]/input[2] 34 | 35 | ต้อง Upload สำเร็จนะ 36 | Wait Until Page Contains Element 37 | ... xpath://div[@style="width: 100%;"] 38 | 39 | เปิด browser ไปที่หน้าหลัก 40 | Open Browser 41 | ... http://nervgh.github.io/pages/angular-file-upload/examples/simple/ 42 | ... browser=firefox 43 | -------------------------------------------------------------------------------- /workshop/swpark-20180819/upload2.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library SeleniumLibrary 3 | Suite Setup เปิด browser ไปที่หน้าหลัก 4 | Suite Teardown Close Browser 5 | Test Setup ไปหน้าหลัก 6 | 7 | *** Testcases *** 8 | Upload single file 9 | เลือกไฟล์ file01.png 10 | Upload file 1 11 | ต้อง Upload สำเร็จนะ 12 | 13 | Upload two file 14 | เลือกไฟล์ file01.png 15 | เลือกไฟล์ file02.png 16 | Upload file 1 17 | Upload file 2 18 | ต้อง Upload สำเร็จนะ 19 | 20 | *** Keywords *** 21 | ไปหน้าหลัก 22 | Go To http://nervgh.github.io/pages/angular-file-upload/examples/simple/ 23 | 24 | Upload file 25 | [Arguments] ${row number} 26 | Click Element 27 | ... xpath://table/tbody/tr[${row number}]/td[5]/button[1] 28 | 29 | เลือกไฟล์ 30 | [Arguments] ${file name} 31 | SeleniumLibrary.Choose File 32 | ... xpath://div[2]/div[1]/input[2] 33 | ... ${CURDIR}/images/${file name} 34 | Clear Element Text xpath://div[2]/div[1]/input[2] 35 | 36 | ต้อง Upload สำเร็จนะ 37 | Wait Until Page Contains Element 38 | ... xpath://div[@style="width: 100%;"] 39 | 40 | เปิด browser ไปที่หน้าหลัก 41 | Open Browser 42 | ... http://nervgh.github.io/pages/angular-file-upload/examples/simple/ 43 | ... browser=firefox 44 | -------------------------------------------------------------------------------- /workshop/swpark-20180819/xpath.txt: -------------------------------------------------------------------------------- 1 | //div[@id="rso"]/div[1]/div/div/div/h3 2 |
3 |
4 |
5 |
6 |
7 |

8 |
11 |
12 |
-------------------------------------------------------------------------------- /workshop/tarad.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Test Teardown Close All Browsers 4 | 5 | *** Testcases *** 6 | Buy product from TARAD.com 7 | เลือกสินค้า 8 | Buy with non-member 9 | Choose payment channel with Counter Service 10 | Fill in address and shipping information 11 | #Validate data in summary page 12 | 13 | 14 | 15 | 16 | 17 | *** Keywords *** 18 | เลือกสินค้า 19 | Open Browser http://www.tarad.com/product/6193631 20 | Maximize Browser Window 21 | #Select Radio Button option_id 169991 22 | #Select From List By Index product_qty 1 23 | Click Button f_buy 24 | 25 | Wait Until Page Contains Element xpath=//div[@class='getitem4']/span[@class='black-title'] 26 | #Element Text Should Be xpath=//div[@class='getitem4']/span[@class='black-title'] 2 ชิ้น 27 | 28 | Click Element xpath=//div[@class='getitem8']/a 29 | 30 | Buy with non-member 31 | #Title Should Be dressuphouse 32 | #Checkbox Should Be Selected check_guest_register 33 | #Unselect Checkbox check_guest_register 34 | Click Button สั่งซื้อทันที 35 | 36 | Choose payment channel with Counter Service 37 | Click Element xpath=//li[@id='counter-service']/a 38 | Set Selenium Speed 3 39 | Click Button next-btn 40 | Set Selenium Speed 0.5 41 | 42 | Fill in address and shipping information 43 | Input Text send_firstname สมเกียรติ 44 | Input Text send_lastname ปุ๋ยสูงเนิน 45 | Input Text send_address ที่อยู่จัดส่ง 46 | Select From List By Index send_province 2 47 | Set Selenium Speed 2 second 48 | Select From List By Index send_city 5 49 | Set Selenium Speed 0.5 second 50 | Input Text send_district xxxzxx 51 | Input Text send_email somkiat.p@gmail.com 52 | Input Text send_mobile 0868696209 53 | Set Selenium Speed 3 second 54 | Click Button next-btn 55 | Set Selenium Speed 0.5 second 56 | -------------------------------------------------------------------------------- /workshop/test1.csv: -------------------------------------------------------------------------------- 1 | mydata -------------------------------------------------------------------------------- /workshop/test2.csv: -------------------------------------------------------------------------------- 1 | mydata -------------------------------------------------------------------------------- /workshop/variable_01.txt: -------------------------------------------------------------------------------- 1 | *** Variables *** 2 | ${BASE_URL} url1 3 | ${BASE URL} url2 4 | ${BASEURL} url3 5 | 6 | *** Testcases *** 7 | Hello scalar variable 8 | Log to console ${BASE_URL} 9 | Log to console ${BASEURL} 10 | Log to console ${BASEURL} 11 | Log to console XXXX${SPACE * 5}XXXX -------------------------------------------------------------------------------- /workshop/variable_02.txt: -------------------------------------------------------------------------------- 1 | *** Testcases *** 2 | Hello variable with arguments 3 | Say hi robot framework 4 | 5 | *** Keywords *** 6 | Say hi 7 | [Arguments] ${first} ${second} 8 | Log to console ${first} 9 | Log to console ${second} -------------------------------------------------------------------------------- /workshop/variable_03.txt: -------------------------------------------------------------------------------- 1 | *** Variables *** 2 | @{MESSAGES} Robot Framework 3 | 4 | *** Testcases *** 5 | Hello list 6 | Log to console @{MESSAGES}[0] 7 | Log to console @{MESSAGES}[1] -------------------------------------------------------------------------------- /workshop/variable_04.txt: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Selenium2Library 3 | Test Teardown Close Browser 4 | 5 | *** Variables **** 6 | ${BROWSER} firefox 7 | 8 | *** Testcases *** 9 | My blog 10 | Open Browser http://www.somkiat.cc ${BROWSER} -------------------------------------------------------------------------------- /workshop/xxx.txt: -------------------------------------------------------------------------------- 1 | *** Keywords *** 2 | เข้าไปที่หน้า login 3 | Open Browser ${LOGIN PAGE} 4 | 5 | กรอกชื่อ demo 6 | Input Text username_field demo1 7 | 8 | กรอกรหัสผ่าน 9 | [Arguments] ${password} 10 | Input Text password_field ${password} 11 | 12 | กดปุ่ม Login 13 | Click Button LOGIN 14 | 15 | ต้องเจอหน้า Welcome Page 16 | Wait Until Page Contains Welcome Page --------------------------------------------------------------------------------