Skip to content

Commit

Permalink
test: fix blog test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yld-weng committed Feb 23, 2022
1 parent 1c7bf84 commit 6fefabd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/templates/blog/__tests__/blog.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ describe("e2e | Blog page", () => {
{ browsers: ["webkit"] },
"navigates to the second page on click the 'Older posts' button",
async () => {
await page.goto("blog", { waitUntil: "load" });
await page.waitForSelector("id=__loader", { state: "hidden" });

await Promise.all([
page.waitForNavigation({ timeout: 30000 }),
page.click('[aria-label="Older posts"]')
Expand Down
19 changes: 15 additions & 4 deletions src/templates/blog/__tests__/blogNavigation.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("e2e | Blog page", () => {

it.jestPlaywrightSkip(
{ browsers: ["webkit"] },
"navigate to other posts through prev & next buttons",
"navigate to other posts through the next button",
async () => {
await page.goto("blog/18/02/2021/Useful-Resources-for-R", {
waitUntil: "load"
Expand All @@ -34,12 +34,23 @@ describe("e2e | Blog page", () => {
expect(page.url()).not.toContain(
"/blog/18/02/2021/Useful-Resources-for-R"
);
}
);
it.jestPlaywrightSkip(
{ browsers: ["webkit"] },
"navigate to other posts through the prev button",
async () => {
await page.goto("blog/18/02/2021/Useful-Resources-for-R", {
waitUntil: "load"
});
await page.waitForSelector("id=__loader", { state: "hidden" });

await page.waitForSelector('[aria-label="Previous post"]');
const prevPost = await page.$('[aria-label="Previous post"]');

await Promise.all([prevPost.click()]);
expect(page.url()).toContain("/blog/18/02/2021/Useful-Resources-for-R");
await Promise.all([page.waitForNavigation(), prevPost.click()]);
expect(page.url()).not.toContain(
"/blog/18/02/2021/Useful-Resources-for-R"
);
}
);
});

0 comments on commit 6fefabd

Please sign in to comment.