Skip to content

Commit 4574cba

Browse files
committed
update login page
1 parent 409e628 commit 4574cba

8 files changed

Lines changed: 61 additions & 393 deletions

README.md

Lines changed: 19 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Playwright Python Test Automation - Marketing Cloud Platform
22

3-
A comprehensive Playwright test automation suite for The Marketing Cloud Platform using Python and Pytest.
3+
A comprehensive Playwright test automation suite for """Test suite for the Login Page of The Internet.""" using Python and Pytest.
44

55
## 📋 Project Overview
66

7-
This project is a complete end-to-end test automation framework using Playwright's sync API with Python. It tests https://www.themarketingcloud.com/platform#products and includes modern testing practices such as Page Object Model, parallel execution, multi-browser testing, and detailed HTML reporting with screenshots and videos.
7+
This project is a complete end-to-end test automation framework using Playwright's sync API with Python. It tests """Test suite for the Login Page of The Internet.""" and includes modern testing practices such as Page Object Model, parallel execution, multi-browser testing, and detailed HTML reporting with screenshots and videos.
88

99
## 📁 Project Structure
1010

@@ -15,10 +15,10 @@ This project is a complete end-to-end test automation framework using Playwright
1515
├── requirements.txt # Python dependencies
1616
├── README.md # This file
1717
├── pages/
18-
│ └── marketing_cloud_platform_page.py # Page Object Model for Marketing Cloud Platform
18+
│ └── feature_login_page.py # Page Object Model for Login
1919
├── tests/
2020
│ ├── __pycache__/
21-
│ └── test_marketing_cloud_platform.py # 26 comprehensive test cases
21+
│ └── test_feature_login.py # """Test suite for the Login Page of The Internet."""
2222
├── utils/
2323
| |___ highlight.py # Utility functions (apply highlight expect validations)
2424
├── report/
@@ -43,35 +43,11 @@ This project is a complete end-to-end test automation framework using Playwright
4343

4444
**Total Tests: 26 (All Passing ✅)**
4545

46-
### Test Suites:
47-
1. **Navigation & Loading** (4 tests)
48-
- Page navigation verification
49-
- Category filters visibility
50-
- Sign up and demo links
46+
### Test Suites[DEMO]:
5147

52-
2. **Product Visibility** (8 tests)
53-
- QuestBrand, QuestDIY, BERA.ai, QuestIC
54-
- Influence, SmartAssets, CUE, TPP Insights
48+
1. **"""Test suite for the Login Page of The Internet."""** (1 tests)
49+
- Login into Secure area
5550

56-
3. **Learn More Links** (7 tests)
57-
- Product marketplace link verification
58-
- Navigation to product detail pages
59-
60-
4. **Content & Structure** (2 tests)
61-
- Section headers (Market Research, Communications, Creative & Media)
62-
- Product Marketplace and Platform headings
63-
64-
5. **Sign Up Navigation** (2 tests)
65-
- Sign up button functionality
66-
- Sign up link destination verification
67-
68-
6. **Demo Request** (2 tests)
69-
- Demo request link clickability
70-
- Demo form navigation
71-
72-
7. **Category Filters** (1 tests)
73-
- Category filter text visibility
74-
- All Products, Market Research, Communications, Creative & Media
7551

7652
## 🛠️ Tech Stack
7753

@@ -119,7 +95,7 @@ pytest
11995

12096
Run tests for a specific module:
12197
```bash
122-
pytest tests/test_marketing_cloud_platform.py -v
98+
pytest tests/test_feature_login.py -v
12399
```
124100

125101
Run tests with specific browser:
@@ -131,7 +107,7 @@ pytest --browser webkit
131107

132108
Run a single test:
133109
```bash
134-
pytest tests/test_marketing_cloud_platform.py::TestProductVisibility::test_questbrand_product_visible -v
110+
pytest tests/test_feature_login.py::test_login_page_object -v
135111
```
136112

137113
Run in headed mode (see browser):
@@ -160,20 +136,16 @@ The `pytest.ini` file configures:
160136

161137
## 📖 Page Object Model
162138

163-
### MarketingCloudPlatformPage
164-
Location: `pages/marketing_cloud_platform_page.py`
139+
### LoginPage
140+
Location: `pages/feature_login_page.py`
165141

166142
**Key Features:**
167143
- Encapsulates all element locators
168144
- Provides reusable methods for page interactions
169145
- Separates test logic from locator management
170146

171147
**Main Methods:**
172-
- `navigate()` - Navigate to the platform page
173-
- `filter_by_category(category)` - Filter products by category
174-
- `verify_product_visible(product_name)` - Check product visibility
175-
- `submit_demo_request(...)` - Fill and submit demo form
176-
- Various property accessors for elements
148+
- `login()` - Perform login action with given credentials.
177149

