Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LDSamson committed Jul 17, 2024
1 parent e69dfe6 commit 68aa485
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"input": {
"test-add_comment": false,
"test-add_comment": true,
"test-confirm_review_tabs": "show_checkbox",
"test-form_reviewed": true,
"test-review_comment": "",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"input": {
"test-add_comment": false,
"test-add_comment": true,
"test-confirm_review_tabs": "show_checkbox",
"test-form_reviewed": true,
"test-review_comment": "",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions tests/testthat/test-mod_review_forms.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ describe(
and [user_name] set to 'test_name',
and [subject_id] set to '885',
and [active_form] set to 'Adverse events',
and first (1) No input is given, then (2) the value [form_review] is set to 'TRUE',
and first (1) No input is given, then (2) the [form_reviewed] tick box
is ticked and the comment field enabled,
and then (3) the [save_review] button is clicked,
I expect that, after each action, the save review button and the option
to add a comment will be (1) disabled, (2) enabled, and (3) disabled,
Expand Down Expand Up @@ -150,24 +151,27 @@ describe(
)
withr::defer(app$stop())
app$wait_for_idle(2500)

# save button and comment option should not be available:
app$expect_values()
expect_true(app$get_js("document.getElementById('test-save_review').disabled;"))
expect_true(app$get_js("document.getElementById('test-add_comment').disabled;"))
expect_true(app$get_js("document.getElementById('test-review_comment').disabled;"))

app$click("test-form_reviewed")
app$click("test-add_comment")
# now the save button and comment option is available:
app$expect_values()
expect_false(app$get_js("document.getElementById('test-save_review').disabled;"))
expect_false(app$get_js("document.getElementById('test-add_comment').disabled;"))
expect_false(app$get_js("document.getElementById('test-review_comment').disabled;"))

app$click("test-save_review")
app$wait_for_idle()
# save button and comment option should not be available anymore:
app$expect_values()
expect_true(app$get_js("document.getElementById('test-save_review').disabled;"))
expect_true(app$get_js("document.getElementById('test-add_comment').disabled;"))
expect_true(app$get_js("document.getElementById('test-review_comment').disabled;"))

# review status and reviewer is saved as expected
saved_review_row <- db_slice_rows(temp_path) |>
Expand Down

0 comments on commit 68aa485

Please sign in to comment.