From 1b3c3aa84688c2652f3e56fbb05bc6b62eb25224 Mon Sep 17 00:00:00 2001 From: Alex Hadley Date: Thu, 4 Jan 2024 10:16:09 -0800 Subject: [PATCH 1/3] #221 Expand test_make_commit to test Param date change --- .../CommitDialog/ComparisonList.tsx | 7 ++- tests/e2e/test_commit_dialog.py | 47 ++++++++++--------- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/components/ParamSection/CommitDialog/ComparisonList.tsx b/src/components/ParamSection/CommitDialog/ComparisonList.tsx index ae98812..b881f0f 100644 --- a/src/components/ParamSection/CommitDialog/ComparisonList.tsx +++ b/src/components/ParamSection/CommitDialog/ComparisonList.tsx @@ -129,7 +129,12 @@ function DataDiffListItem({ name: nameOrUndefined, dataDiff }: DataDiffListItemP )} ) : ( - + None: expect(commit_message_input).to_have_value("") -# pylint: disable-next=too-many-locals def test_make_commit(page: Page) -> None: """Can edit data and make a commit.""" commit_select_combobox = page.get_by_test_id("commit-select-combobox") @@ -62,29 +61,24 @@ def test_make_commit(page: Page) -> None: commit_message = page.get_by_test_id("commit-message-text-field") commit_message_input = commit_message.get_by_role("textbox") - int_item = page.get_by_test_id("parameter-list-item-int") - int_item_input = int_item.get_by_test_id("leaf-input").get_by_role("textbox") - int_old_item = page.get_by_test_id("comparison-list-item-old-int") - int_new_item = page.get_by_test_id("comparison-list-item-new-int") - float_item = page.get_by_test_id("parameter-list-item-float") float_item_input = float_item.get_by_test_id("leaf-input").get_by_role("textbox") - float_old_item = page.get_by_test_id("comparison-list-item-old-float") - float_new_item = page.get_by_test_id("comparison-list-item-new-float") - str_item = page.get_by_test_id("parameter-list-item-str") - str_item_input = str_item.get_by_test_id("leaf-input").get_by_role("textbox") - str_old_item = page.get_by_test_id("comparison-list-item-old-str") - str_new_item = page.get_by_test_id("comparison-list-item-new-str") + param_item = page.get_by_test_id("parameter-list-item-param") + param_str_item = param_item.get_by_test_id("parameter-list-item-str") + param_str_item_input = param_str_item.get_by_test_id("leaf-input").get_by_role( + "textbox" + ) # Initial values - expect(int_item_input).to_have_value("123") expect(float_item_input).to_have_value("1.2345") - expect(str_item_input).to_have_value("test") + expect(param_item).to_contain_text(FIRST_COMMIT.date) + param_item.get_by_role("button").click() + expect(param_str_item_input).to_have_value("test") # Edit parameter values - int_item_input.fill("456") float_item_input.fill("5.6789") + param_str_item_input.fill("hello") # Opem commit dialog page.get_by_test_id("open-commit-dialog-button").click() @@ -93,12 +87,19 @@ def test_make_commit(page: Page) -> None: expect(page.get_by_test_id("commit-changes-message")).to_have_text( f"Changes from latest commit ({FIRST_COMMIT.message})" ) - expect(int_old_item).to_have_text("int123") - expect(int_new_item).to_have_text("int456") - expect(float_old_item).to_have_text("float1.2345") - expect(float_new_item).to_have_text("float5.6789") - expect(str_old_item).not_to_be_attached() - expect(str_new_item).not_to_be_attached() + expect(page.get_by_test_id("comparison-list-item-old-int")).not_to_be_attached() + expect(page.get_by_test_id("comparison-list-item-new-int")).not_to_be_attached() + expect(page.get_by_test_id("comparison-list-item-old-float")).to_have_text( + "float1.2345" + ) + expect(page.get_by_test_id("comparison-list-item-new-float")).to_have_text( + "float5.6789" + ) + expect(page.get_by_test_id("comparison-list-item-param")).not_to_contain_text( + FIRST_COMMIT.date + ) + expect(page.get_by_test_id("comparison-list-item-old-str")).to_have_text("strtest") + expect(page.get_by_test_id("comparison-list-item-new-str")).to_have_text("strhello") # Enter message and make commit commit_message_input.fill(NEW_COMMIT_MESSAGE) @@ -106,9 +107,9 @@ def test_make_commit(page: Page) -> None: expect(commit_select_combobox_input).to_have_value(NEW_COMMIT.message) # Values were updated - expect(int_item).to_have_text("int456") expect(float_item).to_have_text("float5.679") - expect(str_item).to_have_text("strtest") + expect(param_item).not_to_contain_text(FIRST_COMMIT.date) + expect(param_str_item).to_have_text("strhello") def test_commit_backend_format(page: Page) -> None: From fdb6ae5c7520b085f31fce818ad31220e00482fa Mon Sep 17 00:00:00 2001 From: Alex Hadley Date: Thu, 4 Jan 2024 10:29:29 -0800 Subject: [PATCH 2/3] #221 Add collapse and expand test for comparison list --- tests/e2e/test_commit_dialog.py | 59 ++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/tests/e2e/test_commit_dialog.py b/tests/e2e/test_commit_dialog.py index 6a2508d..64e3b54 100644 --- a/tests/e2e/test_commit_dialog.py +++ b/tests/e2e/test_commit_dialog.py @@ -55,15 +55,15 @@ def test_reopen_resets_commit_message(page: Page) -> None: def test_make_commit(page: Page) -> None: - """Can edit data and make a commit.""" + """ + Can edit data and make a commit, which also updates Param last updated timestamps. + """ commit_select_combobox = page.get_by_test_id("commit-select-combobox") commit_select_combobox_input = commit_select_combobox.get_by_role("combobox") commit_message = page.get_by_test_id("commit-message-text-field") commit_message_input = commit_message.get_by_role("textbox") - float_item = page.get_by_test_id("parameter-list-item-float") float_item_input = float_item.get_by_test_id("leaf-input").get_by_role("textbox") - param_item = page.get_by_test_id("parameter-list-item-param") param_str_item = param_item.get_by_test_id("parameter-list-item-str") param_str_item_input = param_str_item.get_by_test_id("leaf-input").get_by_role( @@ -80,7 +80,7 @@ def test_make_commit(page: Page) -> None: float_item_input.fill("5.6789") param_str_item_input.fill("hello") - # Opem commit dialog + # Open commit dialog page.get_by_test_id("open-commit-dialog-button").click() # Commit list reflects what was changed @@ -119,7 +119,6 @@ def test_commit_backend_format(page: Page) -> None: """ commit_message = page.get_by_test_id("commit-message-text-field") commit_message_input = commit_message.get_by_role("textbox") - datetime_item = page.get_by_test_id("parameter-list-item-datetime") datetime_item_input = datetime_item.get_by_test_id("leaf-input").locator( "input[type=datetime-local]" @@ -144,3 +143,53 @@ def test_commit_backend_format(page: Page) -> None: # Load classes in the backend (test fails if this fails) load_classes_from_db() + + +def test_comparison_list_collapse(page: Page) -> None: + """Can collapse and expand items within the commit comparison list.""" + float_item = page.get_by_test_id("parameter-list-item-float") + float_item_input = float_item.get_by_test_id("leaf-input").get_by_role("textbox") + list_item = page.get_by_test_id("parameter-list-item-list") + list_second_item = list_item.get_by_test_id("parameter-list-item-1") + list_second_item_input = list_second_item.get_by_test_id("leaf-input").get_by_role( + "textbox" + ) + comparison_root_item = page.get_by_test_id("comparison-list-item-root") + comparison_root_item_button = comparison_root_item.get_by_role("button").first + comparison_list_item = page.get_by_test_id("comparison-list-item-list") + comparison_list_item_button = comparison_list_item.get_by_role("button").first + comparison_float_item = page.get_by_test_id("comparison-list-item-new-float") + comparison_list_second_item = comparison_list_item.get_by_test_id( + "comparison-list-item-new-1" + ) + + # Edit parameter values and open commit dialog + float_item_input.fill("5.6789") + list_item.get_by_role("button").click() + list_second_item_input.fill("hello") + page.get_by_test_id("open-commit-dialog-button").click() + + # Comparison list group items are initially expanded + expect(comparison_float_item).to_be_attached() + expect(comparison_list_item).to_be_attached() + expect(comparison_list_second_item).to_be_attached() + + # Can collapse the root item + comparison_root_item_button.click() + expect(comparison_float_item).not_to_be_attached() + expect(comparison_list_item).not_to_be_attached() + expect(comparison_list_second_item).not_to_be_attached() + + # Can expand the root item + comparison_root_item_button.click() + expect(comparison_float_item).to_be_attached() + expect(comparison_list_item).to_be_attached() + expect(comparison_list_second_item).to_be_attached() + + # Can collapse the list item + comparison_list_item_button.click() + expect(comparison_list_second_item).not_to_be_attached() + + # Can expand the list item + comparison_list_item_button.click() + expect(comparison_list_second_item).to_be_attached() From 0567612e69ab5938226305c428127dafb3de9d70 Mon Sep 17 00:00:00 2001 From: Alex Hadley Date: Thu, 4 Jan 2024 10:33:44 -0800 Subject: [PATCH 3/3] #221 Test removing playwright --with-deps --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f787797..5995408 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,7 +111,7 @@ jobs: run: yarn - name: Install Playwright browsers - run: poetry run playwright install --with-deps chromium + run: poetry run playwright install chromium - name: Build frontend run: yarn build