-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from ZhikharevAl/feature/tests
Feature/tests
- Loading branch information
Showing
8 changed files
with
213 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import allure | ||
from playwright.sync_api import Page | ||
|
||
from config.config import UPDATE_PROFILE_URL | ||
from data.user_data import UserData | ||
from pages.base_page import BasePage | ||
|
||
|
||
class UpdateProfilePage(BasePage): | ||
"""The update profile page.""" | ||
|
||
def __init__(self, page: Page) -> None: | ||
"""The update profile page.""" | ||
super().__init__(page, url=UPDATE_PROFILE_URL) | ||
|
||
FIRST_NAME_INPUT = '[id="customer.firstName"]' | ||
LAST_NAME_INPUT = '[id="customer.lastName"]' | ||
STREET_INPUT = '[id="customer.address.street"]' | ||
CITY_INPUT = '[id="customer.address.city"]' | ||
STATE_INPUT = '[id="customer.address.state"]' | ||
ZIP_CODE_INPUT = '[id="customer.address.zipCode"]' | ||
PHONE_INPUT = '[id="customer.phoneNumber"]' | ||
UPDATE_BUTTON = "Update Profile" | ||
UPDATE_MESSAGE_LOCATOR = "#updateProfileResult" | ||
UPDATE_MESSAGE = "Profile Updated" | ||
|
||
@allure.step("Fill registration form") | ||
def update_profile(self, user_data: UserData) -> None: | ||
"""Fill all fields in registration form.""" | ||
self.page.on("dialog", lambda dialog: dialog.accept()) | ||
self.fill_text(self.FIRST_NAME_INPUT, user_data.first_name) | ||
self.fill_text(self.LAST_NAME_INPUT, user_data.last_name) | ||
self.fill_text(self.STREET_INPUT, user_data.street) | ||
self.fill_text(self.CITY_INPUT, user_data.city) | ||
self.fill_text(self.STATE_INPUT, user_data.state) | ||
self.fill_text(self.ZIP_CODE_INPUT, user_data.zip_code) | ||
self.fill_text(self.PHONE_INPUT, user_data.phone) | ||
|
||
def click_update_button(self) -> None: | ||
"""Click update button.""" | ||
self.click_by_role("button", self.UPDATE_BUTTON) # type: ignore | ||
|
||
@property | ||
def is_updated(self) -> bool: | ||
"""Check if profile is updated.""" | ||
return self.contains_text(self.UPDATE_MESSAGE_LOCATOR, self.UPDATE_MESSAGE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import allure | ||
|
||
from config.config import BASE_URL, UPDATE_PROFILE_URL | ||
from data.user_data import UserData | ||
from pages.main_page import MainPage | ||
from pages.overview_page import OverviewPage | ||
from tests.base.base_test import BaseTest | ||
|
||
|
||
@allure.epic("Banking Application") | ||
@allure.feature("Update Profile") | ||
@allure.description_html(""" | ||
<h2>Testing Update Profile Functionality</h2> | ||
<p>This test verifies the ability to update a user's profile information:</p> | ||
<ul> | ||
<li>Update profile information with new data</li> | ||
<li>Confirm the profile update is completed successfully</li> | ||
</ul> | ||
<p>The test performs the following operations:</p> | ||
<ul> | ||
<li>Navigate to the Update Profile page</li> | ||
<li>Enter the new profile information</li> | ||
<li>Click the Update button</li> | ||
<li>Verify the profile update is marked as complete</li> | ||
</ul> | ||
<p>Expected Results:</p> | ||
<ul> | ||
<li>User can access the Update Profile page</li> | ||
<li>Profile information is successfully updated</li> | ||
<li>Update completion is confirmed on the page</li> | ||
</ul> | ||
""") | ||
class TestUpdateProfile(BaseTest): | ||
"""Test update profile.""" | ||
|
||
def test_update_profile( | ||
self, | ||
login: tuple[MainPage, OverviewPage], # noqa: ARG002 | ||
random_user_data: UserData, | ||
) -> None: | ||
"""Test update profile.""" | ||
self.overview_page.click_update_profile() | ||
assert self.update_profile_page.expect_url( | ||
f"{BASE_URL}{UPDATE_PROFILE_URL}" | ||
), "URL does not match expected value" | ||
self.update_profile_page.update_profile(random_user_data) # type: ignore | ||
self.update_profile_page.click_update_button() | ||
assert self.update_profile_page.is_updated, "Profile is not updated" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters