-
-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add End 2 End tests #477
Merged
Merged
Add End 2 End tests #477
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3db0b6e
Basic setup to run e2e tests on CI
3b4909a
Run e2e test against github.com/OctoLinker/e2e/
403143c
Scrape e2e repo for urls
16e99ea
Run e2e tests
0c8dd8d
Get fixtures from e2e repo
d478118
Remove not longer needed package node-fetch
b5afde3
Add e2e fixtures
c700f67
Generate fixtures resource file
5fbc90b
Add E2E readme file
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -4,3 +4,4 @@ lerna-debug.log | |
|
||
dist/ | ||
out/ | ||
e2e/fixtures.json |
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
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,5 @@ | ||
module.exports = { | ||
globals: { | ||
page: true | ||
} | ||
} |
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,25 @@ | ||
const fixtures = require('./fixtures.json'); // eslint-disable-line import/no-unresolved | ||
|
||
async function executeTest(url, lineNumber, targetUrl) { | ||
const selector = `#LC${lineNumber} .octolinker-link`; | ||
|
||
await page.goto(url); | ||
|
||
await page.waitForSelector(selector); | ||
|
||
await Promise.all([ | ||
page.waitForNavigation(), | ||
// page.click(selector), for some reason page.click is not working | ||
page.$eval(selector, el => el.click()), | ||
]); | ||
|
||
await expect(page.url()).toEqual(expect.stringMatching(targetUrl)); | ||
} | ||
|
||
describe('End to End tests', () => { | ||
fixtures.forEach(({ url, content, lineNumber, targetUrl }) => { | ||
it(`resolves ${content} to ${targetUrl}`, async () => { | ||
await executeTest(url, lineNumber, targetUrl); | ||
}); | ||
}); | ||
}); |
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,4 @@ | ||
module.exports = { | ||
preset: 'jest-puppeteer', | ||
testMatch: ['<rootDir>/**/?(*.)test?(s).js'], | ||
}; |
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,15 @@ | ||
const path = require('path'); | ||
|
||
const extPath = path.join(__dirname, './dist'); | ||
|
||
module.exports = { | ||
launch: { | ||
dumpio: true, | ||
headless: false, | ||
args: [ | ||
'--no-sandbox', | ||
`--disable-extensions-except=${extPath}`, | ||
`--load-extension=${extPath}`, | ||
], | ||
}, | ||
}; |
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,7 @@ | ||
module.exports = { | ||
testPathIgnorePatterns: ['<rootDir>/e2e/'], | ||
setupFiles: ['<rootDir>/_jestsetup.js'], | ||
moduleNameMapper: { | ||
'\\.css$': '<rootDir>/__mocks__/styleMock.js', | ||
}, | ||
}; |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puppeteer headless doesn't support extensions, right now.
puppeteer/puppeteer#2819 (comment)