Acceptance tests keywords

go to my profile page

Go to my profile page thru the user actions menu.

Click link  First Last
Click link  My profile
Location should be  ${APP_URL}/#me

my info be visible

Check if page contains user info.

Page should contain element  link=name@domain.com
Page should contain element  link=example
Page should contain  Mobile: +000 (00) 000-0000
Page should contain  Home: +000 (00) 000-0001
Page should contain  Fax: +000 (00) 000-0002
Page should contain  Office: +000 (00) 000-0003
Page should contain  Time zone: Europe/Kiev

an projects page

Go to projects page.

Given Test user login
 Then click link  Projects

click on ${text} in ${state} state

Click on link in state block.

${text}${state}
Click on ${text} in ${state} state and wait effect

an bb-classic app

Go to application page.

Test user login

an bb-classic app login page

Go to application login page.

Reload Page Until  Location should contain  login
Page should contain  BB
Title should be  BB

enter ${name} field

Enter “test” text in input field.

${name}
Input Text  name=${name}  test

heading should be ${heading}

Check if heading contain text.

${heading}
Page should contain element  xpath=//h1[contains(text(),${heading})]

Wait for data loading

Waiting for loading data from server.

Wait Until Keyword Succeeds  10 sec  0.1 sec  Element Should Not Be Visible  css=.alert

Click on ${text} in ${state} state and wait effect

Switch state filter, wait, click on link in state block and wait.

${text}${state}
Click link  ${state}
Wait Until Keyword Succeeds  5 sec  0.1 sec  Element Should Be Visible  xpath=//*[@id="projects_${state}"]//a[contains(text(),${text})]
Click element  xpath=//*[@id="projects_${state}"]//a[contains(text(),${text})]
Wait Until Keyword Succeeds  5 sec  0.1 sec  Element Should Be Visible  xpath=//*[@id="projects_${state}"]//*[@id="projects_${state}_${text[-2]}"]//a

Click on ${text} in projectnav

Click on link in project navigation.

${text}
Click element  xpath=//*[contains(@class,"projectnav")]//a[contains(text(),${text})]
Wait for data loading

Start app

Start application.

${PRO_TEST} =  Get Environment Variable  PRO_TEST  False
Run Keyword If  '${PRO_TEST}' != 'True'  Start Process  bin/dev_appserver app --skip_sdk_update_check  ELSE  Start Process  bin/dev_appserver app --skip_sdk_update_check --auth_domain=Production

Start Browser For Test

Start browser.

Start browser
Set Window Size  1024  768

Close All Browsers and Report Status

Close browser and report test status.

Close All Browsers
Report test status

Stop app

Stop application.

Run  pkill -f dev_appserver
${out} =  Read Process Output
Append to file  app.log  ${out}
Stop All Processes

Reload Page Until

Reload page 10 times until condition will be true.

: FOR  ${try}  IN RANGE  10
\    ${status}=  Run Keyword And Ignore Error  @{condition}
\    ${raise error}=  Set Variable If  ${status}[0]=='PASS'  'False'  'True'
\    Run Keyword If  ${status}[0]=='PASS'  Exit For Loop
\    Sleep  1  Waiting for loading server
\    Go to  ${APP_URL}
Run Keyword If  ${raise error}=="True"  Fail  "${condition}"

Test user login

Login by test user.

Reload Page Until  Location should contain  login
Input Text  name=subdomain  test
Input Text  name=username  test
Input Password  name=password  test
Click button  Log in
Sleep  2  Waiting for loading app
Wait Until Page Contains  First Last  15 sec

Test user logout

Logout.

Click link  First Last
Click link  Logout

Start browser

Prepare environment and start browser.

${BROWSER} =  Get Environment Variable  ROBOT_BROWSER  Firefox
${REMOTE_URL} =  Get Environment Variable  ROBOT_REMOTE_URL  ${REMOTE_URL}
${BUILD_MANUAL} =  Evaluate  random.randint(0,10**6)  random
${BUILD_NUMBER} =  Get Environment Variable  ROBOT_BUILD_NUMBER  manual-${BUILD_MANUAL}
${DESIRED_CAPABILITIES} =  Get Environment Variable  ROBOT_DESIRED_CAPABILITIES  platform:Linux
${BUILD_TAGS} =  Evaluate  " ".join(${TEST_TAGS})
${BUILD_INFO} =  Set variable  build:${BUILD_NUMBER},name:${TEST_NAME},tags:${BUILD_TAGS},public:public
Open browser  ${APP_URL}  ${BROWSER}  remote_url=${REMOTE_URL}  desired_capabilities=${DESIRED_CAPABILITIES},${BUILD_INFO}
Run keyword unless  '${REMOTE_URL}' == ''  Run keyword and ignore error  Set session id

Set session id

Get session id and set variable.

Keyword should exist  Get session id
${SESSION_ID} =  Get session id
Set test variable  ${SESSION_ID}  ${SESSION_ID}

Report test status

Report test status to saucelabs.

