Home / File/ shared-component-tests.js — astro Source File

shared-component-tests.js — astro Source File

Architecture documentation for shared-component-tests.js, a javascript file in the astro codebase. 5 imports, 7 dependents.

File javascript E2ETesting TestFixtures 5 imports 7 dependents 1 functions

Entity Profile

Dependency Diagram

graph LR
  f50170e1_d539_f9d5_a768_c073a3afcfd4["shared-component-tests.js"]
  2ca394f6_a63d_3921_1f12_c5a979ea0039["test-utils.js"]
  f50170e1_d539_f9d5_a768_c073a3afcfd4 --> 2ca394f6_a63d_3921_1f12_c5a979ea0039
  f16c187c_deda_00e3_0b31_6ec7d6f81052["scrollToElement"]
  f50170e1_d539_f9d5_a768_c073a3afcfd4 --> f16c187c_deda_00e3_0b31_6ec7d6f81052
  e27f6887_ea47_dd44_7933_5faa0f6bcf4d["testFactory"]
  f50170e1_d539_f9d5_a768_c073a3afcfd4 --> e27f6887_ea47_dd44_7933_5faa0f6bcf4d
  c373140e_7fdf_7fff_8884_991b85bc22b5["waitForHydrate"]
  f50170e1_d539_f9d5_a768_c073a3afcfd4 --> c373140e_7fdf_7fff_8884_991b85bc22b5
  f8fbe851_c5d6_c4ee_c044_67a751668c18["test"]
  f50170e1_d539_f9d5_a768_c073a3afcfd4 --> f8fbe851_c5d6_c4ee_c044_67a751668c18
  bf874933_ef4a_2bc5_bd16_2d431b7f29d8["preact-compat-component.test.js"]
  bf874933_ef4a_2bc5_bd16_2d431b7f29d8 --> f50170e1_d539_f9d5_a768_c073a3afcfd4
  e0f9c0e1_45b2_bc14_f5e6_5f9a3f8658b1["preact-component.test.js"]
  e0f9c0e1_45b2_bc14_f5e6_5f9a3f8658b1 --> f50170e1_d539_f9d5_a768_c073a3afcfd4
  ca26b89d_7e4c_1d4a_a752_0c1af663e2e5["preact-lazy-component.test.js"]
  ca26b89d_7e4c_1d4a_a752_0c1af663e2e5 --> f50170e1_d539_f9d5_a768_c073a3afcfd4
  58509e9a_0843_1a93_8638_40dab034cfbb["react-component.test.js"]
  58509e9a_0843_1a93_8638_40dab034cfbb --> f50170e1_d539_f9d5_a768_c073a3afcfd4
  432fb695_0058_86b5_1bb6_f7b429f3b5e5["solid-component.test.js"]
  432fb695_0058_86b5_1bb6_f7b429f3b5e5 --> f50170e1_d539_f9d5_a768_c073a3afcfd4
  4bf6685b_d106_745b_a378_a2a1839fde1e["svelte-component.test.js"]
  4bf6685b_d106_745b_a378_a2a1839fde1e --> f50170e1_d539_f9d5_a768_c073a3afcfd4
  60876243_29ba_b94f_9ca8_3a6ab41b177b["vue-component.test.js"]
  60876243_29ba_b94f_9ca8_3a6ab41b177b --> f50170e1_d539_f9d5_a768_c073a3afcfd4
  style f50170e1_d539_f9d5_a768_c073a3afcfd4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { expect } from '@playwright/test';
import { scrollToElement, testFactory, waitForHydrate } from './test-utils.js';

export function prepareTestFactory(testFile, opts) {
	const test = testFactory(testFile, opts);

	let devServer;

	test.beforeAll(async ({ astro }) => {
		devServer = await astro.startDevServer();
	});

	test.afterAll(async () => {
		await devServer.stop();
	});

	const createTests = ({ pageUrl, pageSourceFilePath, componentFilePath, counterCssFilePath }) => {
		test('server only', async ({ page, astro }) => {
			await page.goto(astro.resolveUrl(pageUrl));

			const counter = page.locator('#server-only');
			await expect(counter, 'component is visible').toBeVisible();

			const count = counter.locator('pre');
			await expect(count, 'initial count is 0').toHaveText('0');

			const inc = counter.locator('.increment');
			await inc.click();

			await expect(count, 'component not hydrated').toHaveText('0');
		});

		test('client:idle', async ({ page, astro }) => {
			await page.goto(astro.resolveUrl(pageUrl));

			const counter = page.locator('#client-idle');
			await expect(counter, 'component is visible').toBeVisible();

			const count = counter.locator('pre');
			await expect(count, 'initial count is 0').toHaveText('0');

			await waitForHydrate(page, counter);

			const inc = counter.locator('.increment');
			await inc.click();

			await expect(count, 'count incremented by 1').toHaveText('1');
		});

		test('client:load', async ({ page, astro }) => {
			await page.goto(astro.resolveUrl(pageUrl));

			const counter = page.locator('#client-load');
			await expect(counter, 'component is visible').toBeVisible();

			const count = counter.locator('pre');
			await expect(count, 'initial count is 0').toHaveText('0');

			await waitForHydrate(page, counter);

// ... (106 more lines)

Domain

Subdomains

Frequently Asked Questions

What does shared-component-tests.js do?
shared-component-tests.js is a source file in the astro codebase, written in javascript. It belongs to the E2ETesting domain, TestFixtures subdomain.
What functions are defined in shared-component-tests.js?
shared-component-tests.js defines 1 function(s): prepareTestFactory.
What does shared-component-tests.js depend on?
shared-component-tests.js imports 5 module(s): scrollToElement, test, test-utils.js, testFactory, waitForHydrate.
What files import shared-component-tests.js?
shared-component-tests.js is imported by 7 file(s): preact-compat-component.test.js, preact-component.test.js, preact-lazy-component.test.js, react-component.test.js, solid-component.test.js, svelte-component.test.js, vue-component.test.js.
Where is shared-component-tests.js in the architecture?
shared-component-tests.js is located at packages/astro/e2e/shared-component-tests.js (domain: E2ETesting, subdomain: TestFixtures, directory: packages/astro/e2e).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free