-
Notifications
You must be signed in to change notification settings - Fork 24
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
ci: 🎡 Use docker-compose for CI #97
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/.git | ||
/.nyc_output | ||
/.tmp | ||
/node_modules | ||
/reports | ||
/REPORTS2 | ||
/coverage.lcov |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,10 @@ | ||
language: node_js | ||
node_js: | ||
- "node" | ||
sudo: required | ||
dist: trusty | ||
addons: | ||
firefox: latest | ||
apt: | ||
sources: | ||
- google-chrome | ||
packages: | ||
- google-chrome-stable | ||
- graphicsmagick | ||
|
||
before_script: | ||
- export CHROME_BIN=/usr/bin/google-chrome | ||
- export DISPLAY=:99.0 | ||
- sh -e /etc/init.d/xvfb start | ||
- npm run setup | ||
- nohup bash -c "npm run server &> selenium-server.log &" | ||
- sleep 10 | ||
after_success: | ||
- npm run coverage | ||
- npm run lint | ||
services: | ||
- docker | ||
script: | ||
- docker-compose run --rm --use-aliases app | ||
deploy: | ||
provider: npm | ||
email: [email protected] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Use the latest one as this is for CI purpose. | ||
FROM node:latest | ||
|
||
WORKDIR /app | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --no-install-recommends graphicsmagick \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY package.json . | ||
COPY package-lock.json . | ||
|
||
RUN npm install |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
version: '2' | ||
services: | ||
app: | ||
build: | ||
context: . | ||
volumes: | ||
- .:/app | ||
- /app/node_modules | ||
working_dir: /app | ||
environment: | ||
- SELENIUM_URL=http://selenium:4444/wd/hub | ||
# To have report.ci defined | ||
- TRAVIS=1 | ||
- TRAVIS_JOB_NUMBER=dummy | ||
- TRAVIS_BRANCH=dummy | ||
- TRAVIS_COMMIT=dummy | ||
- TRAVIS_TAG=dummy | ||
- TRAVIS_REPO_SLUG=dummy | ||
- TRAVIS_COMMIT_MESSAGE=dummy | ||
- TRAVIS_BUILD_ID=dummy | ||
Comment on lines
+13
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tests always fail on local environments without these definitions. |
||
command: | ||
- /bin/sh | ||
- -x | ||
- -e | ||
- -c | ||
- | | ||
sleep 10 | ||
npm test | ||
npm run coverage | ||
npm run lint | ||
depends_on: | ||
- firefox | ||
- chrome | ||
networks: | ||
- default | ||
selenium: | ||
image: selenium/hub | ||
ports: | ||
- 4444 | ||
networks: | ||
- default | ||
firefox: | ||
image: selenium/node-firefox | ||
volumes: | ||
- /dev/shm:/dev/shm | ||
depends_on: | ||
- selenium | ||
environment: | ||
- HUB_HOST=selenium | ||
networks: | ||
- default | ||
chrome: | ||
image: selenium/node-chrome | ||
volumes: | ||
- /dev/shm:/dev/shm | ||
depends_on: | ||
- selenium | ||
environment: | ||
- HUB_HOST=selenium | ||
# https://github.com/SeleniumHQ/docker-selenium/issues/87 | ||
- DBUS_SESSION_BUS_ADDRESS=/dev/null | ||
- NODE_MAX_INSTANCES=2 | ||
- NODE_MAX_SESSION=2 | ||
networks: | ||
- default |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -447,7 +447,7 @@ protractorUtil.registerJasmineReporter = function(context) { | |
prefix: '' | ||
}; | ||
global.browser.getProcessedConfig().then(function(config) { | ||
if(config.capabilities) { | ||
if (config.capabilities) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ESLint error: |
||
protractorUtil.test.prefix = '[' + config.capabilities.name + '] '; | ||
} | ||
protractorUtil.testResults.push(protractorUtil.test); | ||
|
@@ -457,7 +457,7 @@ protractorUtil.registerJasmineReporter = function(context) { | |
protractorUtil.takeOnSpecDone(result, context, protractorUtil.test); //exec async operation | ||
|
||
//Add defined name to the test.description as a prefix | ||
if(context.config.addPrefixToTests) { | ||
if (context.config.addPrefixToTests) { | ||
result.description = protractorUtil.test.prefix + result.description; | ||
result.fullName = protractorUtil.test.prefix + result.fullName; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ exports.config = { | |
seleniumAddress: env.seleniumAddress, | ||
framework: 'jasmine2', | ||
specs: ['../protractor/angularjs-homepage-disabled-test.js'], | ||
useBlockingProxy: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Somehow this causes tests fail (protractor raises an error |
||
plugins: [{ | ||
path: '../../../index.js', | ||
screenshotPath: '.tmp/bug55', | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1537,18 +1537,18 @@ describe("Screenshoter running under protractor", function() { | |
|
||
var report = getReportAsJson(data); | ||
//Since we can't guarantee which one of the test-specs will end up firts, I've to do a matcher validation between "M" and "L" letters. | ||
expect(report.tests[0].description).toMatch('\[[M|L]\] should greet the named user'); | ||
expect(report.tests[0].fullName).toMatch('\[[M|L]\] angularjs homepage should greet the named user'); | ||
expect(report.tests[1].description).toMatch('\[[M|L]\] should list todos'); | ||
expect(report.tests[1].fullName).toMatch('\[[M|L]\] angularjs homepage todo list should list todos'); | ||
expect(report.tests[2].description).toMatch('\[[M|L]\] should add a todo'); | ||
expect(report.tests[2].fullName).toMatch('\[[M|L]\] angularjs homepage todo list should add a todo'); | ||
expect(report.tests[3].description).toMatch('\[[M|L]\] should greet the named user'); | ||
expect(report.tests[3].fullName).toMatch('\[[M|L]\] angularjs homepage should greet the named user'); | ||
expect(report.tests[4].description).toMatch('\[[M|L]\] should list todos'); | ||
expect(report.tests[4].fullName).toMatch('\[[M|L]\] angularjs homepage todo list should list todos'); | ||
expect(report.tests[5].description).toMatch('\[[M|L]\] should add a todo'); | ||
expect(report.tests[5].fullName).toMatch('\[[M|L]\] angularjs homepage todo list should add a todo'); | ||
expect(report.tests[0].description).toMatch('\\[[M|L]\\] should greet the named user'); | ||
expect(report.tests[0].fullName).toMatch('\\[[M|L]\\] angularjs homepage should greet the named user'); | ||
expect(report.tests[1].description).toMatch('\\[[M|L]\\] should list todos'); | ||
expect(report.tests[1].fullName).toMatch('\\[[M|L]\\] angularjs homepage todo list should list todos'); | ||
expect(report.tests[2].description).toMatch('\\[[M|L]\\] should add a todo'); | ||
expect(report.tests[2].fullName).toMatch('\\[[M|L]\\] angularjs homepage todo list should add a todo'); | ||
expect(report.tests[3].description).toMatch('\\[[M|L]\\] should greet the named user'); | ||
expect(report.tests[3].fullName).toMatch('\\[[M|L]\\] angularjs homepage should greet the named user'); | ||
expect(report.tests[4].description).toMatch('\\[[M|L]\\] should list todos'); | ||
expect(report.tests[4].fullName).toMatch('\\[[M|L]\\] angularjs homepage todo list should list todos'); | ||
expect(report.tests[5].description).toMatch('\\[[M|L]\\] should add a todo'); | ||
expect(report.tests[5].fullName).toMatch('\\[[M|L]\\] angularjs homepage todo list should add a todo'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ESLint error: |
||
done(); | ||
}); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,14 +128,14 @@ describe("Screenshoter unit", function() { | |
|
||
it("should merge user config", function() { | ||
screenshoter.config = { | ||
screenshotPath: 'REPORTS', | ||
screenshotPath: 'REPORTS2', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
screenshotOnSpec: 'failure' | ||
}; | ||
screenshoter.setup(); | ||
expect(screenshoter.config.reportFile).toBeDefined(); | ||
delete screenshoter.config.reportFile; | ||
expect(screenshoter.config).toEqual({ | ||
screenshotPath: 'REPORTS', | ||
screenshotPath: 'REPORTS2', | ||
withLogs: true, | ||
screenshotOnExpect: 'failure+success', | ||
screenshotOnSpec: 'failure', | ||
|
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.
docker-compose
launches 4 containers:app
,selenium
,firefox
,chrome
.app
runs tests.app
connects toselenium
to launch web browsers and control them.firefox
andchrome
registers themselves toselenium
.selenium
connects tofirefox
orchromes
based on the capability specified by protractor.