webdriver_test_tools.project.new_file module¶
Functions for creating a new test/page module.
-
webdriver_test_tools.project.new_file.
TEMPLATE_MAP
= {'page': 'page_object/', 'test': 'test_case.py'}¶ Maps file type to corresponding template file/directory relative to the template path
-
webdriver_test_tools.project.new_file.
PAGE_OBJECT_TEMPLATE_MAP
= {'': {'name': 'base_page', 'types': ['py']}, 'collapsible nav': {'name': 'collapsible_nav_object', 'types': ['py', 'yml']}, 'form': {'name': 'form_object', 'types': ['py', 'yml']}, 'modal': {'name': 'modal_object', 'types': ['py', 'yml']}, 'nav': {'name': 'nav_object', 'types': ['py', 'yml']}, 'web page': {'name': 'web_page_object', 'types': ['py', 'yml']}}¶ Maps prototype names to the base name of the corresponding template files and a list of file extensions for each file. Empty string maps to generic BasePage template
-
webdriver_test_tools.project.new_file.
PROTOTYPE_NAMES
= ['form', 'modal', 'nav', 'collapsible nav', 'web page']¶ List of valid prototype names
-
webdriver_test_tools.project.new_file.
YAML_PROTOTYPE_NAMES
= ['form', 'modal', 'nav', 'collapsible nav', 'web page']¶ List of prototype names that support YAML parsing
-
webdriver_test_tools.project.new_file.
DIRECTORY_MAP
= {'page': 'pages', 'test': 'tests'}¶ Maps file type to corresponding subdirectory in a test package
-
webdriver_test_tools.project.new_file.
new_file
(test_package_path, test_package, file_type, module_name, class_name, description=None, force=False, **kwargs)[source]¶ Create a new project file
This method assumes parameters have been validated.
main()
handles input validation before calling this function- Parameters
test_package_path – The root directory of the test package
test_package – The python package name of the test package
file_type – The type of file to create. Valid file types are stored as global variables with the _TYPE suffix
module_name – Python module name to use when creating the new file (without the .py extension, as this name is used when creating any additional non-Python files)
class_name – Name to use for the initial test class
description – (Optional) Description to use in the docstring of the initial class
force – (Default: False) If True, force overwrite if a file with the same name already exists
This method accepts additional keyword arguments for type-specific arguments.
Page kwargs:
prototype
: Key inPAGE_OBJECT_TEMPLATE_MAP
specifying the prototype template to use. Defaults to empty string (generic page object)
- Returns
List of paths for each new file created