-
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.
- Loading branch information
Showing
4 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
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,18 @@ | ||
name: Playwright Tests | ||
on: [push] | ||
jobs: | ||
test: | ||
timeout-minutes: 10 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16.x' | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Install Playwright | ||
run: npx playwright install --with-deps | ||
- name: Run Playwright tests | ||
run: npm run test | ||
|
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 @@ | ||
// playwright.config.ts | ||
import { PlaywrightTestConfig, devices } from '@playwright/test'; | ||
const config: PlaywrightTestConfig = { | ||
webServer: { | ||
command: 'npm run serve', | ||
url: 'http://localhost:3030/', | ||
timeout: 120 * 1000, | ||
reuseExistingServer: !process.env.CI, | ||
}, | ||
use: { | ||
baseURL: 'http://localhost:3030/', | ||
}, | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
{ | ||
name: 'firefox', | ||
use: { ...devices['Desktop Firefox'] }, | ||
}, | ||
{ | ||
name: 'webkit', | ||
use: { ...devices['Desktop Safari'] }, | ||
}, | ||
], | ||
}; | ||
export default config; |
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,65 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Document</title> | ||
</head> | ||
<body> | ||
<div> | ||
<button>30</button> | ||
<time datetime="2018-07-07T20:00:00">20:00</time> | ||
<span itemprop="greeting">Hello</span> | ||
<ul> | ||
<li><data value="21053">Cherry Tomato</data></li> | ||
<li><data value="21054">Beef Tomato</data></li> | ||
<li><data value="21055">Snack Tomato</data></li> | ||
</ul> | ||
</div> | ||
<template be-derived=' | ||
Affect previous element sibling. //This is set by default. | ||
Target beScoped:scope. //Not set by default. | ||
Survey previous element sibling. //This is set by default. | ||
Derive count as number from button. | ||
Derive day of event as date from datetime attribute. | ||
Itemize. | ||
'> | ||
<obj-ml > | ||
<xsl:for-each select="div/ul/li"> | ||
<li-ml itemprop="product" product-id-n="{data/@value}" description="{data/text()}"></li-ml> | ||
</xsl:for-each> | ||
</obj-ml> | ||
</template> | ||
<div id=target></div> | ||
<script> | ||
function runTest(){ | ||
const d = document.querySelector('div'); | ||
const obj = d.beDecorated.scoped.scope; | ||
const json = JSON.stringify(obj); | ||
if(json.length === 230){ | ||
target.setAttribute('mark', 'good'); | ||
} | ||
} | ||
setTimeout(() => { | ||
runTest(); | ||
}, 2000); | ||
</script> | ||
<script type=importmap> | ||
{ | ||
"imports": { | ||
"be-decorated/": "../node_modules/be-decorated/", | ||
"be-exportable/": "../node_modules/be-exportable/", | ||
"be-hive/": "../node_modules/be-hive/", | ||
"be-scoped/": "../node_modules/be-scoped/", | ||
"obj-ml/": "../node_modules/obj-ml/", | ||
"trans-render/": "../node_modules/trans-render/" | ||
} | ||
} | ||
</script> | ||
<script type=module> | ||
import '../be-derived.js'; | ||
import 'be-scoped/be-scoped.js'; | ||
</script> | ||
</body> | ||
</html> |
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,9 @@ | ||
import { test, expect } from '@playwright/test'; | ||
test('test1', async ({ page }) => { | ||
await page.goto('./tests/hemingway.html'); | ||
// wait for 12 seconds | ||
await page.waitForTimeout(12000); | ||
const editor = page.locator('#target'); | ||
await expect(editor).toHaveAttribute('mark', 'good'); | ||
}); | ||
|