Skip to content

Commit

Permalink
Run e2e test against github.com/OctoLinker/e2e/
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Buck committed Jun 18, 2018
1 parent e6104a6 commit 5563f63
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions e2e/automated.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
async function goto(url) {
await page.goto(url);
await page.waitForSelector('.octolinker-link');

// TODO Allow annotations beyond the first line
const annotation = await page.$eval('#LC1', el => el.textContent);
const targetPath = annotation
.replace('// Should resolve to: ', '')
.replace('<root>', '');

await page.click('.octolinker-link');
await page.waitForNavigation();

await expect(page.url()).toEqual(expect.stringMatching(targetPath));
}

describe('End to End tests', () => {
// TODO scrape https://github.com/OctoLinker/e2e/ for those urls
[
'https://github.com/OctoLinker/e2e/blob/master/javascript/nodejs/index.js',
'https://github.com/OctoLinker/e2e/blob/master/javascript/nodejs/gentle-resonance-3436.js',
].forEach(url => {
it(`resolves ${url}`, async () => {
await goto(url);
});
});
});

0 comments on commit 5563f63

Please sign in to comment.