-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unit tests refactored and added e2e tests environment
- Loading branch information
Showing
9 changed files
with
95 additions
and
55 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
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,14 @@ | ||
import { expect } from 'chai'; | ||
import testUtils from './utils'; | ||
|
||
describe('application launch', function () { | ||
|
||
beforeEach(testUtils.beforeEach); | ||
afterEach(testUtils.afterEach); | ||
|
||
it('shows hello world text on screen after launch', function () { | ||
return this.app.client.getText('#greet').then(function (text) { | ||
expect(text).to.equal('Hello World!'); | ||
}); | ||
}); | ||
}); |
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,22 @@ | ||
import electron from 'electron'; | ||
import { Application } from 'spectron'; | ||
|
||
var beforeEach = function () { | ||
this.app = new Application({ | ||
path: electron, | ||
args: ['app'], | ||
waitTimeout: 10000, | ||
}); | ||
return this.app.start(); | ||
}; | ||
|
||
var afterEach = function () { | ||
if (this.app && this.app.isRunning()) { | ||
return this.app.stop(); | ||
} | ||
}; | ||
|
||
export default { | ||
beforeEach: beforeEach, | ||
afterEach: afterEach, | ||
}; |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
'use strict'; | ||
|
||
require('./tasks/build'); | ||
require('./tasks/build_app'); | ||
require('./tasks/build_tests'); | ||
require('./tasks/start'); |
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
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,43 @@ | ||
'use strict'; | ||
|
||
var gulp = require('gulp'); | ||
var jetpack = require('fs-jetpack'); | ||
var bundle = require('./bundle'); | ||
|
||
// Spec files are scattered through the whole project. Here we're searching | ||
// for them and generate one entry file which will run all the tests. | ||
var generateEntryFile = function (dir, destFileName, filePattern) { | ||
var fileBanner = "// This file is generated automatically.\n" | ||
+ "// All modifications will be lost.\n"; | ||
|
||
return dir.findAsync('.', { matching: filePattern }) | ||
.then(function (specPaths) { | ||
var fileContent = specPaths.map(function (path) { | ||
return 'import "./' + path.replace(/\\/g, '/') + '";'; | ||
}).join('\n'); | ||
return dir.writeAsync(destFileName, fileBanner + fileContent); | ||
}) | ||
.then(function () { | ||
return dir.path(destFileName); | ||
}); | ||
}; | ||
|
||
gulp.task('build-unit', ['environment'], function () { | ||
var srcDir = jetpack.cwd('src'); | ||
var destDir = jetpack.cwd('app'); | ||
|
||
return generateEntryFile(srcDir, 'specs.js.autogenerated', '*.spec.js') | ||
.then(function (entryFilePath) { | ||
return bundle(entryFilePath, destDir.path('specs.js.autogenerated')); | ||
}); | ||
}); | ||
|
||
gulp.task('build-e2e', ['build'], function () { | ||
var srcDir = jetpack.cwd('e2e'); | ||
var destDir = jetpack.cwd('app'); | ||
|
||
return generateEntryFile(srcDir, 'e2e.js.autogenerated', '*.e2e.js') | ||
.then(function (entryFilePath) { | ||
return bundle(entryFilePath, destDir.path('e2e.js.autogenerated')); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.