-
Notifications
You must be signed in to change notification settings - Fork 27
Contributing to Guitester
Guitester framework follows the Page Object Model (POM). Under this model, for each web page in the application there should be a corresponding page class.
- For each resource type its page classes should be placed in a directory named "resource_type" in /tests/selenium/guiops/pages.
Example: instancedetail.py contains the class for the instance detail page and instance_lp.py contains the class for the instance landing page. These files are located in tests/selenium/guiops/pages/instance directory.
- Each modal dialog should have its own class in tests/selenium/guiops/dialogs/resource_type_dialogs.py for each resource_type.
Example: CreateSnapshotModal, DeleteSnapshotModal, RegisterSnapshotAsImageModal are classes in tests/selenium/guiops/dialogs/snapshot_dialogs.py
- Each page object must contain only operations that can be performed on that page.
Example: snapshot_detail.py contains methods like verify_snapshot_detail_page_loaded, click_action_delete_snapshot_on_detail_page, click_action_register_as_image_on_detail_page, click_action_create_volume_from_snapshot_on_detail_page, verify_snapshot_status_is_completed, get_snapshot_name_and_id etc.
- All variables for locators should be given a descriptive name that starts with underscore and contais the locator type in the end.
Example: _instance_action_menu_id, _first_pending_instance_status_css, _launch_more_like_this_actionmenu_item_css, _delete_keypair_action_menuitem_id
- The name of each method should be very descriptive so that anyone can identify easily from the method name what action is performed.
Example: click_create_volume_btn_on_landing_page, get_id_of_newly_created_volume, click_action_launch_instance_on_landing_page, click_terminate_instance_action_item_from_detail_page etc.
- Operations on each page are performed using selenium api methods located in tests/selenium/guiops/selenium_api/selenium_api.py that are in the core of Guitester framework.
Example:
def click_action_attach_volume(self):
self.tester.click_element_by_css(self._volumes_tab_css)
self.tester.click_element_by_css(self._attach_volume_tile_css)
- Each service type has its own class in tests/selenium/guiops/guitester. They are as follows guiasg.py, guicf.py, guiec2.py, guielb.py, guiiam.py, guis3.py. These classes have the methods for resource operations that a user can perform via eucaconsole and typically involve a workflow that involves several pages. It is very important to keep all the methods added to the above service classes in the format that follows the workflow of the operation as the pages change. Please refer to in guiec2.py for various examples.
Example:
def delete_keypair_from_detail_page(self, keypair_name):
BasePage(self).goto_keypair_view_page_via_menu()
KeypairLanding(self).click_keypair_link_on_view_page(keypair_name)
KeypairDetailPage(self, keypair_name).click_action_delete_keypair_on_detail_page()
DeleteKeypairModal(self).click_delete_keypair_submit_button()
BasePage(self).goto_keypair_view_page_via_menu()
KeypairLanding(self).verify_keypair_not_present_on_view_page(keypair_name)
All test sequences are located in tests/selenium/guiops/tests
Start by copying tests/selenium/guiops/tests/template.py. Change the name of the class Resource_operations_sequence to a descriptive name that would best describe your sequence. Add your tests, make sure that all created resources are then removed by the sequence. It is very important to give unique names to resources that will get names in the test use id_generator from the template when naming your resources.
Assuming you're in the tests/selenium/guiops/tests folder, run a test by passing the required options (console URL, account, username, and password)
python volumes.py -c https://localhost -a testaccount -u admin -p password
If the CLI complains with a "ImportError: No module named guiops.guiops" error, the guitester package must be added to PYTHONPATH.
export PYTHONPATH=$PYTHONPATH:guitester
General rules of code review for eucaconsole are applied. In addition the reviewer must verify that the guidelines from "How to build a new method for a given service type" were followed and the high order methods for service types look as described in 6.
After confirming that the code review has passed the reviewer/tester must verify that the test sequences and high order methods (the ones submitted in guiasg.py, guicf.py, guiec2.py, guielb.py, guiiam.py, guis3.py) work correctly when executed on Firefox with local selenium webdriver.