From c7cb5df450c2b86ba7b17301fb06fa9d388c8316 Mon Sep 17 00:00:00 2001 From: Tony Sullivan Date: Thu, 23 Jun 2022 17:28:54 +0000 Subject: [PATCH] centralizing test setup with a universal resetAllFiles hook (#3693) --- packages/astro/e2e/astro-component.test.js | 11 +- packages/astro/e2e/client-only.test.js | 11 +- .../vue-component/src/components/Counter.vue | 47 +++-- .../{Result.vue => VueComponent.vue} | 7 +- .../vue-component/src/pages/index.astro | 64 +++---- .../vue-component/src/pages/markdown.md | 31 ++++ packages/astro/e2e/lit-component.test.js | 11 +- .../astro/e2e/multiple-frameworks.test.js | 11 +- packages/astro/e2e/nested-in-preact.test.js | 11 +- packages/astro/e2e/nested-in-react.test.js | 11 +- packages/astro/e2e/nested-in-solid.test.js | 11 +- packages/astro/e2e/nested-in-svelte.test.js | 11 +- packages/astro/e2e/nested-in-vue.test.js | 11 +- packages/astro/e2e/nested-styles.test.js | 11 +- packages/astro/e2e/pass-js.test.js | 11 +- packages/astro/e2e/shared-component-tests.js | 13 +- packages/astro/e2e/tailwindcss.test.js | 11 +- packages/astro/e2e/test-utils.js | 18 ++ packages/astro/e2e/ts-resolution.test.js | 11 +- packages/astro/e2e/vue-component.test.js | 160 ++---------------- 20 files changed, 168 insertions(+), 315 deletions(-) rename packages/astro/e2e/fixtures/vue-component/src/components/{Result.vue => VueComponent.vue} (53%) create mode 100644 packages/astro/e2e/fixtures/vue-component/src/pages/markdown.md diff --git a/packages/astro/e2e/astro-component.test.js b/packages/astro/e2e/astro-component.test.js index 8a6870d57..9ab52f597 100644 --- a/packages/astro/e2e/astro-component.test.js +++ b/packages/astro/e2e/astro-component.test.js @@ -1,13 +1,8 @@ -import { test as base, expect } from '@playwright/test'; +import { expect } from '@playwright/test'; import os from 'os'; -import { loadFixture } from './test-utils.js'; +import { testFactory } from './test-utils.js'; -const test = base.extend({ - astro: async ({}, use) => { - const fixture = await loadFixture({ root: './fixtures/astro-component/' }); - await use(fixture); - }, -}); +const test = testFactory({ root: './fixtures/astro-component/' }); let devServer; diff --git a/packages/astro/e2e/client-only.test.js b/packages/astro/e2e/client-only.test.js index 78a06fdbe..a2db0e0e2 100644 --- a/packages/astro/e2e/client-only.test.js +++ b/packages/astro/e2e/client-only.test.js @@ -1,12 +1,7 @@ -import { test as base, expect } from '@playwright/test'; -import { loadFixture } from './test-utils.js'; +import { expect } from '@playwright/test'; +import { testFactory } from './test-utils.js'; -const test = base.extend({ - astro: async ({}, use) => { - const fixture = await loadFixture({ root: './fixtures/client-only/' }); - await use(fixture); - }, -}); +const test = testFactory({ root: './fixtures/client-only/' }); let devServer; diff --git a/packages/astro/e2e/fixtures/vue-component/src/components/Counter.vue b/packages/astro/e2e/fixtures/vue-component/src/components/Counter.vue index b96e6381b..ed6fb5fb4 100644 --- a/packages/astro/e2e/fixtures/vue-component/src/components/Counter.vue +++ b/packages/astro/e2e/fixtures/vue-component/src/components/Counter.vue @@ -1,44 +1,38 @@ diff --git a/packages/astro/e2e/fixtures/vue-component/src/components/Result.vue b/packages/astro/e2e/fixtures/vue-component/src/components/VueComponent.vue similarity index 53% rename from packages/astro/e2e/fixtures/vue-component/src/components/Result.vue rename to packages/astro/e2e/fixtures/vue-component/src/components/VueComponent.vue index 90bf218b2..ab0cee328 100644 --- a/packages/astro/e2e/fixtures/vue-component/src/components/Result.vue +++ b/packages/astro/e2e/fixtures/vue-component/src/components/VueComponent.vue @@ -1,14 +1,13 @@