Skip to content

Commit

Permalink
Fixed integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
WebReflection committed Oct 13, 2023
1 parent 129683d commit cb6ff9b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npx playwright install
- run: npx playwright install chromium
- run: npm run build --if-present
2 changes: 1 addition & 1 deletion esm/channel.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ⚠️ AUTOMATICALLY GENERATED - DO NOT CHANGE
export const CHANNEL = '011d1ed4-6b4f-44e8-84b3-a07137a42344';
export const CHANNEL = '402910c3-8216-401c-838f-64bd77c0fd50';

export const MAIN = 'M' + CHANNEL;
export const THREAD = 'T' + CHANNEL;
6 changes: 4 additions & 2 deletions test/integration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test.afterAll(() => {
server.process.kill();
});

test.beforeEach(async ({ page }) => {
const forIt = async page => {
const {resolve, promise} = Promise.withResolvers();
page.once('worker', worker => {
// give the worker enough time to be parsed and do stuff
Expand All @@ -37,7 +37,7 @@ test.beforeEach(async ({ page }) => {
await server.promise;
// no worker case (wait twice to be sure)
setTimeout(resolve, WORKER_DELAY * 2);
});
};

test('has title', async ({ page }) => {
await page.goto('http://localhost:8080/test/integration/');
Expand All @@ -47,11 +47,13 @@ test('has title', async ({ page }) => {
test('has worker working', async ({ page }) => {
await page.goto('http://localhost:8080/test/integration/');
await pages.get(page);
await forIt(page);
const result = await page.evaluate(() => document.body.textContent);
await expect(result.trim()).toBe('Greetingstrue');
});

test('worker can set classes', async ({ page }) => {
await page.goto('http://localhost:8080/test/integration/');
await forIt(page);
await page.waitForSelector('html.ready');
});

0 comments on commit cb6ff9b

Please sign in to comment.