Skip to content

Commit 5bf072f

Browse files
authored
fix e2e test (#600)
1 parent 1c27170 commit 5bf072f

File tree

2 files changed

+21
-28
lines changed

2 files changed

+21
-28
lines changed
Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,19 @@
11
export default async function Page() {
2-
const timeInParis = await fetch(
3-
"https://www.timeapi.io/api/time/current/zone?timeZone=Europe%2FParis",
4-
{
5-
next: {
6-
tags: ["path"],
7-
},
2+
const responseSST = await fetch("https://sst.dev", {
3+
next: {
4+
tags: ["path"],
85
},
9-
);
6+
});
107
// This one doesn't have a tag
11-
const timeInLondon = await fetch(
12-
"https://www.timeapi.io/api/time/current/zone?timeZone=Europe%2FLondon",
13-
);
14-
const timeInParisJson = await timeInParis.json();
15-
const parisTime = timeInParisJson.dateTime;
16-
const timeInLondonJson = await timeInLondon.json();
17-
const londonTime = timeInLondonJson.dateTime;
8+
const responseOpenNext = await fetch("https://opennext.js.org");
9+
const reqIdSst = responseSST.headers.get("x-amz-cf-id");
10+
const dateInOpenNext = responseOpenNext.headers.get("date");
1811
return (
1912
<div>
20-
<h1>Time in Paris</h1>
21-
<p>Paris: {parisTime}</p>
22-
<h1>Time in London</h1>
23-
<p>London: {londonTime}</p>
13+
<h1>Request id from SST</h1>
14+
<p>RequestID: {reqIdSst}</p>
15+
<h1>Date from from OpenNext</h1>
16+
<p>Date: {dateInOpenNext}</p>
2417
</div>
2518
);
2619
}

packages/tests-e2e/tests/appRouter/revalidateTag.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ test("Revalidate tag", async ({ page, request }) => {
7373
test("Revalidate path", async ({ page, request }) => {
7474
await page.goto("/revalidate-path");
7575

76-
let elLayout = page.getByText("Paris:");
77-
const initialParis = await elLayout.textContent();
76+
let elLayout = page.getByText("RequestID:");
77+
const initialReqId = await elLayout.textContent();
7878

79-
elLayout = page.getByText("London:");
80-
const initialLondon = await elLayout.textContent();
79+
elLayout = page.getByText("Date:");
80+
const initialDate = await elLayout.textContent();
8181

8282
// Send revalidate path request
8383
const result = await request.get("/api/revalidate-path");
@@ -86,11 +86,11 @@ test("Revalidate path", async ({ page, request }) => {
8686
expect(text).toEqual("ok");
8787

8888
await page.goto("/revalidate-path");
89-
elLayout = page.getByText("Paris:");
90-
const newParis = await elLayout.textContent();
91-
expect(newParis).not.toEqual(initialParis);
89+
elLayout = page.getByText("RequestID:");
90+
const newReqId = await elLayout.textContent();
91+
expect(newReqId).not.toEqual(initialReqId);
9292

93-
elLayout = page.getByText("London:");
94-
const newLondon = await elLayout.textContent();
95-
expect(newLondon).not.toEqual(initialLondon);
93+
elLayout = page.getByText("Date:");
94+
const newDate = await elLayout.textContent();
95+
expect(newDate).not.toEqual(initialDate);
9696
});

0 commit comments

Comments
 (0)