diff --git a/tests/testflows/regression.py b/tests/testflows/regression.py index 9815bf41b..007436c8b 100755 --- a/tests/testflows/regression.py +++ b/tests/testflows/regression.py @@ -45,6 +45,9 @@ def argparser(parser): ], "/Grafana Datasource Plugin For Clickhouse/data source setup/check default values datetime64/": [ (Error, "https://github.com/Altinity/clickhouse-grafana/issues/630") + ], + "/Grafana Datasource Plugin For Clickhouse/sql editor/extrapolation toggle/":[ + (Fail, "Run Query button do not update time ranges") ] } @@ -109,7 +112,7 @@ def regression(self, before, after): Feature(run=load("testflows.tests.automated.sql_editor", "feature")) Feature(run=load("testflows.tests.automated.data_source_setup", "feature")) Feature(run=load("testflows.tests.automated.e2e", "feature")) - Feature(run=load("testflows.tests.automated.query_settings", "feature")) + Feature(run=load("testflows.tests.automated.query_options", "feature")) Feature(run=load("testflows.tests.automated.unified_alerts", "feature")) self.context.grafana_version = "10.4.3" diff --git a/tests/testflows/steps/actions.py b/tests/testflows/steps/actions.py index eaf9c42b3..bd62a1a70 100644 --- a/tests/testflows/steps/actions.py +++ b/tests/testflows/steps/actions.py @@ -28,7 +28,7 @@ def compare_screenshots(self, screenshot_name_1, screenshot_name_2): @TestStep(Given) -def create_dashboard(self, dashboard_name, open_it=True): +def create_dashboard(self, dashboard_name, open_it=True, finally_save_dashboard=True): """Create new dashboard named {dashboard_name} and open it.""" try: for attempt in retries(delay=10, timeout=120): @@ -51,6 +51,11 @@ def create_dashboard(self, dashboard_name, open_it=True): dashboards.open_dashboard(dashboard_name=dashboard_name) yield finally: + if finally_save_dashboard: + with Finally("I save changes for dashboard"): + with delay(after=0.5): + panel.save_dashboard() + with Finally(f"I delete dashboard {dashboard_name}"): dashboards.delete_dashboard(dashboard_name=dashboard_name) diff --git a/tests/testflows/steps/dashboard/locators.py b/tests/testflows/steps/dashboard/locators.py index b70059e74..f31a018e7 100644 --- a/tests/testflows/steps/dashboard/locators.py +++ b/tests/testflows/steps/dashboard/locators.py @@ -7,35 +7,45 @@ class Locators: # Locators for dashboard page def panel(self, panel_name): - driver: WebDriver = current().context.driver return driver.find_element(SelectBy.CSS_SELECTOR, f"[data-testid='data-testid Panel header {panel_name}']") def menu_button_for_panel(self, panel_name): - driver: WebDriver = current().context.driver return driver.find_element(SelectBy.CSS_SELECTOR, f"[data-testid='data-testid Panel menu {panel_name}']") def edit_button_for_panel(self): - driver: WebDriver = current().context.driver return driver.find_element(SelectBy.CSS_SELECTOR, f"[data-testid='data-testid Panel menu item Edit']") - @property - def save_dashboard(self): + + + def save_dashboard(self, grafana_version): driver: WebDriver = current().context.driver - return driver.find_element(SelectBy.CSS_SELECTOR, f"[aria-label='Save dashboard']") + if not (grafana_version is None) and (int(grafana_version.split(".")[0]) <= 10): + return driver.find_element(SelectBy.CSS_SELECTOR, f"[aria-label='Save dashboard']") + else: + return driver.find_element(SelectBy.CSS_SELECTOR, f"[data-testid='data-testid Save dashboard button']") - @property - def save_dashboard_title(self): + def save_dashboard_title(self, grafana_version): + driver: WebDriver = current().context.driver + if not (grafana_version is None) and (int(grafana_version.split(".")[0]) <= 10): + return driver.find_element(SelectBy.CSS_SELECTOR, f"[class ='css-8tk2dk-input-input']") + else: + return driver.find_element(SelectBy.CSS_SELECTOR, f"[data-testid='Save dashboard title field']") + def save_dashboard_button(self, grafana_version): driver: WebDriver = current().context.driver - return driver.find_element(SelectBy.CSS_SELECTOR, f"[class ='css-8tk2dk-input-input']") + if not (grafana_version is None) and (int(grafana_version.split(".")[0]) <= 10): + return driver.find_element(SelectBy.CSS_SELECTOR, f"[class ='css-td06pi-button']") + else: + return driver.find_element(SelectBy.CSS_SELECTOR, + f"[data-testid='data-testid Save dashboard drawer button']") @property - def save_dashboard_button(self): + def edit_button(self): driver: WebDriver = current().context.driver - return driver.find_element(SelectBy.CSS_SELECTOR, f"[class ='css-td06pi-button']") + return driver.find_element(SelectBy.CSS_SELECTOR, f"[data-testid='data-testid Edit dashboard button']") @property def add_button(self): diff --git a/tests/testflows/steps/dashboard/view.py b/tests/testflows/steps/dashboard/view.py index c55193073..5cb6ba24d 100644 --- a/tests/testflows/steps/dashboard/view.py +++ b/tests/testflows/steps/dashboard/view.py @@ -42,7 +42,7 @@ def wait_edit_button_in_panel_menu(self): @TestStep(When) -def click_edit_button(self): +def click_edit_button_for_panel(self): """Click edit button in dropdown menu for panel.""" locators.edit_button_for_panel().click() @@ -82,7 +82,7 @@ def edit_panel(self, panel_name): wait_edit_button_in_panel_menu() with By("clicking edit button"): - click_edit_button() + click_edit_button_for_panel() @TestStep(When) @@ -102,21 +102,28 @@ def take_panel_screenshot(self, panel_name, screenshot_name): @TestStep(When) def click_save_button(self): """Open saving menu for dashboard.""" - locators.save_dashboard.click() + locators.save_dashboard(grafana_version=self.context.grafana_version).click() @TestStep(When) def change_title_for_dashboard(self, dashboard_name): """Change title for dashboard in saving menu.""" - locators.save_dashboard_title.clear() + locators.save_dashboard_title(grafana_version=self.context.grafana_version).clear() - locators.save_dashboard_title.send_keys(dashboard_name) + locators.save_dashboard_title(grafana_version=self.context.grafana_version).send_keys(dashboard_name) @TestStep(When) def click_save_dashboard_button(self): """Save dashboard.""" - locators.save_dashboard_button.click() + locators.save_dashboard_button(grafana_version=self.context.grafana_version).click() + + +@TestStep(When) +def click_edit_button(self): + """Click edit button.""" + + locators.edit_button.click() @TestStep(When) @@ -132,7 +139,7 @@ def saving_dashboard(self, dashboard_name=None): change_title_for_dashboard(dashboard_name=dashboard_name) with By("clicking save button"): - with delay(): + with delay(before=0.5): click_save_dashboard_button() @@ -262,6 +269,11 @@ def open_new_dashboard_endpoint(self, endpoint=None): def add_visualization(self): """Add visualization for dashboard.""" + if (self.context.grafana_version is None) or (int(self.context.grafana_version.split(".")[0]) > 10): + with delay(): + with By("clicking edit button"): + click_edit_button() + with delay(): with By("clicking add button"): click_add_button() diff --git a/tests/testflows/steps/dashboards/view.py b/tests/testflows/steps/dashboards/view.py index aa4e9f62e..90cac6da3 100644 --- a/tests/testflows/steps/dashboards/view.py +++ b/tests/testflows/steps/dashboards/view.py @@ -94,7 +94,8 @@ def create_new_dashboard(self): def delete_dashboard(self, dashboard_name): """Delete dashboard.""" with By("opening dashboards view"): - open_dashboards_view() + with delay(): + open_dashboards_view() with By("selecting dashboard"): with delay(): @@ -109,7 +110,8 @@ def delete_dashboard(self, dashboard_name): enter_delete_conformation() with By("clicking delete button in confirmation window"): - click_delete_confirmation_button() + with delay(): + click_delete_confirmation_button() @TestStep(When) diff --git a/tests/testflows/steps/panel/locators.py b/tests/testflows/steps/panel/locators.py index 0a7042c16..89a0901fe 100644 --- a/tests/testflows/steps/panel/locators.py +++ b/tests/testflows/steps/panel/locators.py @@ -234,20 +234,26 @@ def apply_button(self): driver: WebDriver = current().context.driver return driver.find_element(SelectBy.CSS_SELECTOR, f'[data-testid="data-testid Apply changes and go back to dashboard"]') - @property - def save_button(self): + def save_button(self, grafana_version): driver: WebDriver = current().context.driver - return driver.find_element(SelectBy.CSS_SELECTOR, f'[title="Apply changes and save dashboard"]') + if not (grafana_version is None) and (int(grafana_version.split(".")[0]) <= 10): + return driver.find_element(SelectBy.CSS_SELECTOR, f'[title="Apply changes and save dashboard"]') + else: + return driver.find_element(SelectBy.CSS_SELECTOR, f'[data-testid="data-testid Save dashboard button"]') - @property - def save_confirmations_button(self): + def save_confirmations_button(self, grafana_version): driver: WebDriver = current().context.driver - return driver.find_element(SelectBy.CSS_SELECTOR, f'[aria-label="Dashboard settings Save Dashboard Modal Save button"]') + if not (grafana_version is None) and (int(grafana_version.split(".")[0]) <= 10): + return driver.find_element(SelectBy.CSS_SELECTOR, f'[aria-label="Dashboard settings Save Dashboard Modal Save button"]') + else: + return driver.find_element(SelectBy.CSS_SELECTOR, f'[data-testid="data-testid Save dashboard drawer button"]') - @property - def discard_button(self): + def discard_button(self, grafana_version): driver: WebDriver = current().context.driver - return driver.find_element(SelectBy.CSS_SELECTOR, f'[title="Undo all changes"]') + if not (grafana_version is None) and (int(grafana_version.split(".")[0]) <= 10): + return driver.find_element(SelectBy.CSS_SELECTOR, f'[title="Undo all changes"]') + else: + return driver.find_element(SelectBy.CSS_SELECTOR, f'[data-testid="data-testid Discard changes button"]') @property def run_query_button(self): @@ -284,5 +290,10 @@ def alert_tab(self, grafana_version=None): else: return driver.find_element(SelectBy.CSS_SELECTOR, f'[data-testid="data-testid Tab Alert"]') + @property + def query_inspector_close_button(self): + driver: WebDriver = current().context.driver + return driver.find_element(SelectBy.CSS_SELECTOR, f'[data-testid="data-testid Drawer close"]') + locators = Locators() diff --git a/tests/testflows/steps/panel/query_options/locators.py b/tests/testflows/steps/panel/query_options/locators.py index 47389ce66..7a1fb0862 100644 --- a/tests/testflows/steps/panel/query_options/locators.py +++ b/tests/testflows/steps/panel/query_options/locators.py @@ -44,7 +44,7 @@ def time_shift_textfield(self): def hide_time_info_toggle(self): driver: WebDriver = current().context.driver return driver.find_element(SelectBy.XPATH, - f'//*[@class="gf-form-inline align-items-center" and .//text()="Hide time info"]//label[@aria-label="Toggle switch"]') + f'//*[contains(@class,"InlineFieldRow") and .//text()="Hide time info"]//label[@aria-label="Toggle switch"]') @property def relative_time_info(self): diff --git a/tests/testflows/steps/panel/view.py b/tests/testflows/steps/panel/view.py index 32e6933f7..1146746a8 100644 --- a/tests/testflows/steps/panel/view.py +++ b/tests/testflows/steps/panel/view.py @@ -272,6 +272,11 @@ def get_query_inspector_url_text(self): with By("getting url from query inspector"): return locators.query_inspector_url.text +@TestStep(When) +def click_query_inspector_close_button(self): + """Click query inspector close button.""" + + locators.query_inspector_close_button.click() @TestStep(Then) def check_query_inspector_request(self, url_parts): @@ -285,10 +290,15 @@ def check_query_inspector_request(self, url_parts): with delay(): click_inspect_query_refresh_button() - with By("checking url contains necessary parts"): - for url_part in url_parts: - with By(f"checking url contains {url_part}"): - assert url_part in get_query_inspector_url_text(), error() + try: + with By("checking url contains necessary parts"): + for url_part in url_parts: + with By(f"checking url contains {url_part}"): + assert url_part in get_query_inspector_url_text(), error() + finally: + with Finally("I close query inspector window"): + with By("clicking query inspector close button"): + click_query_inspector_close_button() @TestStep(When) @@ -407,9 +417,9 @@ def click_apply_button(self): @TestStep(When) def click_discard_button(self): - """Click apply button for panel.""" + """Click discard button for panel.""" - locators.discard_button.click() + locators.discard_button(grafana_version=self.context.grafana_version).click() @TestStep(When) @@ -501,14 +511,14 @@ def get_value_from_table(self, time): def click_save_button(self): """Click save button.""" - locators.save_button.click() + locators.save_button(grafana_version=self.context.grafana_version).click() @TestStep(When) def click_save_confirmation_button(self): """Click save confirmation button.""" - locators.save_confirmations_button.click() + locators.save_confirmations_button(grafana_version=self.context.grafana_version).click() @TestStep(When) @@ -519,5 +529,5 @@ def save_dashboard(self): click_save_button() with And("clicking save confirmation button"): - with delay(): + with delay(before=0.5): click_save_confirmation_button() \ No newline at end of file diff --git a/tests/testflows/steps/ui.py b/tests/testflows/steps/ui.py index 2b0c1735d..b34ba9cae 100644 --- a/tests/testflows/steps/ui.py +++ b/tests/testflows/steps/ui.py @@ -66,7 +66,7 @@ def create_local_chrome_driver(self, browser, local_webdriver_path, common_optio chrome_options.add_argument("--no-sandbox") if is_headless: chrome_options.add_argument("--headless") - chrome_options.add_argument("window-size=1560,1160") + chrome_options.add_argument("window-size=2000,1200") chrome_options.add_argument('--enable-logging') chrome_options.add_argument('--v=1') @@ -89,12 +89,13 @@ def create_remote_chrome_driver(self, browser, hub_url, common_options, timeout, "credentials_enable_service": False, "profile.password_manager_enabled": False, } + remote_chrome_options.add_argument("--disable-notifications") remote_chrome_options.add_experimental_option("prefs", remote_chrome_prefs) remote_chrome_options.set_capability("browserName", browser) remote_chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"]) remote_chrome_options.add_experimental_option("useAutomationExtension", False) remote_chrome_options.set_capability("se:recordVideo", "true") - remote_chrome_options.set_capability("se:screenResolution", "1920x1080") + remote_chrome_options.set_capability("se:screenResolution", "2000x1200") start_time = time.time() diff --git a/tests/testflows/tests/automated/e2e.py b/tests/testflows/tests/automated/e2e.py index 2cb5c82a2..56c646cf7 100644 --- a/tests/testflows/tests/automated/e2e.py +++ b/tests/testflows/tests/automated/e2e.py @@ -22,15 +22,17 @@ def gh_api_check(self): with When("I go to clickhouse dashboard"): dashboards.open_dashboard(dashboard_name="gh-api") - for attempt in retries(delay=5, timeout=50): - with attempt: - with delay(): - with Then("I take screenshot of Pull request events for grafana/grafana panel"): - dashboard.take_screenshot_for_panel(panel_name="Pull request events for grafana/grafana", screenshot_name="gh-api_panel") - with delay(): - with Then("I check graph contains data"): - assert actions.check_screenshot_contains_green(screenshot_name="gh-api_panel") is True, error() + with Then("I check gh-api datasource works correctly"): + for attempt in retries(delay=5, timeout=50): + with attempt: + with delay(): + with Then("I take screenshot of Pull request events for grafana/grafana panel"): + dashboard.take_screenshot_for_panel(panel_name="Pull request events for grafana/grafana", screenshot_name="gh-api_panel") + + with delay(): + with Then("I check graph contains data"): + assert actions.check_screenshot_contains_green(screenshot_name="gh-api_panel") is True, error() @TestCheck @@ -66,68 +68,65 @@ def mixed_data_sources(self): with When("I add visualization for panel"): dashboard.add_visualization() - try: - with When("I select datasource"): - with delay(): - panel.select_datasource_in_panel_view(datasource_name='-- Mixed --') - with When("I add query"): - with delay(): - panel.click_add_query_button() + with When("I select datasource"): + with delay(): + panel.select_datasource_in_panel_view(datasource_name='-- Mixed --') - with When("I change datasource for the first query"): - with delay(): - panel.enter_data_source_for_query(query_name='A', datasource_name='mixed_1') + with When("I add query"): + with delay(): + panel.click_add_query_button() - with When("I change datasource for the second query"): - with delay(): - panel.enter_data_source_for_query(query_name='B', datasource_name='mixed_2') + with When("I change datasource for the first query"): + with delay(): + panel.enter_data_source_for_query(query_name='A', datasource_name='mixed_1') - with When("I open SQL editor"): - with delay(): - panel.go_to_sql_editor(query_name='A') - panel.go_to_sql_editor(query_name='B') + with When("I change datasource for the second query"): + with delay(): + panel.enter_data_source_for_query(query_name='B', datasource_name='mixed_2') - with Then("I enter the first query"): - with delay(): - panel.enter_sql_editor_input(query_name='A', query='SELECT now(), 1') + with When("I open SQL editor"): + with delay(): + panel.go_to_sql_editor(query_name='A') + panel.go_to_sql_editor(query_name='B') - with Then("I enter the second query"): - with delay(): - panel.enter_sql_editor_input(query_name='B', query='SELECT now(), 1') + with Then("I enter the first query"): + with delay(): + panel.enter_sql_editor_input(query_name='A', query='SELECT now(), 1') - with When("I click on the visualization to see the result"): - with delay(): - panel.click_on_the_visualization() + with Then("I enter the second query"): + with delay(): + panel.enter_sql_editor_input(query_name='B', query='SELECT now(), 1') + + with When("I click on the visualization to see the result"): + with delay(): + panel.click_on_the_visualization() - with Then("I click apply button"): - with delay(): - panel.click_apply_button() + with Then("I click save button"): + with delay(): + panel.save_dashboard() - with Then("I go to panel edit the first time"): - with delay(): - dashboard.open_panel(panel_name='Panel Title') + with Then("I open dashboard view"): + with delay(): + dashboards.open_dashboard(dashboard_name="a_mixed") - with Then("I check queries the first time"): - check_queries() + with Then("I go to panel edit the first time"): + with delay(): + dashboard.open_panel(panel_name='Panel Title') - with Then("I click discard button"): - with delay(): - panel.click_discard_button() + with Then("I check queries the first time"): + check_queries() - with Then("I go to panel edit the second time"): - with delay(): - dashboard.open_panel(panel_name='Panel Title') + with Then("I click discard button"): + with delay(): + panel.click_discard_button() - with Then("I check queries the second time"): - check_queries() + with Then("I go to panel edit the second time"): + with delay(): + dashboard.open_panel(panel_name='Panel Title') - finally: - with Finally("I click discard button"): - with delay(): - panel.click_discard_button() - with delay(): - dashboard.saving_dashboard() + with Then("I check queries the second time"): + check_queries() @TestScenario diff --git a/tests/testflows/tests/automated/legacy_alerts.py b/tests/testflows/tests/automated/legacy_alerts.py index af1d56d80..4c4917614 100644 --- a/tests/testflows/tests/automated/legacy_alerts.py +++ b/tests/testflows/tests/automated/legacy_alerts.py @@ -25,14 +25,14 @@ def check_red_alert(self): dashboard_name = define("dashboard_name", "a_red_alert") with Given("I create new dashboard"): - actions.create_dashboard(dashboard_name=dashboard_name) + actions.create_dashboard(dashboard_name=dashboard_name, finally_save_dashboard=False) with When("I add visualization for panel"): dashboard.add_visualization() with When("I select datasource"): with delay(): - panel.select_datasource_in_panel_view(datasource_name='test_alerts_legacy') + panel.select_datasource_in_panel_view(datasource_name='a_test_alerts_legacy') with When("I setup query settings for queries"): with delay(): @@ -78,14 +78,14 @@ def check_green_alert(self): dashboard_name = define("dashboard_name", "a_green_alert") with Given("I create new dashboard"): - actions.create_dashboard(dashboard_name=dashboard_name) + actions.create_dashboard(dashboard_name=dashboard_name, finally_save_dashboard=False) with When("I add visualization for panel"): dashboard.add_visualization() with When("I select datasource"): with delay(): - panel.select_datasource_in_panel_view(datasource_name='test_alerts_legacy') + panel.select_datasource_in_panel_view(datasource_name='a_test_alerts_legacy') with When("I setup query settings for queries"): with delay(): @@ -131,14 +131,14 @@ def check_green_into_red_alert(self): dashboard_name = define("dashboard_name", "a_green_into_red_alert") with Given("I create new dashboard"): - actions.create_dashboard(dashboard_name=dashboard_name) + actions.create_dashboard(dashboard_name=dashboard_name, finally_save_dashboard=False) with When("I add visualization for panel"): dashboard.add_visualization() with When("I select datasource"): with delay(): - panel.select_datasource_in_panel_view(datasource_name='test_alerts_legacy') + panel.select_datasource_in_panel_view(datasource_name='a_test_alerts_legacy') with When("I setup query settings for queries"): with delay(): @@ -205,14 +205,14 @@ def check_red_into_green_alert(self): dashboard_name = define("dashboard_name", "a_red_into_green_alert") with Given("I create new dashboard"): - actions.create_dashboard(dashboard_name=dashboard_name) + actions.create_dashboard(dashboard_name=dashboard_name, finally_save_dashboard=False) with When("I add visualization for panel"): dashboard.add_visualization() with When("I select datasource"): with delay(): - panel.select_datasource_in_panel_view(datasource_name='test_alerts_legacy') + panel.select_datasource_in_panel_view(datasource_name='a_test_alerts_legacy') with When("I setup query settings for queries"): with delay(): @@ -282,7 +282,7 @@ def feature(self): """Check that grafana plugin supports legacy alerts.""" with When("I create new altinity datasource"): - actions.create_new_altinity_datasource(datasource_name='test_alerts_legacy', url="http://clickhouse:8123",) + actions.create_new_altinity_datasource(datasource_name='a_test_alerts_legacy', url="http://clickhouse:8123",) for scenario in loads(current_module(), Scenario): scenario() \ No newline at end of file diff --git a/tests/testflows/tests/automated/query_settings.py b/tests/testflows/tests/automated/query_options.py similarity index 97% rename from tests/testflows/tests/automated/query_settings.py rename to tests/testflows/tests/automated/query_options.py index 741876d9a..3c5efab77 100644 --- a/tests/testflows/tests/automated/query_settings.py +++ b/tests/testflows/tests/automated/query_options.py @@ -30,7 +30,7 @@ def max_data_points(self): with Then("I check default interval"): with delay(): - assert query_options.get_interval_value() == '20s', error() + assert query_options.get_interval_value() == '30s', error() try: with Then("I enter 'Max data points'"): @@ -72,7 +72,7 @@ def min_interval(self): with Then("I check default interval"): with delay(): - assert query_options.get_interval_value() == '20s', error() + assert query_options.get_interval_value() == '30s', error() try: with Then("I enter 'Min interval'"): @@ -257,10 +257,10 @@ def feature(self): """Check that grafana plugin supports query options.""" with Given("I define dashboard name for tests"): - dashboard_name = define("dashboard_name", "a_query_settings") + dashboard_name = define("dashboard_name", "a_query_options") with When("I create new altinity datasource"): - actions.create_new_altinity_datasource(datasource_name='query_editor', url="http://clickhouse:8123",) + actions.create_new_altinity_datasource(datasource_name='query_options', url="http://clickhouse:8123",) with Given("I create new dashboard"): actions.create_dashboard(dashboard_name=dashboard_name) @@ -270,7 +270,7 @@ def feature(self): with When("I select datasource"): with delay(): - panel.select_datasource_in_panel_view(datasource_name='query_editor') + panel.select_datasource_in_panel_view(datasource_name='query_options') with When("I setup query settings for queries"): with delay(): diff --git a/tests/testflows/tests/automated/sql_editor.py b/tests/testflows/tests/automated/sql_editor.py index 4a94dbeb0..bd12fd899 100644 --- a/tests/testflows/tests/automated/sql_editor.py +++ b/tests/testflows/tests/automated/sql_editor.py @@ -307,29 +307,30 @@ def extrapolation_toggle(self): with Then("I click on run query button to see results"): with delay(): panel.click_run_query_button() + + with Then("I check extrapolation toggle works correctly"): + for attempt in retries(delay=10, count=12): + with attempt: + with When("I click on run query button to see results with turned on extrapolation"): + panel.click_run_query_button() - for attempt in retries(delay=10, count=6): - with attempt: - with When("I click on run query button to see results with turned on extrapolation"): - panel.click_run_query_button() + with When("I take screenshot with extrapolation"): + panel.take_screenshot_for_visualization(screenshot_name='extrapolation_toggle_on') - with When("I take screenshot with extrapolation"): - panel.take_screenshot_for_visualization(screenshot_name='extrapolation_toggle_on') + with When("I click on the extrapolation toggle to turn extrapolation off"): + sql_editor.click_extrapolation_toggle(query_name='A') - with When("I click on the extrapolation toggle to turn extrapolation off"): - sql_editor.click_extrapolation_toggle(query_name='A') + with When("I click on run query button to see results with turned off extrapolation"): + panel.click_run_query_button() - with When("I click on run query button to see results with turned off extrapolation"): - panel.click_run_query_button() + with When("I take screenshot without extrapolation"): + panel.take_screenshot_for_visualization(screenshot_name='extrapolation_toggle_off') - with When("I take screenshot without extrapolation"): - panel.take_screenshot_for_visualization(screenshot_name='extrapolation_toggle_off') + with When("I click on the extrapolation toggle to turn extrapolation on"): + sql_editor.click_extrapolation_toggle(query_name='A') - with When("I click on the extrapolation toggle to turn extrapolation on"): - sql_editor.click_extrapolation_toggle(query_name='A') - - with Then("I check screenshots are different"): - assert not(actions.compare_screenshots(screenshot_name_1='extrapolation_toggle_on', screenshot_name_2='extrapolation_toggle_off')) + with Then("I check screenshots are different"): + assert not(actions.compare_screenshots(screenshot_name_1='extrapolation_toggle_on', screenshot_name_2='extrapolation_toggle_off')) finally: with Finally("I return Step textfield and Resolution dropdown values back"): diff --git a/tests/testflows/tests/automated/unified_alerts.py b/tests/testflows/tests/automated/unified_alerts.py index 49c38d0cd..ab3e26ddb 100644 --- a/tests/testflows/tests/automated/unified_alerts.py +++ b/tests/testflows/tests/automated/unified_alerts.py @@ -25,7 +25,7 @@ def check_red_alert(self): dashboard_name = define("dashboard_name", "a_red_alert") with Given("I create new dashboard"): - actions.create_dashboard(dashboard_name=dashboard_name) + actions.create_dashboard(dashboard_name=dashboard_name, finally_save_dashboard=False) with When("I add visualization for panel"): dashboard.add_visualization() @@ -83,7 +83,7 @@ def check_green_alert(self): dashboard_name = define("dashboard_name", "a_green_alert") with Given("I create new dashboard"): - actions.create_dashboard(dashboard_name=dashboard_name) + actions.create_dashboard(dashboard_name=dashboard_name, finally_save_dashboard=False) with When("I add visualization for panel"): dashboard.add_visualization()