Skip to content

Commit 4abe2c2

Browse files
authored
Add: Add star and for button to Monika product card (#127)
* Add: Add star and for button to Monika product card * fix test e2e * fix e2e timeout * change port e2e
1 parent 10296e6 commit 4abe2c2

File tree

4 files changed

+25
-23
lines changed

4 files changed

+25
-23
lines changed

.github/workflows/e2e.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
e2e:
1111
runs-on: ubuntu-latest
12-
timeout-minutes: 15
12+
timeout-minutes: 30
1313

1414
steps:
1515
- name: Checkout

app/[lang]/(hyperjump)/products/data.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ export function getCommercialProduct(lang: SupportedLanguage) {
2828
title: ourProductsCommercialData3Title(lang),
2929
description: ourProductsCommercialData3Text(lang),
3030
image: "/images/open-source/monika.svg",
31-
url: "https://monika.hyperjump.tech/"
31+
url: "https://monika.hyperjump.tech/",
32+
repoUrl: "https://github.com/hyperjumptech/monika",
33+
button: true,
34+
repo: "monika"
3235
}
3336
];
3437
}

app/[lang]/(hyperjump)/products/page.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,13 @@ import {
33
type SupportedLanguage
44
} from "@/locales/.generated/types";
55
import {
6-
mainViewMore,
76
ourProductsHeroDesc,
87
ourProductsHeroHeading
98
} from "@/locales/.generated/server";
109
import { Metadata } from "next";
1110
import { dynamicOpengraph } from "@/lib/default-metadata";
12-
import GridItemsContainer, {
13-
GridItems,
14-
GridItemsMoreButton
15-
} from "@/app/components/grid-items";
11+
import GridItemsContainer, { GridItems } from "@/app/components/grid-items";
1612
import { getCommercialProduct, getOpenSource } from "./data";
17-
import data from "@/data.json";
1813

1914
export const generateStaticParams = async () => {
2015
return supportedLanguages.map((lang) => ({ lang }));
@@ -53,7 +48,7 @@ export default async function OurProductsPage({ params }: OurProductsProps) {
5348
return (
5449
<main className="bg-white">
5550
<Hero lang={lang} />
56-
<div className="xxl:max-w-7xl mx-auto flex w-full max-w-6xl flex-wrap items-center justify-center px-4 pb-6 md:px-20 xl:px-0">
51+
<div className="xxl:max-w-7xl mx-auto -mt-10 flex w-full max-w-6xl flex-wrap items-center justify-center px-2 pb-6 md:px-20 xl:px-0">
5752
<ProductCommercial lang={lang} />
5853
<OpenSourceProducts lang={lang} />
5954
</div>
@@ -65,7 +60,7 @@ function Hero({ lang }: { lang: SupportedLanguage }) {
6560
return (
6661
<section
6762
id="hero"
68-
className="bg-services-hero text-hyperjump-black relative h-[451px] w-full px-4 text-center">
63+
className="bg-services-hero text-hyperjump-black relative h-[415px] w-full px-4 text-center">
6964
<div className="mx-auto flex h-full max-w-3xl flex-col items-center justify-center pt-12">
7065
<h1
7166
className="text-hyperjump-black mb-4 text-3xl font-medium sm:text-4xl md:text-[40px]"

e2e/case-study-detail.spec.ts

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect } from "@playwright/test";
1+
import { test, expect, Page } from "@playwright/test";
22
import { getCaseStudies } from "@/app/[lang]/(hyperjump)/case-studies/data";
33

44
// Base URL
@@ -28,32 +28,36 @@ const viewports = [
2828
] as const;
2929

3030
// Utility: assert all images load (no broken images)
31-
async function expectAllImagesLoaded(page: import("@playwright/test").Page) {
31+
export async function expectAllImagesLoaded(page: Page) {
3232
await page.waitForLoadState("networkidle");
3333
const main = page.locator("main");
3434
const images = main.locator('img, [style*="background-image"], image');
3535
const count = await images.count();
36-
if (count === 0) {
37-
return;
38-
}
36+
37+
if (count === 0) return;
38+
3939
for (let i = 0; i < count; i++) {
4040
const el = images.nth(i);
4141
const tag = await el.evaluate((n) => n.tagName.toLowerCase());
42+
43+
await expect(el, `Image #${i} not visible`).toBeVisible({ timeout: 5000 });
44+
4245
if (tag === "img" || tag === "image") {
43-
await expect(el).toBeVisible();
44-
// Ensure naturalWidth > 0
4546
const ok = await el.evaluate(
4647
(img: HTMLImageElement | SVGImageElement) => {
47-
// @ts-ignore
48-
const nw = (img as any).naturalWidth ?? 1; // SVGImageElement may not have naturalWidth
48+
// @ts-ignore — handle both <img> and SVG <image>
49+
const nw = (img as any).naturalWidth ?? 1;
4950
// @ts-ignore
5051
const nh = (img as any).naturalHeight ?? 1;
51-
return (nw > 0 && nh > 0) || (img as any).href?.baseVal; // allow SVG xlink:href
52+
// @ts-ignore
53+
const href = (img as any).href?.baseVal ?? (img as any).src ?? null;
54+
return (nw > 0 && nh > 0) || Boolean(href);
5255
}
5356
);
54-
expect(ok, "image failed to load or has zero natural size").toBeTruthy();
55-
} else {
56-
await expect(el).toBeVisible();
57+
expect(
58+
ok,
59+
`Image #${i} failed to load or has 0x0 natural size`
60+
).toBeTruthy();
5761
}
5862
}
5963
}

0 commit comments

Comments
 (0)