Home / File/ i18n.test.js — astro Source File

i18n.test.js — astro Source File

Architecture documentation for i18n.test.js, a javascript file in the astro codebase. 3 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  2d31fdbf_68f4_c696_12fb_29b5e4450fb0["i18n.test.js"]
  2ca394f6_a63d_3921_1f12_c5a979ea0039["test-utils.js"]
  2d31fdbf_68f4_c696_12fb_29b5e4450fb0 --> 2ca394f6_a63d_3921_1f12_c5a979ea0039
  e27f6887_ea47_dd44_7933_5faa0f6bcf4d["testFactory"]
  2d31fdbf_68f4_c696_12fb_29b5e4450fb0 --> e27f6887_ea47_dd44_7933_5faa0f6bcf4d
  f8fbe851_c5d6_c4ee_c044_67a751668c18["test"]
  2d31fdbf_68f4_c696_12fb_29b5e4450fb0 --> f8fbe851_c5d6_c4ee_c044_67a751668c18
  style 2d31fdbf_68f4_c696_12fb_29b5e4450fb0 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/i18n/',
	devToolbar: {
		enabled: false,
	},
});

let devServer;

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

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

test.describe('i18n', () => {
	test('getLocaleByPath', async ({ page, astro }) => {
		await page.goto(astro.resolveUrl('/'));

		const p1 = page.locator('p').nth(0);
		await expect(p1).toHaveText('Locale: en');

		const p2 = page.locator('p').nth(1);
		await expect(p2).toHaveText('Locale: fr');

		const p3 = page.locator('p').nth(2);
		await expect(p3).toHaveText('Locale: pt-AO');
	});
});

test.describe('i18n default locale', () => {
	test('is "en" when navigating the default locale page', async ({ page, astro }) => {
		await page.goto(astro.resolveUrl('/island'));
		let el = page.getByTestId('greeting');

		await expect(el, 'element rendered').toBeVisible();
		await expect(el).toHaveText('Greeting en!');
	});

	test('is "fr" when navigating the french page', async ({ page, astro }) => {
		await page.goto(astro.resolveUrl('/fr/island'));
		let el = page.getByTestId('greeting');

		await expect(el, 'element rendered').toBeVisible();
		await expect(el).toHaveText('Greeting fr!');
	});
});

Domain

Dependencies

Frequently Asked Questions

What does i18n.test.js do?
i18n.test.js is a source file in the astro codebase, written in javascript. It belongs to the E2ETesting domain.
What does i18n.test.js depend on?
i18n.test.js imports 3 module(s): test, test-utils.js, testFactory.
Where is i18n.test.js in the architecture?
i18n.test.js is located at packages/astro/e2e/i18n.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