Skip to content

Commit

Permalink
created repro
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalets committed Apr 1, 2024
1 parent fb18771 commit 1123bc0
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 41 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions features/homepage.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Feature: Playwright Home Page
Feature: Visual Testing of Cart Page

Scenario: Check title
Given I am on Playwright home page
When I click link "Get started"
Then I see in title "Installation"
Scenario: Create a base screenshot
Given I open url "https://flipkart.com"
When I click on cart link
Then Screenshot should get captured

48 changes: 34 additions & 14 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,42 @@ import { defineConfig, devices } from '@playwright/test';
import { defineBddConfig, cucumberReporter } from 'playwright-bdd';

const testDir = defineBddConfig({
paths: ['features/*.feature'],
require: ['steps/*.ts'],
importTestFrom: 'steps/fixtures.ts',
// importTestFrom: 'steps/fixtures.ts',
paths: ['./features'],
require: ['steps/*.js'],
quotes: 'backtick',
featuresRoot: './features',
});

export default defineConfig({
repeatEach: 10,
/* Maximum time one test can run for. */
timeout: 3000 * 3000,
expect: {
timeout: 7000
},
testDir,
reporter: [cucumberReporter('html', { outputFile: 'cucumber-report/report.html' })],
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
reporter: [
['html'],
cucumberReporter('html', { outputFile: 'cucumber-report/report.html' }),
cucumberReporter('json', { outputFile: 'cucumber-report/report.json' }),
cucumberReporter('junit', { outputFile: 'cucumber-report/report.xml' }),
cucumberReporter('message', { outputFile: 'cucumber-report/report.ndjson' }),
],
use: {
actionTimeout: 0,
browserName: 'chromium',
trace: 'retain-on-failure',
screenshot: 'only-on-failure',
video: {
mode: 'on-first-retry',
size: { width: 640, height: 480 }
},
// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'] },
// },
]
});
ignoreHTTPSErrors: true,
permissions: ['geolocation'],
launchOptions: {
args: ["--window-size=1920,1080", "--disable-web-security"],
},
viewport: null
}
});
5 changes: 0 additions & 5 deletions steps/fixtures.ts

This file was deleted.

16 changes: 16 additions & 0 deletions steps/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { expect } from '@playwright/test';
import { createBdd} from 'playwright-bdd';

const { Given, When, Then } = createBdd();

Given('I open url {string}' , async ({ page }, url) => {
await page.goto(url);
});

When('I click on cart link', async ({ page }) => {
await page.getByText('Cart').click();
});

Then('Screenshot should get captured', async ({ page }) => {
await expect(page).toHaveScreenshot('cartpage.png', { fullPage: true });
});
17 changes: 0 additions & 17 deletions steps/index.ts

This file was deleted.

0 comments on commit 1123bc0

Please sign in to comment.