From 33073d5e5eef87e1ac403bcda74a09191510e3ce Mon Sep 17 00:00:00 2001 From: antip00 Date: Thu, 3 Oct 2024 18:07:32 +0300 Subject: [PATCH 1/3] Wrapping retries with test step. --- tests/testflows/tests/automated/e2e.py | 19 ++++++----- tests/testflows/tests/automated/sql_editor.py | 33 ++++++++++--------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/tests/testflows/tests/automated/e2e.py b/tests/testflows/tests/automated/e2e.py index 2cb5c82a2..1c50a7e89 100644 --- a/tests/testflows/tests/automated/e2e.py +++ b/tests/testflows/tests/automated/e2e.py @@ -22,15 +22,16 @@ 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 diff --git a/tests/testflows/tests/automated/sql_editor.py b/tests/testflows/tests/automated/sql_editor.py index 4a94dbeb0..82df3c408 100644 --- a/tests/testflows/tests/automated/sql_editor.py +++ b/tests/testflows/tests/automated/sql_editor.py @@ -308,28 +308,29 @@ def extrapolation_toggle(self): with delay(): 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 Then("I check extrapolation toggle works correctly"): + 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"): From 8a471a9b01079a43b6b9caf4358051568709fca6 Mon Sep 17 00:00:00 2001 From: antip00 Date: Fri, 11 Oct 2024 19:30:57 +0300 Subject: [PATCH 2/3] Check. --- tests/testflows/regression.py | 1 + tests/testflows/tests/automated/functions.py | 0 2 files changed, 1 insertion(+) create mode 100644 tests/testflows/tests/automated/functions.py diff --git a/tests/testflows/regression.py b/tests/testflows/regression.py index 9815bf41b..90d3a903e 100755 --- a/tests/testflows/regression.py +++ b/tests/testflows/regression.py @@ -52,6 +52,7 @@ def argparser(parser): @TestModule +@Repeat(10) @Name("Grafana Datasource Plugin For Clickhouse") @ArgumentParser(argparser) @Specifications(QA_SRS_Altinity_Grafana_Datasource_Plugin_For_ClickHouse) diff --git a/tests/testflows/tests/automated/functions.py b/tests/testflows/tests/automated/functions.py new file mode 100644 index 000000000..e69de29bb From 5cf7f57ed5c95de3645857e4078c1b06040cfd0d Mon Sep 17 00:00:00 2001 From: antip00 Date: Fri, 11 Oct 2024 19:44:00 +0300 Subject: [PATCH 3/3] Update. --- tests/testflows/regression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testflows/regression.py b/tests/testflows/regression.py index 90d3a903e..2348c952c 100755 --- a/tests/testflows/regression.py +++ b/tests/testflows/regression.py @@ -52,7 +52,6 @@ def argparser(parser): @TestModule -@Repeat(10) @Name("Grafana Datasource Plugin For Clickhouse") @ArgumentParser(argparser) @Specifications(QA_SRS_Altinity_Grafana_Datasource_Plugin_For_ClickHouse) @@ -63,6 +62,7 @@ def argparser(parser): RQ_SRS_Plugin_DockerComposeEnvironment("1.0"), RQ_SRS_Plugin_VersionCompatibility("1.0") ) +@Repeat(10) def regression(self, before, after): self.context.browser = "chrome" self.context.local = False