-
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 #9 from antowaddle/playwrightUITest
Playwright UI test
- Loading branch information
Showing
4 changed files
with
37 additions
and
45 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,5 @@ | ||
Feature: Load resume page | ||
|
||
Scenario: Check if the resume page loads | ||
Given the resume page is loaded | ||
Then the page title should be "Anthony Coughlin - QA Manager" |
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,4 @@ | ||
[pytest] | ||
addopts = --maxfail=1 -v | ||
markers = | ||
ui_test: marks tests as ui tests |
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,28 @@ | ||
import pytest | ||
from pytest_bdd import scenarios, given, then | ||
from playwright.sync_api import sync_playwright | ||
|
||
# Load the feature file | ||
scenarios('../features/ui_tests.feature') | ||
|
||
@pytest.fixture(scope='module') | ||
def browser(): | ||
with sync_playwright() as p: | ||
browser = p.chromium.launch(headless=True) | ||
yield browser | ||
browser.close() | ||
|
||
@pytest.fixture(scope='module') | ||
def page(browser): | ||
context = browser.new_context() | ||
page = context.new_page() | ||
yield page | ||
context.close() | ||
|
||
@given("the resume page is loaded") | ||
def load_resume_page(page): | ||
page.goto("https://anthony-coughlin-resume.com/") | ||
|
||
@then('the page title should be "Anthony Coughlin - QA Manager"') | ||
def check_page_title(page): | ||
assert page.title() == "Anthony Coughlin - QA Manager" |