In order to run these automated test cases, simply copy and paste them into the TF
Automate (https://automate.testfirst.com/) and run them locally or remotely.
Browser
Scenario: Step 1 - Visit testfirst.com and check for "Forgot password?" link
Given browser "Chrome"
When I visit "https://www.testfirst.com/"
And I click "Sign In"
And I wait for 2 seconds
Then "Sign In" page is displayed
Scenario: Step 2 - User tries login with a wrong username and password
When I wait for 2 seconds
And I visit "https://www.testfirst.com/"
And I click "Sign In"
And I type "test_user" in "Username"
And I type "Password" in "Password"
And I click "SIGN IN"
Then "Invalid username/email or password" is displayed
Scenario: Step 3 - User hovers on RESOURCES and checks that "Product Guide" is visible
When I wait for 2 seconds
And I visit "https://www.testfirst.com/"
And I click "Resources"
And I wait for 1 second
Then "Quick Start Guide" is displayed
Multi-tab testing
Scenario: Open few tabs in the default browser instance, switch between tabs
Given browser "Chrome"
When I visit "https://www.testfirst.com"
And I click "!See What’s New"
And I switch to the new tab remembering it as "whats-new"
And I visit "https://www.testfirst.com/plans" in a new tab
And I remember the new tab as "plans"
And I switch to the default tab
And I switch to the tab remembered as "plans"
And I click "!Manual Testing"
And I switch to the default tab
And I close the tab remembered as "whats-new"
And I remember current tab as "first-default"
And I wait for 1 seconds
Multi-window testing
Scenario: Open few tabs in the default browser instance, switch between tabs
Given browser "Chrome"
When I visit "https://www.testfirst.com"
And I click "!See What’s New"
And I switch to the new tab remembering it as "whats-new"
And I visit "https://www.testfirst.com/plans" in a new tab
And I remember the new tab as "plans"
And I switch to the default tab
And I switch to the tab remembered as "plans"
And I click "!Manual Testing"
And I switch to the default tab
And I close the tab remembered as "whats-new"
And I remember current tab as "first-default"
And I wait for 1 seconds
Scenario: Launch the second browser instance and open one tab
Given browser "Chrome" as "second"
When I visit "https://testfirst.com"
And I click "!See What’s New"
And I remember the new tab as "whats-new"
And I remember current tab as "second-default"
And I scroll down by 200 pixels
And I wait for 1 seconds
Switching Between Browser Instances
Scenario: Open few tabs in the default browser instance, switch between tabs
Given browser "Chrome"
When I visit "https://www.testfirst.com"
And I click "!See What’s New"
And I switch to the new tab remembering it as "whats-new"
And I visit "https://www.testfirst.com/plans" in a new tab
And I remember the new tab as "plans"
And I switch to the default tab
And I switch to the tab remembered as "plans"
And I click "!Manual Testing"
And I switch to the default tab
And I close the tab remembered as "whats-new"
And I remember current tab as "first-default"
And I wait for 1 seconds
Scenario: Launch the second browser instance and open one tab
Given browser "Chrome" as "second"
When I visit "https://testfirst.com"
And I click "!See What’s New"
And I remember the new tab as "whats-new"
And I remember current tab as "second-default"
And I scroll down by 200 pixels
And I wait for 1 seconds
Scenario: Switch between browser instances
When I switch to the default browser instance
And I wait for 1 second
And I switch to "second" browser instance
And I wait for 1 second
Switching Between Tabs Across Browser Instances
Scenario: Open few tabs in the default browser instance, switch between tabs
Given browser "Chrome"
When I visit "https://www.testfirst.com"
And I click "!See What’s New"
And I switch to the new tab remembering it as "whats-new"
And I visit "https://www.testfirst.com/plans" in a new tab
And I remember the new tab as "plans"
And I switch to the default tab
And I switch to the tab remembered as "plans"
And I click "!Manual Testing"
And I switch to the default tab
And I close the tab remembered as "whats-new"
And I remember current tab as "first-default"
And I wait for 1 seconds
Scenario: Launch the second browser instance and open one tab
Given browser "Chrome" as "second"
When I visit "https://testfirst.com"
And I click "!See What’s New"
And I remember the new tab as "whats-new"
And I remember current tab as "second-default"
And I scroll down by 200 pixels
And I wait for 1 seconds
Scenario: Switch between tabs across browser instances
When I switch to the tab remembered as "first-default"
And I switch to the tab remembered as "whats-new"
And I wait for 1 second
Closing Browser Instances
Scenario: Open few tabs in the default browser instance, switch between tabs
Given browser "Chrome"
When I visit "https://www.testfirst.com"
And I click "!See What’s New"
And I switch to the new tab remembering it as "whats-new"
And I visit "https://www.testfirst.com/plans" in a new tab
And I remember the new tab as "plans"
And I switch to the default tab
And I switch to the tab remembered as "plans"
And I click "!Manual Testing"
And I switch to the default tab
And I close the tab remembered as "whats-new"
And I remember current tab as "first-default"
And I wait for 1 seconds
Scenario: Launch the second browser instance and open one tab
Given browser "Chrome" as "second"
When I visit "https://testfirst.com"
And I click "!See What’s New"
And I remember the new tab as "whats-new"
And I remember current tab as "second-default"
And I scroll down by 200 pixels
And I wait for 1 seconds
Scenario: Close browser instances
Given browser "Chrome" as "third"
When I visit "testfirst.com"
And I close current browser instance
And I switch to the default browser instance
And I close "second" browser instance
And I visit "testfirst.com"
And I close current browser instance
And I wait for 1 second
API/HTTP
Scenario: Step 1 - Send POST request with JSON body
Given POST HTTP request
When I set request body to JSON of
"""
{
"Number": 10,
"String": "Some text"
}
"""
And I add "Cookie" header "MyCookie1=123;"
And I send request to "https://bit.ly/SampleEndpointUrl"
Then request should complete successfully
And response status should be 200
Scenario: Step 2 - Verify response
When I save response body to "response" variable
And I extract value from "response" variable with jsonpath "$.success" to "isSuccess" variable
Then "{{isSuccess}}" should be equal to "true"
Console/Shell
For security reasons, the endpoint given in below is a dummy environment, therefore, if you try running the test as below, it would fail. Please replace host, port, username and password to an environment of your own choosing and try that way! |
Scenario: Step 1 - Establish shell session and create a file
Given shell session to
"""
{
"type": "ssh",
"host": "127.0.0.1",
"port": 22,
"basicAuth": {
"username": "john",
"password": "123456"
}
}
"""
When I run command "touch my.file"
Then command should complete successfully
Scenario: Step 2 - Run ls command and see that the file is indeed created
When I run command "ls"
Then command should complete successfully
And command output should contain "my.file"
And command output should not contain "other.file"
Comments
0 comments
Article is closed for comments.