Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Page Object Support #95

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"window.zoomLevel": 0,
"editor.tabSize": 2,
"files.exclude": {
"**/.DS_Store": true,
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This repository is based on the [Cucumber-typescript-starter](https://github.com
- Launching new context and page for each scenario
- Running feature with video recording option
- Report generated with last good image attached
- Page Object Design Pattern
- Utilies function to help you with writing steps
- VScode configuration to debug a single feature or an only scenario (run when located on the feature file)

Expand All @@ -36,7 +37,7 @@ On Linux and Mac you can write:

`BROWSER=firefox npm run test` or `BROWSER=firefox npx cucumber-js` runs all tests using Firefox

One Windows you need to write
On Windows you need to write

```
set BROWSER=firefox
Expand Down
10 changes: 10 additions & 0 deletions config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const config = {
baseUrl: process.env.BASE_URL || 'https://playwright.dev',
recordVideos: process.env.PWVIDEO || false,
browser: process.env.BROWSER || 'chromium', // chromium or firefox or webkit
defaultTimeout: 60 * 1000, // milliseconds
runHeadless: true,
runSlow: 0, // milliseconds
};

export default config;
18 changes: 12 additions & 6 deletions features/playwright.feature
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
@foo
Feature: Playwright docs
As a normal user
I want to select which background theme I like
So that I get to browse more comfortably

Background: Navigation
Given Go to the playwright website
Given I go to the playwright website

Scenario: Change theme
When Change theme to "light" mode
Then Snapshot
When Change theme to "dark" mode
Then Snapshot
Scenario Outline: Changing theme to <theme> mode
When I change the theme to "<theme>" mode
Then I see the background color "<color>"
And Snapshot "theme <theme>"

Examples:
| theme | color |
| light | rgb(255, 255, 255) |
| dark | rgb(36, 37, 38) |
Loading