Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 102 additions & 4 deletions assets/template/fixtures/slide-fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,39 @@ const slideFixtures = [
resourceAvailableText: "Lokalet er frit.",
displayHeaders: true,
resourceUnavailableText: "Det er optaget",
// image: ["/v1/media/00000000000000000000000001"],
image: [],
footerText: "Se mere på localhost/events",
fontSize: "font-size-m",
},
},
{
id: "calendar-1-multiple",
id: "calendar-1-multiple-days",
templateData: {
id: "01FRJPF4XATRN8PBZ35XN84PS6",
},
themeFile: null,
feedData: [],
mediaData: {
"/v1/media/00000000000000000000000001": {
assets: {
uri: "/fixtures/template/images/mountain1.jpeg",
},
},
},
content: {
duration: 5000,
// Options: multiple|multipleDays|single
layout: "multipleDays",
hasDateAndTime: false,
title: "Kalender",
subTitle: "Underoverskrift",
displayHeaders: false,
image: ["/v1/media/00000000000000000000000001"],
fontSize: "font-size-xl",
},
},
{
id: "calendar-0-multiple",
templateData: {
id: "01FRJPF4XATRN8PBZ35XN84PS6",
},
Expand Down Expand Up @@ -446,15 +471,62 @@ const slideFixtures = [
resourceAvailableText: "Lokalet er frit.",
displayHeaders: true,
resourceUnavailableText: "Det er optaget",
// image: ["/v1/media/00000000000000000000000001"],
footerText: "Se mere på localhost/events",
dateAsBox: false,
hideGrid: true,
fontSize: "font-size-xl",
},
},
{
id: "calendar-2-single",
id: "calendar-1-multiple",
templateData: {
id: "01FRJPF4XATRN8PBZ35XN84PS6",
},
themeFile: null,
feedData: [],
mediaData: {
"/v1/media/00000000000000000000000001": {
assets: {
uri: "/fixtures/template/images/mountain1.jpeg",
},
},
},
content: {
image: ["/v1/media/00000000000000000000000001"],
duration: 5000,
layout: "multiple",
hasDateAndTime: true,
displayHeaders: true,
hideGrid: false,
fontSize: "font-size-xs",
},
},
{
id: "calendar-2-multiple",
templateData: {
id: "01FRJPF4XATRN8PBZ35XN84PS6",
},
themeFile: null,
feedData: [],
mediaData: {
"/v1/media/00000000000000000000000001": {
assets: {
uri: "/fixtures/template/images/mountain1.jpeg",
},
},
},
content: {
image: ["/v1/media/00000000000000000000000001"],
duration: 5000,
layout: "multiple",
hasDateAndTime: false,
displayHeaders: true,
hideGrid: false,
fontSize: "font-size-xs",
},
},
{
id: "calendar-0-single",
templateData: {
id: "01FRJPF4XATRN8PBZ35XN84PS6",
},
Expand Down Expand Up @@ -558,6 +630,32 @@ const slideFixtures = [
fontSize: "font-size-xl",
},
},
{
id: "calendar-1-single",
templateData: {
id: "01FRJPF4XATRN8PBZ35XN84PS6",
},
themeFile: null,
feedData: [],
mediaData: {
"/v1/media/00000000000000000000000001": {
assets: {
uri: "/fixtures/template/images/mountain1.jpeg",
},
},
},
content: {
duration: 5000,
layout: "single",
mediaContain: false,
title: "Kalender",
subTitle: "Underoverskrift",
resourceAvailableText: "Lokalet er frit.",
resourceUnavailableText: "Det er optaget",
image: ["/v1/media/00000000000000000000000001"],
fontSize: "font-size-xl",
},
},
{
id: "calendar-3-multiple-days",
templateData: {
Expand Down
166 changes: 152 additions & 14 deletions assets/tests/template/template-calendar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const fixTime = async (page) => {
await page.clock.install({ time: newDate });
};

test("Calendar 0", async ({ page }) => {
test("calendar-0-multiple-days: ui tests", async ({ page }) => {
await fixTime(page);

await page.goto("/template/calendar-0-multiple-days");
Expand All @@ -18,45 +18,183 @@ test("Calendar 0", async ({ page }) => {
await expect(page.getByText("Det tomme rum")).toBeVisible();
await expect(page.getByText("Cake is gone")).toBeVisible();
await expect(page.getByText("Det fulde rum")).toBeVisible();
await expect(page.getByText("Se mere på localhost/events")).toBeVisible();

await expect(page.locator(".content > section")).toHaveCount(5);
await expect(page.locator(".font-size-m")).toHaveCount(1);

await expect(page.locator(".calendar-multiple-days")).toHaveCSS(
"--bg-image",
"",
);
});

test("Calendar 1", async ({ page }) => {
test("calendar-1-multiple-days: ui tests", async ({ page }) => {
await fixTime(page);

await page.goto("/template/calendar-1-multiple");
await page.goto("/template/calendar-1-multiple-days");

await expect(page.getByText("Cake is in the past")).toHaveCount(0);
await expect(page.locator(".content")).toBeEmpty();
await expect(page.locator(".footer")).toHaveCount(0);
await expect(page.locator(".font-size-xl")).toHaveCount(1);
await expect(page.locator(".calendar-multiple-days")).toHaveCSS(
"--bg-image",
new RegExp("/fixtures/template/images/mountain1.jpeg"),
);
});

test("calendar-0-multiple: ui test", async ({ page }) => {
await fixTime(page);

await page.goto("/template/calendar-0-multiple");

// hideGrid true
await expect(page.locator(".content-item").nth(1)).toHaveCSS(
"border-bottom",
"0px none rgb(0, 0, 0)",
);
await expect(page.locator(".content-item").nth(1)).toHaveCSS(
"border-right",
"0px none rgb(0, 0, 0)",
);
await expect(page.locator(".content-item").nth(1)).toHaveCSS(
"border-left",
"0px none rgb(0, 0, 0)",
);
await expect(page.locator(".content-item").nth(1)).toHaveCSS(
"border-top",
"0px none rgb(0, 0, 0)",
);
await expect(page.locator(".header-title")).toHaveText(
"Møder i dag på Bautavej",
);

// fontSize: "font-size-xl"
await expect(page.locator(".font-size-xl")).toHaveCount(1);

// hasDateAndTime: true
// dateAsBox: false,
await expect(page.locator(".header-date")).toHaveCount(1);
await expect(page.locator(".header-date-box")).toHaveCount(0);
await expect(page.locator(".header-date")).toHaveText(new RegExp("06:"));

await expect(page.getByText("Cake is in the past")).toHaveCount(0);
await expect(page.locator(".content-item")).toHaveCount(3);
await expect(page.getByText("Hvad")).toBeVisible();
await expect(page.getByText("Hvornår")).toBeVisible();

// headerOrder: "whatwherewhen",
await expect(page.getByText("Hvad", { exact: true })).toHaveCSS("order", "1");
await expect(page.getByText("Hvor", { exact: true })).toHaveCSS("order", "2");
await expect(page.getByText("Hvornår", { exact: true })).toHaveCSS(
"order",
"3",
);

await expect(page.getByText("Det tredje rum")).toBeVisible();
await expect(page.getByText("Coffee")).toBeVisible();
});

test("Calendar 2", async ({ page }) => {
test("calendar-1-multiple: ui test", async ({ page }) => {
await fixTime(page);

await page.goto("/template/calendar-2-single");
await page.goto("/template/calendar-1-multiple");

await expect(page.getByText("Kalender")).toBeVisible();
await expect(page.getByText("Underoverskrift")).toBeVisible();
await expect(page.getByText("Cake is a lie")).toBeVisible();
await expect(page.getByText("Cake is in the past")).toHaveCount(0);

await expect(page.locator(".header-title")).toHaveCount(1);
await expect(page.locator(".header-title")).toHaveText("");

// hideGrid false
await expect(page.locator(".content-item").nth(1)).toHaveCSS(
"border-bottom",
"1px solid rgb(26, 26, 26)",
);
await expect(page.locator(".content-item").nth(1)).toHaveCSS(
"border-right",
"0px none rgb(0, 0, 0)",
);
await expect(page.locator(".content-item").nth(1)).toHaveCSS(
"border-left",
"1px solid rgb(26, 26, 26)",
);
await expect(page.locator(".content-item").nth(1)).toHaveCSS(
"border-top",
"0px none rgb(0, 0, 0)",
);

// headerOrder: null, (default when what where)
await expect(page.getByText("Hvornår", { exact: true })).toHaveCSS(
"order",
"1",
);
await expect(page.getByText("Hvad", { exact: true })).toHaveCSS("order", "2");
await expect(page.getByText("Hvor", { exact: true })).toHaveCSS("order", "3");

// fontSize: "font-size-xs"
await expect(page.locator(".font-size-xs")).toHaveCount(1);

// hasDateAndTime: true
// dateAsBox: true,
await expect(page.locator(".header-date")).toHaveCount(1);
await expect(page.locator(".header-date-box")).toHaveCount(0);
await expect(page.locator(".header-date")).toHaveText(new RegExp("06:"));

await expect(page.locator(".content-item")).toHaveCount(3);
});

test("Calendar 3", async ({ page }) => {
test("calendar-2-multiple: ui test", async ({ page }) => {
await fixTime(page);

await page.goto("/template/calendar-3-multiple-days");
await page.goto("/template/calendar-2-multiple");

// TODO
// hasDateAndTime: false
// dateAsBox: false,
await expect(page.locator(".header-date")).toHaveCount(0);
await expect(page.locator(".header-date-box")).toHaveCount(0);
});

test("calendar-0-single: ui tests", async ({ page }) => {
await fixTime(page);

await page.goto("/template/calendar-0-single");

const title = page.locator(".title");
const subtitle = page.locator(".subtitle");

await expect(title).toHaveText("Kalender");
await expect(subtitle).toHaveText("Underoverskrift");
const items = page.locator(".content-item");

await expect(items).toHaveCount(3);

await expect(items.nth(0)).toContainText("07:30 - 08:00Cake is a lie");

await expect(items.nth(1)).toContainText("07:30 - 08:00Cake");

await expect(items.nth(2)).toContainText("08:00 - 09:00Det er optaget");

await expect(page.locator(".media-contain")).toHaveCount(1);
await expect(page.locator(".template-calendar")).toHaveCSS(
"--bg-image",
new RegExp("/fixtures/template/images/mountain1.jpeg"),
);
await expect(page.locator(".content-item").nth(1)).toHaveCSS(
"border-left",
"1px solid rgb(26, 26, 26)",
);
await expect(page.locator(".media-contain")).toHaveCount(1);
});

test("calendar-1-single: ui tests", async ({ page }) => {
await fixTime(page);

await page.goto("/template/calendar-1-single");

const title = page.locator(".title");
const subtitle = page.locator(".subtitle");

await expect(title).toHaveText("Kalender");
await expect(subtitle).toHaveText("Underoverskrift");
await expect(page.locator(".media-contain")).toHaveCount(0);
});

test("Calendar 4", async ({ page }) => {
Expand Down
7 changes: 6 additions & 1 deletion assets/tests/template/template-main.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ test.describe("Template Links", () => {
const templateIds = [
"book-review-0",
"calendar-0-multiple-days",
"calendar-1-multiple-days",
"calendar-0-multiple",
"calendar-1-multiple",
"calendar-2-single",
"calendar-2-multiple",
"calendar-0-single",
"calendar-1-single",
"calendar-3-multiple-days",
"calendar-4-single-booking",
"contacts-underlined",
Expand All @@ -33,6 +37,7 @@ test.describe("Template Links", () => {
"instagram-0",
"instagram-1-no-max-entries",
"news-feed-0",
"news-feed-no-media-contain",
"poster-0-single",
"poster-0-single-override",
"poster-1-subscription",
Expand Down
Loading