Skip to content

Commit

Permalink
feat(generator): use Chrome for unit testing and visual regression te…
Browse files Browse the repository at this point in the history
…sting

Remove PhantomJS dependency from all projects

ISSUES CLOSED: #124
  • Loading branch information
uglow committed Aug 31, 2017
1 parent 4d1a88e commit 013f30d
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 32 deletions.
2 changes: 1 addition & 1 deletion lib/buildTool/codecept/codeceptResources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ testSystem:
features:

templateFiles:
- src: codeceptHelper.js
- src: helpers/codeceptHelper.js
dest: <%= paths.config.configDir + resources.confitLib.configSubDir%>codecept/helper.js
overwrite: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ let config = {
testReportFileName: vis-reg-unit.xml
testSuiteName: 'backstopJS'
}
engine: 'phantomjs',
engine: 'chrome',
report: ['CLI', 'browser', 'CI'],
casperFlags: [
'--ignore-ssl-errors=true',
Expand Down
Empty file.
19 changes: 14 additions & 5 deletions lib/buildTool/webpack/testUnit/templates/karma.common.js.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,24 @@ let karmaConfig = {
// web server default port
port: 8081,
// Start these browsers, currently available:
// - Chrome, ChromeCanary, Firefox, Opera, Safari (only Mac), PhantomJS, IE (only Windows)
// Browser to test with
browsers: [
'PhantomJS'
'ChromeHeadless'
],
customLaunchers: {
ChromeHeadless: {
base: 'Chrome',
flags: [
'--no-sandbox',
// See https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md
'--headless',
'--disable-gpu',
'--remote-debugging-port=9222',
],
},
},

plugins: [
'karma-phantomjs-launcher',
'karma-jasmine',
'karma-junit-reporter',
'karma-coverage',
Expand All @@ -71,7 +81,6 @@ let karmaConfig = {
],

files: [
'node_modules/phantomjs-polyfill/bind-polyfill.js',
'<%- paths.config.configDir + resources.testUnit.configSubDir %>test.files.js'
],

Expand Down
2 changes: 2 additions & 0 deletions lib/buildTool/webpack/testUnit/templates/karma.conf.js.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ function getConfitConfig(config) {
if (debugMode) {
commonConfig.browsers = ['Chrome']; // Use Chrome
<% if (buildJS.sourceFormat === 'TypeScript') { %>
var webpackHelpers = require('../webpack/webpackHelpers.js')();
// Remove the coverage reporter, otherwise it runs against the instrumented code, making it difficult to debug the code.
Expand Down
3 changes: 0 additions & 3 deletions lib/buildTool/webpack/testUnit/templates/test.files.js.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
// START_CONFIT_GENERATED_CONTENT
Error.stackTraceLimit = Infinity;

// Polyfill required for PhantomJS
require('phantomjs-polyfill');

// Load the test dependencies!
<%

Expand Down
3 changes: 0 additions & 3 deletions lib/buildTool/webpack/webpackResources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,10 @@ testUnit:
- <<: *pkg_karma-coverage
- <<: *pkg_karma-jasmine
- <<: *pkg_karma-junit-reporter
- <<: *pkg_karma-phantomjs-launcher
- <<: *pkg_karma-sourcemap-loader
- <<: *pkg_karma-threshold-reporter
- <<: *pkg_karma-webpack
- <<: *pkg_jasmine-core
- <<: *pkg_phantomjs-prebuilt
- <<: *pkg_phantomjs-polyfill
- <<: *pkg_@types/jasmine

tasks:
Expand Down
21 changes: 2 additions & 19 deletions lib/core/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ $packages:

- &pkg_backstopjs
name: backstopjs
version: 2.7.0
version: 3.0.22

- &pkg_chokidar-cli
name: chokidar-cli
Expand Down Expand Up @@ -351,10 +351,6 @@ $packages:
name: karma-junit-reporter
version: 1.2.0

- &pkg_karma-phantomjs-launcher
name: karma-phantomjs-launcher
version: 1.0.4

- &pkg_karma-sourcemap-loader
name: karma-sourcemap-loader
version: 0.3.7
Expand Down Expand Up @@ -405,18 +401,6 @@ $packages:
version: 4.1.1
isDependency: true

# TODO: deprecate PhantomJS
- &pkg_phantomjs-polyfill
name: phantomjs-polyfill
version: 0.0.2

- &pkg_phantomjs-prebuilt
name: phantomjs-prebuilt
version: 2.1.14
# For karma-phantomjs-launcher to work, this package *must* appaear in package.json
# So install it globally AND include it in package.json
global: both

- &pkg_postcss-loader
name: postcss-loader
version: 1.3.3
Expand All @@ -426,8 +410,7 @@ $packages:
version: 7.1.1
isDependency: true

# TODO: deprecate in favour of CodeceptJS
- &pkg_protractor # v5 available, but breaking changes
- &pkg_protractor
name: protractor
version: 5.1.2

Expand Down

0 comments on commit 013f30d

Please sign in to comment.