Skip to content

Commit

Permalink
[docs] test-links fails when it should
Browse files Browse the repository at this point in the history
  • Loading branch information
nicknovitski committed May 22, 2020
1 parent 919ba3c commit 0f614f8
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions docs/scripts/test-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,15 @@ const externalLinks = [
const browser = await puppeteer.launch();
for (const link of externalLinks) {
const page = await browser.newPage();
await page.goto(`${url}${link}`);
let response = await page.goto(`${url}${link}`);

if ((await page.$$('#__not_found')).length) {
notFound.push(link);
} else if ((await page.$$('#redirect-link')).length) {
await page.click('#redirect-link');
if ((await page.$$('#__redirect_failed')).length) {
redirectsFailed.push(link);
}

if ((await page.$$('#__not_found')).length) {
if (response.status() == 404) {
if ((await page.$$('#redirect-link')).length) {
await page.click('#redirect-link');
if ((await page.$$('#__redirect_failed')).length) {
redirectsFailed.push(link);
}
} else {
notFound.push(link);
}
}
Expand Down

0 comments on commit 0f614f8

Please sign in to comment.