-
-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run e2e test against github.com/OctoLinker/e2e/
- Loading branch information
Stefan Buck
committed
Jun 18, 2018
1 parent
3db0b6e
commit 3b4909a
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
}); | ||
}); |