Skip to content

Commit

Permalink
0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
bahrus committed Apr 17, 2023
1 parent 34e44e5 commit b09e856
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/CI.yml
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

28 changes: 28 additions & 0 deletions playwright.config.ts
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;
65 changes: 65 additions & 0 deletions tests/hemingway.html
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>
9 changes: 9 additions & 0 deletions tests/test1.spec.mjs
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');
});

0 comments on commit b09e856

Please sign in to comment.