Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
nirtal85 committed Jan 30, 2024
2 parents 2c12fa3 + 92fa683 commit b939c5d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/devRun.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,8 @@ jobs:
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: allure-history
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-traces
path: test-results/
5 changes: 5 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,8 @@ jobs:
PERSONAL_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: allure-history
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-traces
path: test-results/
4 changes: 0 additions & 4 deletions pages/login_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,3 @@ def login(self, username, password):
self.user_name_field.type(username)
self.password_field.type(password)
self.login_button.click()

@allure.step("Get error message")
def get_error_message_text(self):
return self.error_message.text_content()
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ addopts = [
"--alluredir=allure-results",
"-ra",
"--color=yes",
"--browser-channel=chrome",
"--headed",
"--video=retain-on-failure",
"--tracing=retain-on-failure"
]

[tool.poetry.dependencies]
Expand Down
16 changes: 4 additions & 12 deletions tests/test_login.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from playwright.sync_api import Page
from playwright.sync_api import Page, expect

from pages.login_page import LoginPage

Expand All @@ -18,21 +18,13 @@ def setup(self, page: Page):

def test_valid_login(self, page: Page):
self.login_page.login("standard_user", "secret_sauce")
assert (
page.url == ex_url
), f"Expected url to be {ex_url} after a valid login, but got {page.url} instead"
expect(page).to_have_url(ex_url)

def test_invalid_login(self, page: Page):
self.login_page.login("standard_user", "secret_sauce1")
assert self.login_page.get_error_message_text() == ex_error_message, (
f"Expected invalid login error message to be {ex_error_message},"
f" but got {self.login_page.get_error_message_text()} instead "
)
expect(self.login_page.error_message).to_have_text(ex_error_message)

@pytest.mark.devRun
def test_locked_out_user(self, page: Page):
self.login_page.login("locked_out_user", "secret_sauce")
assert self.login_page.get_error_message_text() == ex_locked_out_user_message, (
f"Expected locked out user message to be {ex_locked_out_user_message}, "
f"but got {self.login_page.get_error_message_text()} instead"
)
expect(self.login_page.error_message).to_have_text(ex_locked_out_user_message)

0 comments on commit b939c5d

Please sign in to comment.