diff --git a/playwright-report/index.html b/playwright-report/index.html new file mode 100644 index 0000000..22e6208 --- /dev/null +++ b/playwright-report/index.html @@ -0,0 +1,90 @@ + + + + + + + + + Playwright Test Report + + + + +
+ + + \ No newline at end of file diff --git a/test-results/.last-run.json b/test-results/.last-run.json new file mode 100644 index 0000000..cbcc1fb --- /dev/null +++ b/test-results/.last-run.json @@ -0,0 +1,4 @@ +{ + "status": "passed", + "failedTests": [] +} \ No newline at end of file diff --git a/tests/mocks/metric.mock.tsx b/tests/mocks/metric.mock.tsx index a56675a..be6a329 100644 --- a/tests/mocks/metric.mock.tsx +++ b/tests/mocks/metric.mock.tsx @@ -10,7 +10,7 @@ interface MetricProps { const MockMetric = ({ imgUrl, alt, value, title, textStyles }: MetricProps) => { return ( -
+
{value} {title}
diff --git a/tests/unit/components/questioncard.test.tsx b/tests/unit/components/questioncard.test.tsx index 88974f5..69c4f87 100644 --- a/tests/unit/components/questioncard.test.tsx +++ b/tests/unit/components/questioncard.test.tsx @@ -67,4 +67,26 @@ describe("QuestionCard Component", () => { }); }); }); + + it("should show timestamp on large screens", () => { + // Simulate a large screen + Object.defineProperty(window, "innerWidth", { + writable: true, + configurable: true, + value: 800, + }); + window.dispatchEvent(new Event("resize")); + + render(); + + // Check timestamp visibility + const timestampFlex = screen.getByText(relativeTimeText, { + selector: "span", + }); + expect(timestampFlex).toBeVisible(); + + // Check metrics visibility + const metric = screen.getAllByTestId("metric")[0]; + expect(metric).toBeVisible(); + }); });