Home / File/ csp-client-only.test.js — astro Source File

csp-client-only.test.js — astro Source File

Architecture documentation for csp-client-only.test.js, a javascript file in the astro codebase. 3 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  20395043_ce3b_0078_87ee_3f662914652a["csp-client-only.test.js"]
  2ca394f6_a63d_3921_1f12_c5a979ea0039["test-utils.js"]
  20395043_ce3b_0078_87ee_3f662914652a --> 2ca394f6_a63d_3921_1f12_c5a979ea0039
  e27f6887_ea47_dd44_7933_5faa0f6bcf4d["testFactory"]
  20395043_ce3b_0078_87ee_3f662914652a --> e27f6887_ea47_dd44_7933_5faa0f6bcf4d
  f8fbe851_c5d6_c4ee_c044_67a751668c18["test"]
  20395043_ce3b_0078_87ee_3f662914652a --> f8fbe851_c5d6_c4ee_c044_67a751668c18
  style 20395043_ce3b_0078_87ee_3f662914652a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

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

const test = testFactory(import.meta.url, {
	root: './fixtures/client-only/',
	security: {
		csp: true,
	},
});

let previewServer;

test.beforeAll(async ({ astro }) => {
	await astro.build();
	previewServer = await astro.preview();
});

test.afterAll(async () => {
	await previewServer.stop();
});
test.describe('CSP Client only', () => {
	test('React counter', async ({ astro, page }) => {
		await page.goto(astro.resolveUrl('/'));

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

		const fallback = await page.locator('[data-fallback=react]');
		await expect(fallback, 'fallback content is hidden').not.toBeVisible();

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

		const children = await counter.locator('.children');
		await expect(children, 'children exist').toHaveText('react');

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

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

	test('Preact counter', async ({ astro, page }) => {
		await page.goto(astro.resolveUrl('/'));

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

		const fallback = await page.locator('[data-fallback=preact]');
		await expect(fallback, 'fallback content is hidden').not.toBeVisible();

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

		const children = await counter.locator('.children');
		await expect(children, 'children exist').toHaveText('preact');

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

// ... (67 more lines)

Domain

Dependencies

Frequently Asked Questions

What does csp-client-only.test.js do?
csp-client-only.test.js is a source file in the astro codebase, written in javascript. It belongs to the E2ETesting domain.
What does csp-client-only.test.js depend on?
csp-client-only.test.js imports 3 module(s): test, test-utils.js, testFactory.
Where is csp-client-only.test.js in the architecture?
csp-client-only.test.js is located at packages/astro/e2e/csp-client-only.test.js (domain: E2ETesting, directory: packages/astro/e2e).

Analyze Your Own Codebase

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

Try Supermodel Free