Skip to content

Commit

Permalink
chore: try to get the watch test running on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
shellscape committed Oct 15, 2024
1 parent 907288a commit 1e9d1b2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions test/smoke/playwright.dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
import config from './playwright.config';

(config.webServer as any).command = 'pnpm exec moon smoke:dev';
(config.webServer as any).env.LOCAL_SMOKE = 'true';

export default Object.assign(config, {});
13 changes: 9 additions & 4 deletions test/smoke/tests/smoke.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-await-in-loop, no-underscore-dangle */
import { readFile, writeFile } from 'node:fs/promises';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'url';
import { fileURLToPath } from 'node:url';

import { test, expect } from '@playwright/test';

Expand Down Expand Up @@ -71,17 +71,22 @@ test('watcher', async ({ page }) => {
await page.goto('/');
await page.waitForSelector(propsButtonSel, timeout);

const targetFilePath = join(__dirname, '../fixtures/components/text.tsx');
const isLocal = process.env.LOCAL_SMOKE === 'true';
const targetFilePath = isLocal
? join(__dirname, '../fixtures/components/text.tsx')
: '/home/runner/work/jsx-email/jsx-email/jsx-email-tests/smoke-test/fixtures/components/text.tsx';

console.log({ isLocal, targetFilePath });

const contents = await readFile(targetFilePath, 'utf8');

console.log({ targetFilePath });
console.log({ contents });

await writeFile(targetFilePath, contents.replace('test', 'batman'), 'utf8');

console.log('after write:', await readFile(targetFilePath, 'utf8'));

await page.waitForTimeout(25e3);
await page.waitForTimeout(28e3);
await page.waitForSelector('#link-Local-Assets', timeout);

page.locator('#link-Local-Assets').click();
Expand Down

0 comments on commit 1e9d1b2

Please sign in to comment.