Skip to content

Commit

Permalink
update tests to avoid getting reply widget
Browse files Browse the repository at this point in the history
  • Loading branch information
Allie Crevier committed Aug 18, 2020
1 parent 4a9c9c6 commit bf94fa2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,11 @@ To generate new cassettes, follow these instructions:
```
2. Start the dev server: `NUM_SOURCES=0 make dev`
3. Set up the dev server with data required for functional tests to pass and run in any order:
- Create 5 new sources, each with one submission that contains both a file and a message. The message should be set to `this is the message`. The file should be called `hello.txt` and contain a single line of text: `hello`.
- Create 3 new sources, each with one submission that contains both a file and a message. The message should be set to `this is the message`. The file should be called `hello.txt` and contain a single line of text: `hello`.
3. Delete all the old cassettes by running `rm -r tests/functional/cassettes` or just delete the cassettes you wish to regenerate.
4. Run `make test-functional` which will regenerate cassettes for any that are missing in the `tests/functional/cassettes` folder.

Note: After generating new cassettes, the test server will be in a state with only 3 sources. If for some reason you need to try again, make sure the server has the expected 5 sources, each with one submission that contains both the expected file and message before repeating the process of deleting cassettes and regenerating them.
Note: After generating new cassettes, the test server will be in a state with only one source, because there are two tests that delete one source each. If for some reason your need to try again, make sure the server has the expected 3 sources, each with one submission that contains both the expected file and message before repeating the process of deleting cassettes and regenerating them.

## Making a Release

Expand Down
4 changes: 2 additions & 2 deletions tests/functional/test_download_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ def conversation_with_file_is_rendered():
assert gui.main_view.view_layout.itemAt(0)
conversation = gui.main_view.view_layout.itemAt(0).widget()
assert conversation
file_id = list(conversation.conversation_view.current_messages.keys())[-1]
file_id = list(conversation.conversation_view.current_messages.keys())[1]
file_widget = conversation.conversation_view.current_messages[file_id]
assert isinstance(file_widget, FileWidget)

# Get the selected source conversation that contains a file attachment
qtbot.waitUntil(conversation_with_file_is_rendered, timeout=TIME_RENDER_CONV_VIEW)
conversation = gui.main_view.view_layout.itemAt(0).widget()
file_id = list(conversation.conversation_view.current_messages.keys())[-1]
file_id = list(conversation.conversation_view.current_messages.keys())[1]
file_widget = conversation.conversation_view.current_messages[file_id]

# Click on the download button for the file
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/test_export_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ def conversation_with_file_is_rendered():
assert gui.main_view.view_layout.itemAt(0)
conversation = gui.main_view.view_layout.itemAt(0).widget()
assert conversation
file_id = list(conversation.conversation_view.current_messages.keys())[-1]
file_id = list(conversation.conversation_view.current_messages.keys())[1]
file_widget = conversation.conversation_view.current_messages[file_id]
assert isinstance(file_widget, FileWidget)

# Get the selected source conversation that contains a file attachment
qtbot.waitUntil(conversation_with_file_is_rendered, timeout=TIME_RENDER_CONV_VIEW)
conversation = gui.main_view.view_layout.itemAt(0).widget()
file_id = list(conversation.conversation_view.current_messages.keys())[-1]
file_id = list(conversation.conversation_view.current_messages.keys())[1]
file_widget = conversation.conversation_view.current_messages[file_id]

# If the file is not downloaded, click on the download button
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/test_send_reply.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ def test_send_reply_to_source(functional_test_logged_in_context, qtbot, mocker):
def check_for_sources():
assert len(list(gui.main_view.source_list.source_items.keys()))

# Select the first source in the source list
# Select the last source in the source list
qtbot.waitUntil(check_for_sources, timeout=TIME_RENDER_SOURCE_LIST)
source_ids = list(gui.main_view.source_list.source_items.keys())
first_source_item = gui.main_view.source_list.source_items[source_ids[0]]
first_source_widget = gui.main_view.source_list.itemWidget(first_source_item)
qtbot.mouseClick(first_source_widget, Qt.LeftButton)
last_source_item = gui.main_view.source_list.source_items[source_ids[0]]
last_source_widget = gui.main_view.source_list.itemWidget(last_source_item)
qtbot.mouseClick(last_source_widget, Qt.LeftButton)
qtbot.wait(TIME_CLICK_ACTION)

def check_for_conversation():
Expand Down

0 comments on commit bf94fa2

Please sign in to comment.