-
Notifications
You must be signed in to change notification settings - Fork 32
✅ Add e2e tests for metamodeling #8457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alexpargon
wants to merge
17
commits into
ITISFoundation:master
Choose a base branch
from
alexpargon:add-e2e-tests-for-metamodeling
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+144
−40
Open
Changes from 16 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
6ff45b1
feat: added test for MMux
alexpargon 0bfbadb
feat: added extension for TODOs and FIXMEs
alexpargon 7d56afb
Merge branch 'master' into add-e2e-tests-for-metamodeling
alexpargon 10844f5
fix: added MOGA support for output parameters configuration
alexpargon a162033
Merge branch 'add-e2e-tests-for-metamodeling' of https://github.com/a…
alexpargon 0aa6c95
fix: added for loop to test all 3 mmux services and return to the das…
alexpargon 3b02b74
Merge branch 'master' into add-e2e-tests-for-metamodeling
alexpargon f03ba78
Merge branch 'master' into add-e2e-tests-for-metamodeling
alexpargon 51cbfff
Merge branch 'master' into add-e2e-tests-for-metamodeling
alexpargon 65713e7
Merge branch 'master' into add-e2e-tests-for-metamodeling
alexpargon b82c55b
Merge branch 'master' into add-e2e-tests-for-metamodeling
alexpargon 6e605c5
Merge branch 'master' into add-e2e-tests-for-metamodeling
alexpargon b4cc6f0
Merge branch 'master' into add-e2e-tests-for-metamodeling
alexpargon d6d33e2
Merge branch 'master' into add-e2e-tests-for-metamodeling
alexpargon a35336d
fix: polished e2e implementation for metamodeling
alexpargon ce06cb4
fix: removed prints for log
alexpargon 749d00b
Merge branch 'master' into add-e2e-tests-for-metamodeling
alexpargon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -220,50 +220,153 @@ def test_response_surface_modeling( | |
| create_function_from_project(page, our_project["uuid"]) | ||
|
|
||
| # 3. start a RSM with that function | ||
| service_keys = [ | ||
| "mmux-vite-app-moga-write", | ||
| "mmux-vite-app-sumo-write", | ||
| "mmux-vite-app-uq-write", | ||
| ] | ||
|
|
||
| with log_context( | ||
| logging.INFO, | ||
| f"Waiting for {service_key} to be responsive (waiting for {_DEFAULT_RESPONSE_TO_WAIT_FOR})", | ||
| ): | ||
| project_data = create_project_from_service_dashboard( | ||
| ServiceType.DYNAMIC, service_key, None, service_version | ||
| ) | ||
| assert "workbench" in project_data, "Expected workbench to be in project data!" | ||
| assert isinstance( | ||
| project_data["workbench"], dict | ||
| ), "Expected workbench to be a dict!" | ||
| node_ids: list[str] = list(project_data["workbench"]) | ||
| assert len(node_ids) == 1, "Expected 1 node in the workbench!" | ||
| for service_key in service_keys: | ||
| with log_context( | ||
| logging.INFO, | ||
| f"Waiting for {service_key} to be responsive (waiting for {_DEFAULT_RESPONSE_TO_WAIT_FOR})", | ||
| ): | ||
| project_data = create_project_from_service_dashboard( | ||
| ServiceType.DYNAMIC, service_key, None, service_version | ||
| ) | ||
| assert ( | ||
| "workbench" in project_data | ||
| ), "Expected workbench to be in project data!" | ||
| assert isinstance( | ||
| project_data["workbench"], dict | ||
| ), "Expected workbench to be a dict!" | ||
| node_ids: list[str] = list(project_data["workbench"]) | ||
| assert len(node_ids) == 1, "Expected 1 node in the workbench!" | ||
|
|
||
| wait_for_service_running( | ||
| page=page, | ||
| node_id=node_ids[0], | ||
| websocket=log_in_and_out, | ||
| timeout=_WAITING_FOR_SERVICE_TO_START, | ||
| press_start_button=False, | ||
| product_url=product_url, | ||
| is_service_legacy=is_service_legacy, | ||
| ) | ||
|
|
||
| wait_for_service_running( | ||
| page=page, | ||
| node_id=node_ids[0], | ||
| websocket=log_in_and_out, | ||
| timeout=_WAITING_FOR_SERVICE_TO_START, | ||
| press_start_button=False, | ||
| product_url=product_url, | ||
| is_service_legacy=is_service_legacy, | ||
| ) | ||
| service_iframe = page.frame_locator("iframe") | ||
| with log_context(logging.INFO, "Waiting for the RSM to be ready..."): | ||
| service_iframe.get_by_role("grid").wait_for( | ||
| state="visible", timeout=_WAITING_FOR_SERVICE_TO_APPEAR | ||
| ) | ||
|
|
||
| service_iframe = page.frame_locator("iframe") | ||
| with log_context(logging.INFO, "Waiting for the RSM to be ready..."): | ||
| service_iframe.get_by_role("grid").wait_for( | ||
| state="visible", timeout=_WAITING_FOR_SERVICE_TO_APPEAR | ||
| ) | ||
| # select the function | ||
| with log_context(logging.INFO, "Selected test function..."): | ||
| service_iframe.get_by_role("button", name="SELECT").nth(0).click() | ||
|
|
||
| page.wait_for_timeout(10000) | ||
| with log_context(logging.INFO, "Filling the input parameters..."): | ||
| min_test_id = "Mean" if "uq" in service_key.lower() else "Min" | ||
| min_inputs = service_iframe.locator( | ||
| f'[mmux-testid="input-block-{min_test_id}"] input[type="number"]' | ||
| ) | ||
| count_min = min_inputs.count() | ||
|
|
||
| # # select the function | ||
| # service_iframe.get_by_role("gridcell", name=_FUNCTION_NAME).click() | ||
| for i in range(count_min): | ||
| input_field = min_inputs.nth(i) | ||
| input_field.fill(str(i + 1)) | ||
| logging.info(f"Filled {min_test_id} input {i} with value {i + 1}") | ||
| assert input_field.input_value() == str(i + 1) | ||
|
|
||
| # # Find the first input field (textbox) in the iframe | ||
| # min_input_field = service_iframe.get_by_role("textbox").nth(0) | ||
| # min_input_field.fill("1") | ||
| # max_input_field = service_iframe.get_by_role("textbox").nth(1) | ||
| # max_input_field.fill("10") | ||
| max_test_id = "Standard Deviation" if "uq" in service_key.lower() else "Max" | ||
| max_inputs = service_iframe.locator( | ||
| f'[mmux-testid="input-block-{max_test_id}"] input[type="number"]' | ||
| ) | ||
| count_max = max_inputs.count() | ||
|
|
||
| for i in range(count_max): | ||
| input_field = max_inputs.nth(i) | ||
| input_field.fill(str((i + 1) * 10)) | ||
| logging.info( | ||
| f"Filled {max_test_id} input {i} with value {(i + 1) * 10}" | ||
| ) | ||
| assert input_field.input_value() == str((i + 1) * 10) | ||
|
|
||
| page.wait_for_timeout(1000) | ||
| page.keyboard.press("Tab") | ||
| page.wait_for_timeout(1000) | ||
|
|
||
| if "moga" in service_key.lower(): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MINOR: highlight these keywords by adding them as CONSTANTS e.g. EXPECTED_SERVICE_KEY |
||
| with log_context(logging.INFO, "Filling the output parameters..."): | ||
| output_plus_button = service_iframe.locator( | ||
| '[mmux-testid="add-output-var-btn"]' | ||
| ) | ||
|
|
||
| output_plus_button.click() | ||
|
|
||
| output_confirm_button = service_iframe.locator( | ||
| '[mmux-testid="confirm-add-output-btn"]' | ||
| ) | ||
| output_confirm_button.click() | ||
|
|
||
| # Click the next button | ||
| with log_context(logging.INFO, "Clicking Next to go to the next step..."): | ||
| service_iframe.locator('[mmux-testid="next-button"]').click() | ||
|
|
||
| with log_context(logging.INFO, "Starting the sampling..."): | ||
| service_iframe.locator('[mmux-testid="extend-sampling-btn"]').click() | ||
| service_iframe.locator('[mmux-testid="new-sampling-campaign-btn"]').click() | ||
| samplingInput = service_iframe.locator( | ||
| '[mmux-testid="lhs-number-of-sampling-points-input"] input[type="number"]' | ||
| ) | ||
| samplingInput.fill("40") | ||
| samplingInput.press("Enter") | ||
| service_iframe.locator('[mmux-testid="run-sampling-btn"]').click() | ||
|
|
||
| # # click on next | ||
| # service_iframe.get_by_role("button", name="Next").click() | ||
| with log_context(logging.INFO, "Waiting for the sampling to launch..."): | ||
| toast = service_iframe.locator("div.Toastify__toast").filter( | ||
| has_text="Sampling started running successfully, please wait for completion." | ||
| ) | ||
| toast.wait_for(state="visible", timeout=120000) # waits up to 120 seconds | ||
|
|
||
| with log_context(logging.INFO, "Waiting for the sampling to complete..."): | ||
|
|
||
| def all_completed(): | ||
| status_cells = service_iframe.locator( | ||
| 'div[role="gridcell"][data-field="status"]' | ||
| ) | ||
| total = status_cells.count() | ||
| if total == 0: | ||
| return False | ||
| for i in range(total): | ||
| text = (status_cells.nth(i).text_content() or "").lower().strip() | ||
| logging.info(f"STATUS CELL TEXT {i}: {text}") | ||
| if text != "complete": | ||
| return False | ||
| return True | ||
|
|
||
| while not all_completed(): | ||
| logging.info("⏳ Waiting for all status cells to be completed...") | ||
| page.wait_for_timeout(3000) | ||
| service_iframe.locator( | ||
| '[mmux-testid="refresh-job-collections-btn"]' | ||
| ).click() | ||
|
|
||
| service_iframe.locator( | ||
| '[mmux-testid="select-all-successful-jobs-btn"] ' | ||
| ).click() | ||
|
|
||
| plotly_graph = service_iframe.locator(".js-plotly-plot") | ||
| plotly_graph.wait_for(state="visible", timeout=300000) | ||
alexpargon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| page.wait_for_timeout(2000) | ||
|
|
||
| # # then we wait a long time | ||
| # page.wait_for_timeout(1 * MINUTE) | ||
| with ( | ||
| log_context(logging.INFO, "Go back to dashboard"), | ||
| page.expect_response( | ||
| re.compile(r"/projects\?.+") | ||
| ) as list_projects_response, | ||
| ): | ||
| page.get_by_test_id("dashboardBtn").click() | ||
| page.get_by_test_id("confirmDashboardBtn").click() | ||
| assert ( | ||
| list_projects_response.value.ok | ||
| ), f"Failed to list projects: {list_projects_response.value.status}" | ||
| page.wait_for_timeout(2000) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.