Skip to content

Commit

Permalink
test: skip i18n tests
Browse files Browse the repository at this point in the history
  • Loading branch information
katharinawuensche committed Sep 24, 2024
1 parent 2784a3a commit 1bad27d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 22 deletions.
3 changes: 2 additions & 1 deletion config/i18n.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import type { LocaleObject } from "vue-i18n-routing";
import type de from "@/messages/de.json";
import type en from "@/messages/en.json";

export const locales = ["de"] as const;
export const locales = ["de", "en"] as const;

export type Locale = (typeof locales)[number];

export const defaultLocale: Locale = "de";

export const localesMap = {
de: { code: "de", iso: "de", file: "de.json" },
en: { code: "en", iso: "en", file: "en.json" },
} satisfies Record<Locale, LocaleObject>;

export type Messages = typeof de;
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/app/analytics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (process.env.NUXT_PUBLIC_MATOMO_BASE_URL && process.env.NUXT_PUBLIC_MATOMO_ID
test.describe("analytics service", () => {
test("should track page views", async ({ page }) => {
const initialResponsePromise = page.waitForResponse(baseUrl);
await page.goto("/en");
await page.goto("/de");
const initialResponse = await initialResponsePromise;
expect(initialResponse.status()).toBe(204);

Expand Down
24 changes: 12 additions & 12 deletions e2e/tests/app/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ test.describe("app", () => {
test.use({ colorScheme: "no-preference" });

test("with no preference", async ({ page }) => {
await page.goto("/en");
await page.goto("/de");
await expect(page.locator("html")).toHaveAttribute("data-ui-color-scheme", "light");
});
});
Expand All @@ -116,7 +116,7 @@ test.describe("app", () => {
test.use({ colorScheme: "light" });

test("in light mode", async ({ page }) => {
await page.goto("/en");
await page.goto("/de");
await expect(page.locator("html")).toHaveAttribute("data-ui-color-scheme", "light");
});
});
Expand All @@ -125,21 +125,21 @@ test.describe("app", () => {
test.use({ colorScheme: "dark" });

test("in dark mode", async ({ page }) => {
await page.goto("/en");
await page.goto("/de");
await expect(page.locator("html")).toHaveAttribute("data-ui-color-scheme", "dark");
});
});

// test("should skip to main content with skip-link", async ({ createIndexPage }) => {
// const locale = "en";
test.skip("should skip to main content with skip-link", async ({ createIndexPage }) => {
const locale = "en";

// const { indexPage } = await createIndexPage(locale);
// await indexPage.goto();
const { indexPage } = await createIndexPage(locale);
await indexPage.goto();

// await indexPage.page.keyboard.press("Tab");
// await expect(indexPage.skipLink).toBeFocused();
await indexPage.page.keyboard.press("Tab");
await expect(indexPage.skipLink).toBeFocused();

// await indexPage.skipLink.click();
// await expect(indexPage.mainContent).toBeFocused();
// });
await indexPage.skipLink.click();
await expect(indexPage.mainContent).toBeFocused();
});
});
5 changes: 3 additions & 2 deletions e2e/tests/app/i18n.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ test.describe("i18n", () => {
await expect(page.getByRole("heading", { name: "Seite nicht gefunden" })).toBeVisible();
});

test("should support switching locale", async ({ page }) => {
// use only one locale at the moment
test.skip("should support switching locale", async ({ page }) => {
await page.goto("/de/imprint");
await expect(page).toHaveURL("/de/imprint");
await expect(page.getByRole("heading", { name: "Impressum" })).toBeVisible();
Expand All @@ -70,7 +71,7 @@ test.describe("i18n", () => {
}
});

test("should set alternate links in link tags", async ({ page }) => {
test.skip("should set alternate links in link tags", async ({ page }) => {
function createAbsoluteUrl(pathname: string) {
return String(createUrl({ baseUrl, pathname }));
}
Expand Down
6 changes: 3 additions & 3 deletions e2e/tests/app/metadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ test("should disallow indexing of not-found page", async ({ page }) => {
});

test.describe("should set page metadata", () => {
test("static", async ({ page }) => {
test.skip("static", async ({ page }) => {
await page.goto("/en");

const ogType = page.locator('meta[property="og:type"]');
Expand All @@ -55,7 +55,7 @@ test.describe("should set page metadata", () => {
// await expect(googleSiteVerification).toHaveAttribute("content", "");
});

test("with en locale", async ({ page }) => {
test.skip("with en locale", async ({ page }) => {
await page.goto("/en");

await expect(page).toHaveTitle("Home | SiCProD");
Expand Down Expand Up @@ -99,7 +99,7 @@ test.describe("should set page metadata", () => {
});

test.describe("should add json+ld metadata", () => {
test("with en locale", async ({ page }) => {
test.skip("with en locale", async ({ page }) => {
await page.goto("/en");

const metadata = await page.locator('script[type="application/ld+json"]').textContent();
Expand Down
6 changes: 3 additions & 3 deletions server/routes/manifest.webmanifest.get.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createI18n } from "vue-i18n";

import en from "@/messages/en.json";
import de from "@/messages/de.json";

const locale = "en";
const locale = "de";

const { t } = createI18n({ legacy: false, locale, messages: { en } }).global;
const { t } = createI18n({ legacy: false, locale, messages: { de } }).global;

const manifest = {
name: t("Manifest.name"),
Expand Down

0 comments on commit 1bad27d

Please sign in to comment.