Run keyword unless  '${SESSION_ID}' == ''  Report sauce status  ${SESSION_ID}  ${TEST_STATUS}

an time report page

Given an bb-classic app
 When click on "Time" link in navbar
 Then wait for data loading

an project time page

Given an bb-classic app
 When click link  Name of #0
  And click on "Time" in projectnav
 Then wait for data loading

user add time entry

user can add time entry

Wait Until Page Contains Element  css=tr.addtime button.additem
Input Text  css=tr.addtime [name="description"]  added description
Click Button  css=tr.addtime button.additem

page should contain added entry

added item should be present

Wait Until Page Contains  added description

user edit time entry

user can edit time entry

Wait Until Page Contains Element  css=tr[data-id="0"] button.edit
Click Button  css=tr[data-id="0"] button.edit
Wait Until Page Contains Element  css=tr.edittime[data-id="0"] [name="description"]
Input Text  css=tr.edittime[data-id="0"] [name="description"]  edited description
Click Button  css=tr[data-id="0"] button.save

page should contain edited entry

edited item should be present

Wait Until Page Contains  edited description

user delete time entry

user can delete time entry

Wait Until Page Contains Element  css=tr[data-id="0"] button.remove
Click Button  css=tr[data-id="0"] button.remove

page should not contain deleted entry

deleted item should not be present

Page should not contain  edited description

user sort time entries

sort time entries by date

Click Element  xpath=//table/thead/tr/th[contains(text(), "date")]

page should contain sorted entries

time entries must be sorted

Page should contain  2012-12-24
Page should not contain  2001-01-01

an to-dos page

Given an bb-classic app
 When click on "To-Dos" link in navbar
 Then wait for data loading
  And heading should be "My to-dos"

an project todos page

Given an bb-classic app
 When click link  Name of #0
  And click on "To-Dos" in projectnav
 Then wait for data loading

user add todo list

user can add todo list

Click button  Add an item
Input Text  todoName  added todo list
Input Text  todoDescription  added descrition
Click Element  css=.additem

page should contain added todo list

added item should be present

Wait Until Page Contains  added todo list
Wait Until Page Contains  added descrition

user edit todo list

user can edit todo list

Click Element  css=.todolist.edititem[data-id="30"]
Input Text  todoName30  edited todo list
Input Text  todoDescription30  edited descrition
Click Element  css=.save

page should contain edited todo list

edited item should be present

Wait Until Page Contains  edited todo list
Wait Until Page Contains  edited descrition

user delete todo list

user can delete todo list

Click Element  css=.todolist.removeitem[data-id="30"]

page should not contain deleted todolist

deleted item should not be present

Page should not contain  edited todo list
Page should not contain  edited description

user add todo item

user can add todo item

Click button  Add an item
Input Text  todoContent  added todo item
Click Element  css=.additem

page should contain added todo item

added item should be present

Wait Until Page Contains  added todo item

user edit todo item

user can edit todo item

Click Element  css=.todo.edititem[data-id="30"]
Input Text  todoContent30  edited todo item
Click Element  css=.save

page should contain edited todo item

edited item should be present

Wait Until Page Contains  edited todo item

user delete todo item

user can delete todo item

Click Element  css=.todo.removeitem[data-id="30"]

page should not contain deleted todoitem

deleted item should not be present

Page should not contain  edited todo item

an project calendar page

Given an bb-classic app
 When click link  Name of #0
  And click on "Calendar" in projectnav
 Then wait for data loading

user edit calendar entry

user can edit calendar entry

Wait Until Page Contains Element  css=.edititem[data-id="0"]
Click Element  css=.edititem[data-id="0"]
Wait Until Page Contains Element  css=.editcalendar[data-id="0"] [name="title"]
Input Text  css=.editcalendar[data-id="0"] [name="title"]  edited title
Click Button  css=[data-id="0"] button.save

page should contain edited entry

edited item should be present

Wait Until Page Contains  edited title

user delete calendar entry

user can delete calendar entry

Wait Until Page Contains Element  css=.removeitem[data-id="0"]
Click Element  css=.removeitem[data-id="0"]

page should not contain deleted entry

deleted item should not be present

Page should not contain  edited title

Keywords for tests

keywords.compare_screenshot_to_base(baseline, diff=100)[source]

Calculate the exact difference between two images.

Parameters:
  • baseline (string) – [required] base screenshot to compare
  • diff (int) – value of maximum difference

Example:

Compare screenshot to base  base_screenshot.jpg
keywords.get_session_id()[source]

Get session id

Returns:session id
Return type:string

Example:

${SESSION_ID} =  Get Session Id
keywords.report_sauce_status(job_id, test_status)[source]

Report test status to Sauce service

Parameters:
  • job_id (string) – [required] saucelabs job id
  • test_status (string) – [required] status of test
Returns:

request status code

Return type:

int or string

Example:

Report sauce status  ${SESSION_ID}  ${TEST_STATUS}

Table Of Contents

Previous topic

Acceptance tests

Next topic

Acceptance tests settings

This Page