diff --git a/frontend/test_project/features/web/login_tests.feature b/frontend/test_project/features/web/login_tests.feature index 25b42d47..b2a44c17 100644 --- a/frontend/test_project/features/web/login_tests.feature +++ b/frontend/test_project/features/web/login_tests.feature @@ -110,7 +110,7 @@ Feature: OrangeHRM Login and Modus QA blog And I set text 'Sarwar' to field 'SourceDemo_Site > Checkout_page > last_name' And I set text '54810' to field 'SourceDemo_Site > Checkout_page > postal_code' And I click on button 'SourceDemo_Site > Checkout_page > continue' - Then I expect that item '32.39' for element 'SourceDemo_Site > Checkout_page > total_amount' is displayed + Then I expect that item 'Total: $32.39' for element 'SourceDemo_Site > Checkout_page > total_amount' is displayed When I click on button 'SourceDemo_Site > Checkout_page > finish' And The element 'SourceDemo_Site > Checkout_page > thank_you_message' is displayed diff --git a/frontend/test_project/locators/Web_locators.json b/frontend/test_project/locators/Web_locators.json index 01b378d3..0f2f43aa 100644 --- a/frontend/test_project/locators/Web_locators.json +++ b/frontend/test_project/locators/Web_locators.json @@ -51,7 +51,7 @@ "last_name": "//input[@id='last-name']", "postal_code": "//input[@id='postal-code']", "continue": "//input[@id='continue']", - "total_amount": "//div[@class='summary_info_label summary_total_label']", + "total_amount": "//div[@class='summary_total_label']", "finish": "//button[@id='finish']", "thank_you_message": "//h2[normalize-space()='Thank you for your order!']" } diff --git a/main/notifications/slack_plugin.py b/main/notifications/slack_plugin.py index ee9c091a..b4ff4da8 100644 --- a/main/notifications/slack_plugin.py +++ b/main/notifications/slack_plugin.py @@ -27,11 +27,11 @@ class SlackPlugin: """ def __init__( - self, - webhook_url: str, - channel: str, - results_url: Optional[str] = None, - failure_only: Optional[bool] = False, + self, + webhook_url: str, + channel: str, + results_url: Optional[str] = None, + failure_only: Optional[bool] = False, ): self.webhook_url = webhook_url self.channel = channel @@ -153,7 +153,8 @@ def send_message(self) -> requests.Response: def pytest_runtest_logreport(self, report) -> None: # pytest will otherwise double-count tests if they fail in setup or teardown - if (report.when in {'setup', 'teardown'} and not report.passed) or report.when == 'call' and report.outcome != 'rerun': + if (report.when in {'setup', + 'teardown'} and not report.passed) or report.when == 'call' and report.outcome != 'rerun': self.reports[Outcome(report.outcome)].append(report) def pytest_terminal_summary(self, terminalreporter) -> None: @@ -166,12 +167,12 @@ def pytest_sessionstart(self, session) -> None: def pytest_sessionfinish(self, session, exitstatus) -> None: self.session_end = time.time() - if self.failure_only.lower() == 'true' and self.failed_tests_count > 0 and exitstatus == 1: - self.send_message() - print('Test results with failures sent to Slack') - elif self.failure_only.lower() == 'false' or self.failure_only is None: + if self.failure_only is None or self.failure_only.lower() == 'false': self.send_message() print('All Test results sent to Slack') + elif self.failure_only.lower() == 'true' and self.failed_tests_count > 0 and exitstatus == 1: + self.send_message() + print('Test results with failures sent to Slack') else: print(f"No Slack alert sent") diff --git a/main/notifications/teams_plugin.py b/main/notifications/teams_plugin.py index 0edf76ff..820c9b61 100644 --- a/main/notifications/teams_plugin.py +++ b/main/notifications/teams_plugin.py @@ -166,12 +166,12 @@ def pytest_sessionstart(self, session) -> None: def pytest_sessionfinish(self, session, exitstatus) -> None: self.session_end = time.time() - if self.failure_only.lower() == 'true' and self.failed_tests_count > 0 and exitstatus == 1: - self.send_teams_message() - print('Test results with failures sent to Teams') - elif self.failure_only.lower() == 'false' or self.failure_only is None: + if self.failure_only is None or self.failure_only.lower() == 'false': self.send_teams_message() print('All Test results sent to Teams') + elif self.failure_only.lower() == 'true' and self.failed_tests_count > 0 and exitstatus == 1: + self.send_teams_message() + print('Test results with failures sent to Teams') else: print(f"No Teams alert sent")