Skip to content

Commit

Permalink
xpath fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tauqirsarwar1 committed Mar 28, 2024
1 parent 2f256a7 commit 4ee68ed
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion frontend/test_project/features/web/login_tests.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion frontend/test_project/locators/Web_locators.json
Original file line number Diff line number Diff line change
Expand Up @@ -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!']"
}
Expand Down
21 changes: 11 additions & 10 deletions main/notifications/slack_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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")

Expand Down
8 changes: 4 additions & 4 deletions main/notifications/teams_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 4ee68ed

Please sign in to comment.