cumulusci.robotframework.pageobjects package

Submodules

The following page objects are automatically included when importing the PageObject library. You should not directly import this file.

class cumulusci.robotframework.pageobjects.BasePageObjects.DetailPage(object_name=None)[source]

Bases: cumulusci.robotframework.pageobjects.baseobjects.BasePage

A page object representing the standard Detail page.

When going to this page via the standard Go to page keyword, you can specify either an object id, or a set of keyword arguments which will be used to look up the object id. When using keyword arguments, they need to represent a unique user.

Example

${contact_id} = Salesforce Insert Contact
… FirstName=${first_name}
… LastName=${last_name}

# Using the id:
Go to page Detail Contact ${contact_id}

# Using lookup parameters
Go to page Detail Contact FirstName=${first_name} LastName=${last_name}
class cumulusci.robotframework.pageobjects.BasePageObjects.EditModal(object_name=None)[source]

Bases: cumulusci.robotframework.pageobjects.BasePageObjects.ModalMixin, cumulusci.robotframework.pageobjects.baseobjects.BasePage

A page object representing the Edit Object modal

Note: You should not use this page object with ‘Go to page’. Instead, you can use ‘Wait for modal to appear’ after performing an action that causes the new object modal to appear (eg: clicking the “Edit” button). Once the modal appears, the keywords for that modal will be available for use in the test.

Example:

Click object button Edit
Wait for modal to appear Edit Contact
class cumulusci.robotframework.pageobjects.BasePageObjects.HomePage(object_name=None)[source]

Bases: cumulusci.robotframework.pageobjects.baseobjects.BasePage

A page object representing the home page of an object.

When going to the Home page, you need to specify the object name.

Note: The home page of an object may automatically redirect you to some other page, such as a Listing page. If you are working with such a page, you might need to use page should be to load the keywords for the page you expect to be redirected to.

Example

Go to page Home Contact
class cumulusci.robotframework.pageobjects.BasePageObjects.ListingPage(object_name=None)[source]

Bases: cumulusci.robotframework.pageobjects.baseobjects.BasePage

Page object representing a Listing page

When going to the Listing page, you need to specify the object name. You may also specify the name of a filter.

Example

Go to page Listing Contact filterName=Recent
class cumulusci.robotframework.pageobjects.BasePageObjects.ModalMixin[source]

Bases: object

click_modal_button(button_label)[source]

Click the named modal button (Save, Save & New, Cancel, etc)

close_the_modal()[source]

Closes the open modal

modal_should_contain_errors(*messages)[source]

Verify that the modal contains the following errors

This will look for the given message in the standard SLDS component (<ul class=’errorsList’>)

populate_field(name, value)[source]

Populate a field on the modal form

Name must the the label of a field as it appears on the modal form.

Example

Populate field First Name Connor
Populate field Last Name MacLeod
populate_form(*args, **kwargs)[source]

Populate the modal form

Arguments are of the form key=value, where ‘key’ represents a field name as it appears on the form (specifically, the text of a label with the class ‘uiLabel’).

Example:

Populate form
… First Name=Connor
… Last Name=MacLeod
wait_until_modal_is_closed(timeout=None)[source]

Waits until the modal is no longer visible

If the modal isn’t open, this will not throw an error.

class cumulusci.robotframework.pageobjects.BasePageObjects.NewModal(object_name=None)[source]

Bases: cumulusci.robotframework.pageobjects.BasePageObjects.ModalMixin, cumulusci.robotframework.pageobjects.baseobjects.BasePage

A page object representing the New Object modal

Note: You should not use this page object with ‘Go to page’. Instead, you can use ‘Wait for modal to appear’ after performing an action that causes the new object modal to appear (eg: clicking the “New” button). Once the modal appears, the keywords for that modal will be available for use in the test.

Example:

Go to page Home Contact
Click object button New
Wait for modal to appear New Contact
class cumulusci.robotframework.pageobjects.PageObjects.PageObjects(*args)[source]

Bases: object

Keyword library for importing and using page objects

When importing, you can include one or more paths to python files that define page objects. For example, if you have a set of classes in robot/HEDA/resources/PageObjects.py, you can import this library into a test case like this:

Library cumulusci.robotframework.PageObjects
… robot/HEDA/resources/PageObjects.py

Page object classes need to use the @pageobject decorator from cumulusci.robotframework.pageobjects. The decorator takes two parameters: page_type and object_name. Both are arbitrary strings, but together should uniquely identify a collection of keywords for a page or objects on a page.

Examples of page_type are Listing, Home, Detail, etc. Object types can be actual object types (Contact), custom object (Custom_object__c) or a logical name for a type of page (eg: AppointmentManager).

Example:

