TEMP: testing typescript tests

This commit is contained in:
Tony Sullivan 2022-05-20 23:21:38 -05:00
parent 3e8db19817
commit 603fa289a9
3 changed files with 37 additions and 16 deletions

View file

@ -10,23 +10,18 @@ const test = base.extend({
let devServer;
test.beforeAll(async ({ astro }) => {
test.beforeEach(async ({ astro }) => {
devServer = await astro.startDevServer();
});
test.afterAll(async ({ astro }) => {
test.afterEach(async () => {
await devServer.stop();
});
test.afterEach(async ({ astro }) => {
astro.clean();
});
test.only('Solid', async ({ page, astro }) => {
page.on('console', msg => console.log('Solid::', msg.text()));
test.describe('Solid', () => {
test('server only', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/'));
await test.step('server only', async () => {
const counter = page.locator('#server-only');
await expect(counter).toBeVisible();
@ -39,7 +34,9 @@ test.only('Solid', async ({ page, astro }) => {
await expect(count).toHaveText('0');
});
await test.step('client:idle', async () => {
test('client:idle', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/'));
const counter = page.locator('#client-idle');
await expect(counter).toBeVisible();
@ -52,7 +49,9 @@ test.only('Solid', async ({ page, astro }) => {
await expect(count).toHaveText('1');
});
await test.step('client:load', async () => {
test('client:load', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/'));
const counter = page.locator('#client-load');
await expect(counter).toBeVisible();
@ -65,7 +64,9 @@ test.only('Solid', async ({ page, astro }) => {
await expect(count).toHaveText('1');
});
await test.step('client:visible', async () => {
test('client:visible', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/'));
const counter = page.locator('#client-visible');
await counter.scrollIntoViewIfNeeded();
await expect(counter).toBeVisible();
@ -79,7 +80,9 @@ test.only('Solid', async ({ page, astro }) => {
await expect(count).toHaveText('1');
});
await test.step('client:media', async () => {
test('client:media', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/'));
const counter = page.locator('#client-media');
await expect(counter).toBeVisible();
@ -97,7 +100,9 @@ test.only('Solid', async ({ page, astro }) => {
await expect(count).toHaveText('1');
});
await test.step('HMR', async () => {
test('HMR', async ({ page, astro }) => {
await page.goto(astro.resolveUrl('/'));
// test 1: updating the page component
await astro.editFile(
'./src/pages/index.astro',

View file

@ -73,7 +73,7 @@
"benchmark": "node test/benchmark/dev.bench.js && node test/benchmark/build.bench.js",
"test": "mocha --exit --timeout 20000 --ignore **/lit-element.test.js --ignore **/errors.test.js && mocha --timeout 20000 **/lit-element.test.js && mocha --timeout 20000 **/errors.test.js",
"test:match": "mocha --timeout 20000 -g",
"test:e2e": "playwright test e2e",
"test:e2e": "playwright test e2e/*.test.js",
"test:e2e:match": "playwright test e2e -g"
},
"dependencies": {

View file

@ -0,0 +1,16 @@
import type { PlaywrightTestConfig } from '@playwright/test';
const config: PlaywrightTestConfig = {
testMatch: 'e2e/*.test.ts',
projects: [
{
name: 'Chrome Stable',
use: {
browserName: 'chromium',
channel: 'chrome',
},
},
],
};
export default config;