-
Notifications
You must be signed in to change notification settings - Fork 41
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 #8 from ktsn/change-e2e-test
Change e2e test framework
- Loading branch information
Showing
9 changed files
with
153 additions
and
160 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,17 +1,5 @@ | ||
language: node_js | ||
node_js: | ||
- "6" | ||
env: | ||
- CXX=g++-4.8 | ||
addons: | ||
apt: | ||
sources: | ||
- ubuntu-toolchain-r-test | ||
packages: | ||
- g++-4.8 | ||
before_script: | ||
- "export DISPLAY=:99.0" | ||
- "sh -e /etc/init.d/xvfb start" | ||
- sleep 3 # give xvfb some time to start | ||
script: | ||
- echo |
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
--- | ||
env: | ||
mocha: true | ||
globals: | ||
fixture: true | ||
test: true |
This file was deleted.
Oops, something went wrong.
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,79 +1,67 @@ | ||
class ExamplePage { | ||
constructor (browser) { | ||
this.browser = browser | ||
export default class ExamplePage { | ||
constructor (t) { | ||
this.t = t | ||
} | ||
|
||
get wait () { | ||
return this.t | ||
} | ||
|
||
setName (name) { | ||
this.browser.setValue('.name', name) | ||
this.t = this.t.typeText('.name', name, { replace: true }) | ||
return this | ||
} | ||
|
||
setValue (value) { | ||
this.browser.setValue('.value', value) | ||
this.t = this.t.typeText('.value', String(value), { replace: true }) | ||
return this | ||
} | ||
|
||
setMin (min) { | ||
this.browser.setValue('.min', min) | ||
this.t = this.t.typeText('.min', String(min), { replace: true }) | ||
return this | ||
} | ||
|
||
setMax (max) { | ||
this.browser.setValue('.max', max) | ||
this.t = this.t.typeText('.max', String(max), { replace: true }) | ||
return this | ||
} | ||
|
||
setStep (step) { | ||
this.browser.setValue('.step', step) | ||
this.t = this.t.typeText('.step', String(step), { replace: true }) | ||
return this | ||
} | ||
|
||
toggleDisabled () { | ||
this.browser.click('.disabled') | ||
return this | ||
} | ||
|
||
mouseDownSlider () { | ||
this.browser | ||
.getElement('.range-slider-knob') | ||
// intend to mouse down at center | ||
// knob size === 20 | ||
.movePointerRelativeTo(10, 10) | ||
this.browser.buttonDown() | ||
return this | ||
} | ||
|
||
mouseUp () { | ||
this.browser.buttonUp() | ||
this.t = this.t.click('.disabled') | ||
return this | ||
} | ||
|
||
moveSlider (offsetRatio) { | ||
this.mouseDownSlider() | ||
this.browser | ||
.getElement('.range-slider-knob') | ||
this.t = this.t.drag( | ||
'.range-slider-knob', | ||
// the width that knob can move is 200 | ||
// keep mouse position at the knob center | ||
.movePointerRelativeTo(200 * offsetRatio + 10, 10) | ||
this.mouseUp() | ||
200 * offsetRatio, | ||
0, | ||
{ offsetX: 10, offsetY: 10 } | ||
) | ||
return this | ||
} | ||
|
||
getValue () { | ||
return this.browser.getElement('.value').get('value') | ||
return this.t.select('.value').value | ||
} | ||
|
||
getSliderName () { | ||
return this.browser | ||
.getElement('.range-slider input') | ||
.get('name') | ||
return this.t | ||
.select('.range-slider input') | ||
.then(el => el.getAttribute('name')) | ||
} | ||
|
||
getSliderValue () { | ||
return this.browser | ||
.getElement('.range-slider input') | ||
.get('value') | ||
return this.t | ||
.select('.range-slider input') | ||
.value | ||
} | ||
} | ||
|
||
module.exports = ExamplePage |
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,26 @@ | ||
const path = require('path') | ||
const glob = require('glob') | ||
const WebpackDevServer = require('webpack-dev-server') | ||
const webpack = require('webpack') | ||
const createTestCafe = require('testcafe') | ||
|
||
const compiler = webpack(require('../../scripts/webpack.config.example')) | ||
|
||
const server = new WebpackDevServer(compiler, { | ||
contentBase: 'example', | ||
noInfo: true | ||
}) | ||
|
||
server.listen(8080, () => { | ||
createTestCafe('localhost', 1337, 1338) | ||
.then(testCafe => { | ||
return testCafe | ||
.createRunner() | ||
.src(glob.sync(path.resolve(__dirname, 'specs/**/*.js'))) | ||
.browsers(['phantomjs']) | ||
.run() | ||
}) | ||
.then(() => { | ||
process.exit() | ||
}) | ||
}) |
Oops, something went wrong.