from cumulusci.robotframework.pageobjects import BasePage
from cumulusci.robotframework.pageobjects import pageobject
@pageobject(page_type=”Detail”, object_name=”Custom__c”)
class CustomDetailPage(BasePage):
ROBOT_LIBRARY_SCOPE = 'TEST SUITE'
current_page_should_be(page_type, object_name, **kwargs)[source]

Verifies that the page appears to be the requested page

If the page matches the given page object or contains the given page object, the keyword will pass.a

When this keyword is called, it will try to get the page object for the given page_tyope and object_name, and call the method _is_current_page.

Custom page objects may define this function in whatever manner is necessary to determine that the current page is or contains the given page object. The only requirement is that this function raise an exception if it determines the current page either doesn’t represent the page object or doesn’t contain the page object.

The default implementation of the function uses the page URL and compares it to a pattern based off of the page_type and object_name.

get_keyword_names()[source]

This method is required by robot’s dynamic library api

get_page_object(page_type, object_name)[source]

Return an instance of a page object

This is useful if you want to call a single page object method from some other keyword without having to go to another page or load the page object into a page.

This works a lot like robot’s built-in “get library instance” keyword, but you can specify the page object by page type and object name rather than the library name, and it will autoload the appropriate library (assuming its module has been imported).

go_to_page(page_type, object_name, *args, **kwargs)[source]

Go to the page of the given page object.

The URL will be computed from the page_type and object_name associated with the object, plus possibly additional arguments.

Different pages support different additional arguments. For example, a Listing page supports the keyword argument filter_name, and a Detail page can be given an object id, or parameters for looking up the object id.

If this keyword is able to navigate to a page, the keyword load page object will automatically be called to load the keywords for the page.

Custom page objects may define the function _go_to_page, which will be passed in all of the keyword arguments from this keyword. This allows each page object to define its own URL mapping using whatever algorithm it chooses. The only requirement of the function is that it should compute an appropriate url and then call self.selenium.go_to with the URL.

It is also recommended that the keyword wait until it knows that the page has finished rendering before returning (eg: by calling self.salesforce.wait_until_loading_is_complete())

load_page_object(page_type, object_name=None)[source]

Load the keywords for the page object identified by the type and object name

The page type / object name pair must have been registered using the cumulusci.robotframework.pageobject decorator.

log_page_object_keywords()[source]

Logs page objects and their keywords for all page objects which have been imported into the current suite.

registry = {('Detail', ''): <class 'cumulusci.robotframework.pageobjects.BasePageObjects.DetailPage'>, ('Edit', ''): <class 'cumulusci.robotframework.pageobjects.BasePageObjects.EditModal'>, ('Home', ''): <class 'cumulusci.robotframework.pageobjects.BasePageObjects.HomePage'>, ('Listing', ''): <class 'cumulusci.robotframework.pageobjects.BasePageObjects.ListingPage'>, ('New', ''): <class 'cumulusci.robotframework.pageobjects.BasePageObjects.NewModal'>, ('Test', 'Bar__c'): <class 'cumulusci.core.tests.BarTestPage.BarTestPage'>, ('Test', 'Foo__c'): <class 'cumulusci.core.tests.FooTestPage.FooTestPage'>}
selenium
wait_for_modal(page_type, object_name, expected_heading=None, **kwargs)[source]

Wait for the given page object modal to appear.

This will both wait for the modal, and verify that the modal has an expected heading. By default the expected heading will be the page object type (eg “New”) and object name (eg: “Contact”) separated by a space (eg: “New Contact”).

You can override the expected heading with the expected_heading parameter.

Example:

Wait for modal to appear New Contact
wait_for_page_object(page_type, object_name, **kwargs)[source]

Wait for an element represented by a page object to appear on the page.

The associated page object will be loaded after the element appears.

page_type represents the page type (Home, Details, etc)) and object_name represents the name of an object (Contact, Organization, etc)

cumulusci.robotframework.pageobjects.PageObjects.get_keyword_names(obj)[source]

Returns a list of method names for the given object

This excludes methods that begin with an underscore, and also excludes the special method get_keyword_names.

cumulusci.robotframework.pageobjects.PageObjects.pageobject(page_type, object_name=None)[source]

A decorator to designate a class as a page object

class cumulusci.robotframework.pageobjects.baseobjects.BasePage(object_name=None)[source]

Bases: object

builtin

Returns an instance of robot framework’s BuiltIn library

cumulusci

Returns the instance of the imported CumulusCI library

log_current_page_object()[source]

Logs the name of the current page object

The current page object is also returned as an object

object_name
salesforce

Returns the instance of the imported Salesforce library

selenium

Returns the instance of the imported SeleniumLibrary library

Module contents