178150
## 📈 Execution Details
179151

@@ -243,11 +215,11 @@ chmod +x .venv/bin/activate
243215

244216
### Running Specific Test Classes
245217
```bash
246-
# Run all product visibility tests
247-
pytest tests/test_marketing_cloud_platform.py::TestProductVisibility -v
218+
# Run all tests
219+
pytest pytest tests/test_feature_login.py -v
248220

249-
# Run all navigation tests
250-
pytest tests/test_marketing_cloud_platform.py::TestMarketingCloudPlatformNavigation -v
221+
# Run specific tests
222+
pytest pytest tests/test_feature_login.py::test_login_page_object -v
251223
```
252224

253225
### Debugging Tests
@@ -259,7 +231,7 @@ pytest -vv
259231
pytest -s
260232

261233
# Run single test with detailed output
262-
pytest tests/test_marketing_cloud_platform.py::TestProductVisibility::test_questbrand_product_visible -vv -s
234+
pytest pytest tests/test_feature_login.py::test_login_page_object -vv -s
263235

264236
# Run in debbug mode (see browser):
265237
PWDEBUG=1 pytest -s
@@ -308,7 +280,7 @@ This project is provided as-is for testing automation purposes.
308280

309281
---
310282

311-
**Last Updated**: March 5, 2026
312-
**Test Status**: ✅ 26/26 Passing
283+
**Last Updated**: March 13, 2026
284+
**Test Status**: ✅ 1/1 Passing
313285
**Python Version**: 3.14.3
314286
**Playwright Version**: 1.58.0+

conftest.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import pytest
33
import base64
44
from playwright.sync_api import sync_playwright
5-
from pages.marketing_cloud_platform_page import MarketingCloudPlatformPage
5+
from pages.feature_login_page import LoginPage
66
from pytest_metadata.plugin import metadata
77

88
@pytest.fixture(scope="session")
@@ -22,10 +22,13 @@ def page(browser):
2222
page.close()
2323

2424

25+
2526
@pytest.fixture
26-
def platform_page(page):
27-
"""Fixture to provide MarketingCloudPlatformPage instance."""
28-
return MarketingCloudPlatformPage(page)
27+
def login_page(page, base_url):
28+
"""Fixture to provide LoginPage instance."""
29+
page.goto(base_url + "/login")
30+
return LoginPage(page)
31+
2932

3033
@pytest.hookimpl(optionalhook=True)
3134
def pytest_metadata(metadata):

pages/feature_login_page.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
from playwright.sync_api import Page, expect
3+
4+
5+
class LoginPage:
6+
"""Page Object Model for the Login Page of The Internet."""
7+
8+
def __init__(self, page: Page):
9+
self.page = page
10+
self.username_input = page.get_by_role("textbox", name="Username")
11+
self.password_input = page.get_by_role("textbox", name="Password")
12+
self.login_button = page.get_by_role("button", name="Login")
13+
self.flash_message = page.locator("#flash")
14+
15+
def login(self, username: str, password: str) -> None:
16+
"""Perform login action with given credentials."""
17+
self.username_input.click()
18+
self.username_input.fill(username)
19+
self.password_input.click()
20+
self.password_input.fill(password)
21+
self.login_button.click()
22+

pages/marketing_cloud_platform_page.py

Lines changed: 0 additions & 94 deletions
This file was deleted.

pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[pytest]
22
addopts =
3-
--base-url="Your product under test Base URL - (e.g. https://staging.or.qa.or.uat.yourapp.com)"
3+
--base-url=https://the-internet.herokuapp.com
44
--browser chromium
55
--browser firefox
66
--browser webkit

sonar-project.properties

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ sonar.projectKey=JarDeVSon_PlaywrightPython
22
sonar.projectName=PlaywrightPython
33
sonar.organization=jardevson
44
sonar.host.url=https://sonarcloud.io
5-
sonar.sources=utils
5+
sonar.sources=.
66
sonar.tests=tests
7+
sonar.exclusions=reports/**,.venv/*
78
sonar.test.inclusions=tests/**/*.py
89
sonar.language=py
910
sonar.sourceEncoding=UTF-8

tests/test_feature_login.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from utils.highlight import highlight
2+
from playwright.sync_api import expect
3+
4+
class TestLogin:
5+
"""Test suite for the Login Page of The Internet."""
6+
def test_login_page_object(self, login_page):
7+
login_page.login("tomsmith", "SuperSecretPassword!")
8+
expect(login_page.flash_message).to_contain_text("You logged into a secure area!")
9+
highlight(login_page.flash_message)
10+

0 commit comments

Comments
 (0)