-
Notifications
You must be signed in to change notification settings - Fork 17
feat: add playwright check examples [kit-2234] #1156
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
Merged
maxigimenez
merged 11 commits into
main
from
maxi/kit-2234-add-playwright-check-to-checkly-cli-boilerplate-projects
Oct 13, 2025
+344
−80
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a0feb4f
feat: add playwright check examples [kit-2234]
maxigimenez 921146c
feat: add missing files
maxigimenez 2858a8f
fix: set correct dirpath to copy pw settings [kit-2234]
maxigimenez 7c7cd9d
Merge branch 'main' into maxi/kit-2234-add-playwright-check-to-checkl…
maxigimenez 5e29340
feat: change PW version on examples
maxigimenez 3fb9256
Review Maxi's PR around examples without push permissions (#1160)
MariadeAnton 5189d5e
chore: remove results
maxigimenez ba4c428
chore: remove package-lock.json
maxigimenez bcde9b4
chore: change package.json
maxigimenez d1dbf4c
fix: do not copy pw config
maxigimenez 23b39dc
Merge branch 'main' into maxi/kit-2234-add-playwright-check-to-checkl…
maxigimenez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,43 @@ | ||
const { defineConfig, devices } = require('@playwright/test'); | ||
const path = require('path'); | ||
|
||
const AUTH_FILE = '.auth/user.json'; | ||
|
||
const config = defineConfig({ | ||
timeout: 30000, | ||
use: { | ||
baseURL: 'https://www.danube-web.shop', | ||
viewport: { width: 1280, height: 720 }, | ||
}, | ||
projects: [ | ||
{ | ||
name: 'login-setup', | ||
testMatch: /.*\.setup.ts/, | ||
use: { | ||
...devices['Desktop Chrome'], | ||
}, | ||
}, | ||
{ | ||
name: 'Firefox', | ||
testDir: './src/tests/', | ||
use: { | ||
...devices['Desktop Firefox'], | ||
storageState: path.resolve(__dirname, AUTH_FILE), | ||
}, | ||
dependencies: ["login-setup"], | ||
}, | ||
{ | ||
name: 'Chromium', | ||
testDir: './src/tests/', | ||
use: { | ||
...devices['Desktop Chrome'], | ||
storageState: path.resolve(__dirname, AUTH_FILE), | ||
// Optionally add Checkly user-agent | ||
userAgent: devices['Desktop Chrome'].userAgent + ' (Checkly, https://www.checklyhq.com)', | ||
}, | ||
dependencies: ['login-setup'], | ||
}, | ||
] | ||
}); | ||
|
||
module.exports = config; |
This file contains hidden or 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,9 @@ | ||
const { test, expect } = require('@playwright/test'); | ||
|
||
test('webshop homepage @homepage', async ({ page }) => { | ||
const response = await page.goto(''); | ||
|
||
expect(response?.status()).toBeLessThan(400); | ||
await expect(page).toHaveTitle(/Danube WebShop/); | ||
await page.screenshot({ path: 'homepage.jpg' }); | ||
}); |
This file contains hidden or 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,17 @@ | ||
const { test } = require('@playwright/test'); | ||
|
||
test('login', { | ||
tag: '@login', | ||
}, async ({ page }) => { | ||
// navigate to our target web page | ||
await page.goto(''); | ||
|
||
// click on the login button and go through the login procedure | ||
await page.click('#login'); | ||
await page.type('#n-email', '[email protected]'); | ||
await page.type('#n-password2', 'supersecure1'); | ||
await page.click('#goto-signin-btn'); | ||
|
||
// wait until the login confirmation message is shown | ||
await page.waitForSelector('#login-message', { visible: true }); | ||
}); |
This file contains hidden or 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 hidden or 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 hidden or 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 | ||||
---|---|---|---|---|---|---|
|
@@ -10,6 +10,7 @@ | |||||
"author": "", | ||||||
"license": "ISC", | ||||||
"devDependencies": { | ||||||
"@playwright/test": "^1", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
For consistency There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
"checkly": "latest", | ||||||
"jiti": "^2" | ||||||
} | ||||||
|
This file contains hidden or 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,54 @@ | ||
import { defineConfig, devices } from "@playwright/test" | ||
|
||
/** | ||
* Read environment variables from file. | ||
* https://github.com/motdotla/dotenv | ||
*/ | ||
import dotenv from "dotenv" | ||
import path from "path" | ||
dotenv.config({ path: path.resolve(__dirname, ".env") }) | ||
|
||
export const AUTH_FILE = ".auth/user.json" | ||
|
||
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
|
||
export default defineConfig({ | ||
timeout: 30000, | ||
use: { | ||
baseURL: "https://www.checklyhq.com", | ||
viewport: { width: 1280, height: 720 }, | ||
trace: "on", | ||
|
||
}, | ||
projects: [ | ||
{ | ||
name: 'login-setup', | ||
testMatch: /.*\.setup.ts/, | ||
use: { | ||
...devices['Desktop Chrome'], | ||
}, | ||
}, | ||
{ | ||
name: 'Firefox', | ||
testDir: './src/tests/', | ||
use: { | ||
...devices['Desktop Firefox'], | ||
storageState: path.resolve(__dirname, AUTH_FILE), | ||
}, | ||
dependencies: ["login-setup"], | ||
}, | ||
{ | ||
name: 'Chromium', | ||
testDir: './src/tests/', | ||
use: { | ||
...devices['Desktop Chrome'], | ||
storageState: path.resolve(__dirname, AUTH_FILE), | ||
// Optionally add Checkly user-agent | ||
userAgent: `${devices['Desktop Chrome'].userAgent} (Checkly, https://www.checklyhq.com)`, | ||
}, | ||
dependencies: ["login-setup"], | ||
}, | ||
] | ||
}); |
40 changes: 0 additions & 40 deletions
40
examples/advanced-project/src/__checks__/synthetics/07-playwright-techniques.spec.ts
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
examples/advanced-project/src/__checks__/synthetics/08-playwright-techniques.check.ts
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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,9 @@ | ||
import { expect, test } from "@playwright/test" | ||
|
||
test("Visit Checkly home page", async ({ page }) => { | ||
await page.goto("/") | ||
|
||
await expect(page).toHaveTitle(/Checkly/) | ||
|
||
// More test code ... | ||
}) |
This file contains hidden or 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,15 @@ | ||
import { test as setup } from "@playwright/test" | ||
|
||
const AUTH_FILE = ".auth/user.json" | ||
|
||
setup("Log into Checkly", async ({ page }) => { | ||
await page.goto("/") | ||
|
||
// Perform your login actions which will set cookies and localstorage entries | ||
// ... | ||
|
||
// Use storage state to write the browser state to disk | ||
// More info: https://playwright.dev/docs/api/class-browsercontext#browser-context-storage-state | ||
await page.context().storageState({ path: AUTH_FILE }) | ||
console.log(`Wrote storage state to ${AUTH_FILE}`) | ||
}) |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.