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 3db0b6e commit 3b4909a
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions e2e/automated.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const baseUrl = 'https://github.com/OctoLinker/e2e';

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
[
`${baseUrl}/blob/master/javascript/nodejs/index.js`,
`${baseUrl}/blob/master/javascript/nodejs/gentle-resonance-3436.js`,
].forEach(url => {
it(`resolves ${url}`, async () => {
await goto(url);
});
});
});

0 comments on commit 3b4909a

Please sign in to comment.