-
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #317 from jankapunkt/improve-tests
- Loading branch information
Showing
13 changed files
with
270 additions
and
4 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 @@ | ||
version: 2.1 | ||
|
||
commands: | ||
install: | ||
description: Install puppeteer and headless chrome | ||
steps: | ||
- run: | ||
name: Install Headless Chrome dependencies | ||
command: | | ||
sudo apt-get install -yq \ | ||
gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \ | ||
libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \ | ||
libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 \ | ||
libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates \ | ||
fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget | ||
- run: | ||
name: Install puppeteer with chronium | ||
command: | | ||
npm i puppeteer | ||
jobs: | ||
Blaze Tests: | ||
steps: | ||
- checkout | ||
- run: | ||
name: running ci | ||
command: | | ||
cd test-app | ||
./ci.sh |
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 |
---|---|---|
|
@@ -3,3 +3,6 @@ Thumbs.db | |
db.json | ||
*.log | ||
.idea | ||
test-app/packages | ||
node_modules | ||
package-lock.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,19 @@ | ||
# This file contains information which helps Meteor properly upgrade your | ||
# app when you run 'meteor update'. You should check it into version control | ||
# with your project. | ||
|
||
notices-for-0.9.0 | ||
notices-for-0.9.1 | ||
0.9.4-platform-file | ||
notices-for-facebook-graph-api-2 | ||
1.2.0-standard-minifiers-package | ||
1.2.0-meteor-platform-split | ||
1.2.0-cordova-changes | ||
1.2.0-breaking-changes | ||
1.3.0-split-minifiers-package | ||
1.4.0-remove-old-dev-bundle-link | ||
1.4.1-add-shell-server-package | ||
1.4.3-split-account-service-packages | ||
1.5-add-dynamic-import-package | ||
1.7-split-underscore-from-meteor-base | ||
1.8.3-split-jquery-from-blaze |
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 @@ | ||
local |
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 @@ | ||
# This file contains a token that is unique to your project. | ||
# Check it into your repository along with the rest of this directory. | ||
# It can be used for purposes such as: | ||
# - ensuring you don't accidentally deploy one app on top of another | ||
# - providing package authors with aggregated statistics | ||
|
||
ourgjhbe7m.zzee6dwnngho |
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,19 @@ | ||
# Meteor packages used by this project, one per line. | ||
# Check this file (and the other files in this directory) into your repository. | ||
# | ||
# 'meteor add' and 'meteor remove' will edit this file for you, | ||
# but you can also edit it by hand. | ||
|
||
[email protected] # Packages every Meteor app needs to have | ||
[email protected] # Packages for a great mobile UX | ||
[email protected] # The database Meteor supports right now | ||
static-html # Define static page content in .html files | ||
[email protected] # Reactive variable for tracker | ||
[email protected] # Meteor's client-side reactive programming library | ||
|
||
[email protected] # CSS minifier run for production mode | ||
[email protected] # JS minifier run for production mode | ||
[email protected] # ECMAScript 5 compatibility for older browsers | ||
[email protected] # Enable ECMAScript2015+ syntax in app code | ||
[email protected] # Enable TypeScript syntax in .ts and .tsx modules | ||
[email protected] # Server-side component of the `meteor shell` command |
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,2 @@ | ||
server | ||
browser |
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 @@ | ||
[email protected] |
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,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
meteor npm install | ||
|
||
export URL='http://localhost:4096/' | ||
|
||
exec 3< <(meteor test-packages --driver-package test-in-console -p 4096 --exclude ${TEST_PACKAGES_EXCLUDE:-''}) | ||
EXEC_PID=$! | ||
|
||
sed '/test-in-console listening$/q' <&3 | ||
|
||
meteor node puppeteerRunner.js | ||
|
||
STATUS=$? | ||
|
||
pkill -TERM -P $EXEC_PID | ||
exit $STATUS |
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,70 @@ | ||
const puppeteer = require('puppeteer'); | ||
|
||
async function runNextUrl(browser) { | ||
const page = await browser.newPage(); | ||
|
||
page.on('console', msg => { | ||
console.log(msg._text); | ||
}); | ||
|
||
if (!process.env.URL) { | ||
process.exit(1); | ||
return; | ||
} | ||
|
||
await page.goto(process.env.URL); | ||
|
||
async function poll() { | ||
if (await isDone(page)) { | ||
let failCount = await getFailCount(page); | ||
if (failCount > 0) { | ||
await page.close(); | ||
await browser.close(); | ||
process.exit(1); | ||
} else { | ||
await page.close(); | ||
await browser.close(); | ||
process.exit(0); | ||
} | ||
} else { | ||
setTimeout(poll, 1000); | ||
} | ||
} | ||
|
||
poll(); | ||
} | ||
|
||
async function isDone(page) { | ||
return await page.evaluate(function() { | ||
if (typeof TEST_STATUS !== 'undefined') { | ||
return TEST_STATUS.DONE; | ||
} | ||
|
||
return typeof DONE !== 'undefined' && DONE; | ||
}); | ||
} | ||
|
||
async function getFailCount(page) { | ||
return await page.evaluate(function() { | ||
if (typeof TEST_STATUS !== 'undefined') { | ||
return TEST_STATUS.FAILURES; | ||
} | ||
|
||
if (typeof FAILURES === 'undefined') { | ||
return 1; | ||
} | ||
|
||
return 0; | ||
}); | ||
} | ||
|
||
async function runTests() { | ||
console.log(`Running test with Puppeteer at ${process.env.URL}`); | ||
|
||
// --no-sandbox and --disable-setuid-sandbox must be disabled for CI compatibility | ||
const browser = await puppeteer.launch({ args: ['--no-sandbox', '--disable-setuid-sandbox'] }); | ||
console.log(`Using version: ${await browser.version()}`); | ||
runNextUrl(browser); | ||
} | ||
|
||
runTests(); |