Skip to content

Steps Module

Ahsan edited this page Mar 16, 2018 · 2 revisions

Steps Module


This modules covers the detailed implementation of the functions being used to carry out the test cases.

This modules provides an High level API to selenium way of interacting with the browser.
The functions are general enough to accomodate an array of usage e.g ( click_on),
or sometimes designed for a specifc need, to cater a single purpose ( e.g. gallery_next )

The purpose and usage of functions are defined.


Modules


utils.config
unicodecsv
os
platform
time
selenium.webdriver


Functions


add_broadcast_component(component_name)

add broadcast component of a particular type


Parameters:


component_name (string): the content type to add (e.g text, image, card, etc.)


add_menu()

Adds a menu item (from persistent menu page)

autopost_settings()

Clicks on the edit settings of the first autoposting channel

broadcast_upload(type, component_number =None)

Uploads a file to particular broadcast component (in broadcast creation)


Keyword Arguments:


component_number (string): the component number (from top to bottom starting from 1)


choose_select(select_label, select_item =None)

Clicks on the select element with a certain label and selects a certain option from the select dropdown


Parameters:


select_label (string): the label associated with the select element


Keyword Arguments:


select_item (string): the option inside the select dropdown (default will select first item)


clear_field()

Clears the content from the currently focused input field

click_on(name, scope =<selenium.webdriver.chrome.webdriver.WebDriver (session="a136fb743ccf4a4897a8798df9f65044")>)

Clicks on the element with specified text.
Preference is in the following order: anchor links, buttons, input placeholders, and then remaining element from the top of the page


Parameters:


name (string) : the text of what to click on


Keyword Arguments:


scope (WebElement): which element to search inside (default driver which is the entire page)


click_on_broadcast_component(text, component_number =None)

Clicks on the text of a particular broadcast component


Parameters:


text: the text of which to click on


Keyword Arguments:


component_number (string): the component number (from top to bottom starting from 1)


click_on_broadcast_title()

Clicks on the edit broadcast title icon

close_browser()

Closes the currently running browser

close_help_popup()

Closes messenger help popup

close_menu(x)

Closes the xth menu (from top to down including submenus and nested menus) (from persistent menu page)

Parameters:


x (string) : number of the menu from top to bottom (starting from 1)


delete_broadcast_templates()

Deletes all broadcast templates from templates page

delete_poll_templates()

Deletes all poll templates from templates page

delete_survey_templates()

Deletes all survey templates from templates page

download_opdashboard_csv()

Downloads csv of users (in Operational Dashboard)

download_phone_csv()

Downloads csv of phone numbers (in Invite using Phone Numebers)

gallery_next()

Goes to the next page of the gallery component

gallery_prev()

Goes to the previous page of the gallery component

gallery_upload(page_number =None)

Uploads a file to a particular page in a gallery component (in broadcast creation)


Keyword Arguments:


page_number (string) : the page number which to upload a file


login(account_type ='buyer')

Logs in a user of a particular account type (from initial login screen of KiboPush)

Keyword Arguments:

account_type (string) : could be 'agent', 'admin', 'buyer' or 'individual' (default 'buyer')

logout()

Logs out the currently logged in user

num_of_broadcast_components()

Returns the number of broadcast components currently being used

open_facebook(account_type ='buyer')

Opens Facebook account for a given account type

Keyword Arguments:


account_type (string): could be 'agent', 'admin', 'buyer' or 'individual' (default 'buyer')


open_kibopush()

Opens staging.kibopush.com

open_new_window()

Opens a new chrome window

press_enter()

Presses enter on the currently focused element

press_tab(times_to_press ='1')

Presses tab the specified number of times

Keyword Arguments:


times_to_press (string): number of times to press tab (default '1')


remove_autoposting()

Removes the first autoposting channel

remove_broadcast_component(component_number =None)

Removes a particular broadcast component

Keyword Arguments:


component_number (string): the component number (from top to bottom starting from 1)


screenshot(filename)

Screenshots the webpage

Parameters:


filename (string) : name which to save the screenshot file.


select_emoji()

Selects an emoji and puts it in the input box (Live Chat)

send_GIF()

Sends a GIF (Live Chat)

send_broadcast_templates()

Sends all broadcast templates

send_sticker()

Sends the first sticker in the sticker menu

send_thumbs_up()

Sends a thumbs up in Live Chat

sidebar_click(sidebar_item)

Clicks on an element with a certain text in the sidebar


Parameters:


sidebar_item (string) : the text of the element to click on


sidebar_hamburger()

Clicks on the collapse/expand icon at the top of the sidebar

upload(type, wait_time =10, scope =<selenium.webdriver.chrome.webdriver.WebDriver (session="a136fb743ccf4a4897a8798df9f65044")>)

Uploads a file to the first file input component on the page


Parameters:


type (string) : can be 'image', 'audio', 'video', 'file'


Keyword Arguments:


wait_time (int): number of seconds to wait after hitting upload (default 10 seconds)
scope (WebElement): which element to search inside (default driver which is the entire page)


verify_GIF_sent(gif_ID)

Verifies whether the GIF was sent


Parameters:


gid_ID: the id of the GIF


verify_alert()

Checks if a successful alert is being shown

verify_broadcast_templates_table()

Verifies whether there are entries in broadcast templates (in templates page)

verify_failure()

Checks if a failure alert is being shown

verify_poll_templates_table()

Verifies whether there are entries in poll templates (in templates page)

verify_sticker_sent(sticker_ID)

Verifies whether the sticker was sent


Parameters:


gid_ID: the id of the sticker


verify_survey_templates_table()

Verifies whether there are entries in survey templates (in templates page)

verify_table(scope =<selenium.webdriver.chrome.webdriver.WebDriver (session="a136fb743ccf4a4897a8798df9f65044")>)

Verifies if the table element has entries


Keyword Arguments:


scope (WebElement): which element to search inside (default driver which is the entire page)


wait(wait_time =1)

Suspends execution for the given number of seconds

Keyword Arguments:

wait_time -- number of seconds to wait (default 1.0)

write(text)

writes text on the currently selected element


Parameters:


text (string): the text to write



Data


WAIT_TIME = 1
chrome_options = <selenium.webdriver.chrome.options.Options object>
driver = <selenium.webdriver.chrome.webdriver.WebDriver (session="a136fb743ccf4a4897a8798df9f65044")>
prefs = {'profile.default_content_setting_values.notifications': 2}

Clone this wiki locally