Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Commit

Permalink
Merge pull request #127 from lucianopuccio/actions-refactor
Browse files Browse the repository at this point in the history
Actions refactor
  • Loading branch information
lucianopuccio authored Oct 1, 2018
2 parents d7b1768 + 2921984 commit e25e822
Show file tree
Hide file tree
Showing 82 changed files with 9,518 additions and 3,400 deletions.
62 changes: 62 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,68 @@

## [Unreleased]

## [0.6.0] - 2018-09-30

### Added

- New actions: go_back, set_search_timeout, get_search_timeout, double_click, focus_element, set_trace, error,
execute_javascript, fail, javascript_click, verify_selected_option_by_text, verify_selected_option_by_value,
get_alert_text, send_text_to_alert, submit_prompt_alert, verify_alert_text, verify_alert_text_is_not, wait_for_alert_present
verify_element_has_attribute, verify_element_has_not_attribute, verify_element_has_focus, verify_element_has_not_focus,
verify_page_not_contains_text, verify_element_text, verify_element_text_is_not, verify_element_text_not_contains, verify_title
verify_title_contains, verify_title_is_not, verify_title_not_contains, verify_url, verify_url_contains, verify_url_is_not
verify_url_not_contains, wait_for_element_present, wait_for_element_not_enabled, wait_for_page_contains_text,
wait_for_page_not_contains_text, wait_for_element_text, wait_for_element_text_is_not, wait_for_element_text_contains,
wait_for_element_text_not_contains, wait_for_element_has_attribute, wait_for_element_has_not_attribute, wait_for_title,
wait_for_title_is_not, wait_for_title_contains, wait_for_title_not_contains, verify_element_attribute_value,
verify_element_attribute_is_not, go_forward, check_element, uncheck_element, submit_form, switch_to_frame, switch_to_parent_frame
get_active_element, get_window_title, get_window_titles, get_window_handle, get_window_handles, get_window_index,
switch_to_window_by_index, switch_to_first_window, switch_to_last_window, switch_to_window_by_title, switch_to_window_by_partial_title
switch_to_window_by_url, switch_to_window_by_partial_url, verify_amount_of_windows, close_window
verify_window_present_by_title, verify_window_present_by_partial_title, maximize_window, get_page_source, switch_to_next_window
switch_to_previous_window, close_window_by_index, close_window_by_title, close_window_by_url, close_window_by_partial_title,
close_window_by_partial_url, get_element_attribute, get_element_value, get_element_text, wait_for_window_present_by_title,
wait_for_window_present_by_partial_title, get_window_size, get_data, send_secure_keys

- Added verify_* actions for soft assertions and assert_* for hard assertions

### Changed

- Renamed actions:
- capture -> take_screenshot
- clear -> clear_element
- close -> close_browser
- debug -> interactive_mode
- mouse_hover -> mouse_over
- select_by_index -> select_option_by_index
- select_by_text -> select_option_by_text
- select_by_value -> select_option_by_value
- verify_alert_is_present -> verify_alert_present
- verify_alert_is_not_present -> verify_alert_not_present
- verify_cookie_exists -> verify_cookie_present
- verify_is_enabled -> verify_element_enabled
- verify_is_not_enabled -> verify_element_not_enabled
- verify_is_selected -> verify_element_checked
- verify_is_not_selected -> verify_element_not_checked
- verify_is_visible -> verify_element_displayed
- verify_is_not_visible -> verify_element_not_displayed
- verify_exists -> verify_element_present
- verify_not_exists -> verify_element_not_present
- verify_text -> verify_page_contains_text
- verify_text_in_element -> verify_element_text_contains
- wait_for_element_not_exist -> wait_for_element_not_present
- wait_for_element_visible -> wait_for_element_displayed
- wait_for_element_not_visible -> wait_for_element_not_displayed

- Changed test results: 'pass' -> 'success'; 'fail' -> 'failure', 'error', 'code error'.
- report.json format changed. NOTE: previous reports (<0.6.0) won´t work in the UI report viewer
- Docs were rewritten

### Removed
- Deprecated actions: assert_contains, assert_equals, assert_false, assert_true, verify_selected_option

## [0.5.0] - 2018-05-12

### Added
- Support for Edge and Opera
- Extend WebDriver and WebElement
Expand Down
61 changes: 50 additions & 11 deletions docs/source/Interactive-mode.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
Interactive Mode
==================================================

With Golem the execution of a test can be paused at any point and start an interactive console that has all the Golem commands at disposal. This is extremely useful when writing and debugging tests.
With Golem the execution of a test can be paused at any point to start an interactive console with all the actions available.
This is useful for debugging tests.

## interactive_mode Action

#### Debug action

To start the interactive console at any point of a test just add the 'debug' action. Example:
To start the interactive console at any point of a test just add the **interactive_mode** action. Example:

**test.py**
```python

def test(data):
navigate('http://wikipedia.org/')
debug()
interactive_mode()
click(page.button)
capture('final screenshot')
take_screenshot('final screenshot')
```

When the test reaches the second step, the interactive console is going to start:
Expand All @@ -29,19 +28,59 @@ When the interactive console is terminated, the test will resume the execution f

<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>If the test is not run with the -i flag, the debug actions will be ignored</p>
<p>If the test is not run with the -i flag, the interactive_mode action will be ignored</p>
</div>


#### Quick Interactive Mode
## Quick Interactive Mode

It is posible to start a quick interactive mode by not providing a project and test to the run command:
It is possible to start a quick interactive shell by not providing a project and test to the run command:

```
golem run -i
```

This will start an interactive console with a clean slate.

```text
>golem run -i
Entering interactive mode
type exit() to stop
type help() for more info
>>> navigate('https://en.wikipedia.org')
12:47:54 INFO Navigate to: 'https://en.wikipedia.org'
>>> send_keys('#searchInput', 'automation')
12:48:58 INFO Write 'automation' in element #searchInput
>>> click('#searchButton')
12:49:18 INFO Click #searchButton
>>> get_browser().title
'Automation - Wikipedia'
>>> assert_title_contains('Automation')
12:49:50 INFO Assert page title contains 'Automation'
```

## Python Debugger

It is possible to add a Python debugger breakpoint (pdb.set_trace()) using the **set_trace** action.
As with the **interactive_mode**, the test must be run with the *-i* flag for this action to take effect.
More info about pdb [here](https://docs.python.org/3/library/pdb.html).

Example:

**test.py**
```python
def test(data):
navigate('https://en.wikipedia.org')
set_trace()
```

Next, go to [Golem Public API](golem-api.html)
```text
>golem run project test -i
12:57:11 INFO Test execution started: test
12:57:11 INFO Browser: chrome
12:57:11 INFO Navigate to: 'https://en.wikipedia.org'
--Return--
> c:\[...]\golem\actions.py(1578)set_trace()->None
-> pdb.set_trace()
(Pdb)
```
Binary file removed docs/source/_static/img/add-project.png
Binary file not shown.
Binary file removed docs/source/_static/img/add-test.png
Binary file not shown.
Binary file removed docs/source/_static/img/using-a-custom-function.png
Binary file not shown.
98 changes: 0 additions & 98 deletions docs/source/adding-tests.md

This file was deleted.

91 changes: 0 additions & 91 deletions docs/source/browser-web-drivers.md

This file was deleted.

Loading

0 comments on commit e25e822

Please sign in to comment.