Skip to content
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.

Commit

Permalink
Merge pull request #1 from just-boris/master
Browse files Browse the repository at this point in the history
Service impementation
  • Loading branch information
christian-bromann committed Mar 29, 2016
2 parents 51ad662 + 10c0e6e commit e35a67b
Show file tree
Hide file tree
Showing 14 changed files with 243 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .babelrc
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}
15 changes: 15 additions & 0 deletions .editorconfig
@@ -0,0 +1,15 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org

root = true

[*]

indent_style = space
indent_size = 4

end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false
1 change: 1 addition & 0 deletions .eslintignore
@@ -0,0 +1 @@
build/
13 changes: 13 additions & 0 deletions .eslintrc
@@ -0,0 +1,13 @@
{
"extends": "standard",
"parserOptions": {
"ecmaVersion": 6
},
"rules": {
"indent": [2, 4]
},
"env": {
"es6": true
},
"globals": {}
}
27 changes: 27 additions & 0 deletions .gitignore
@@ -0,0 +1,27 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
60 changes: 60 additions & 0 deletions gruntfile.js
@@ -0,0 +1,60 @@
module.exports = function (grunt) {
grunt.initConfig({
pkgFile: 'package.json',
clean: ['build'],
babel: {
options: {
sourceMap: false
},
dist: {
files: [{
expand: true,
cwd: './lib',
src: ['*.js'],
dest: 'build',
ext: '.js'
}]
}
},
watch: {
dist: {
files: ['./lib/*.js'],
tasks: ['babel:dist']
}
},
eslint: {
target: [
'index.js',
'lib/*.js'
]
},
contributors: {
options: {
commitMessage: 'update contributors'
}
},
bump: {
options: {
commitMessage: 'v%VERSION%',
pushTo: 'upstream'
}
}
})

require('load-grunt-tasks')(grunt)
grunt.registerTask('default', ['build'])
grunt.registerTask('build', 'Build wdio-selenium-service', function () {
grunt.task.run([
'eslint',
'clean',
'babel'
])
})
grunt.registerTask('release', 'Bump and tag version', function (type) {
grunt.task.run([
'build',
'contributors',
'bump:' + (type || 'patch')
])
})
}
3 changes: 3 additions & 0 deletions index.js
@@ -0,0 +1,3 @@
var SeleniumService = require('./build/service').default
module.exports = new SeleniumService()
// module.exports.launcher = require('./launcher')
2 changes: 2 additions & 0 deletions launcher.js
@@ -0,0 +1,2 @@
var SeleniumLauncher = require('./build/launcher').default
module.exports = new SeleniumLauncher()
19 changes: 19 additions & 0 deletions lib/launcher.js
@@ -0,0 +1,19 @@
import Selenium from 'selenium-standalone'
import denodeify from 'denodeify'

const startSelenium = denodeify(Selenium.start)

class SeleniumStandaloneLauncher {

onPrepare () {
return startSelenium().then((process) => {
this.process = process
})
}

onComplete () {
this.process.kill()
}
}

export default SeleniumStandaloneLauncher
3 changes: 3 additions & 0 deletions lib/service.js
@@ -0,0 +1,3 @@
export default class SeleniumServer {

}
49 changes: 49 additions & 0 deletions package.json
@@ -0,0 +1,49 @@
{
"name": "wdio-selenium-standalone-service",
"version": "0.0.1",
"description": "WebdriverIO service to start & stop Selenium Standalone",
"main": "index.js",
"scripts": {
"postinstall": "selenium-standalone install",
"build": "grunt build",
"test": "wdio test/wdio.conf.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/webdriverio/wdio-selenium-standalone-service.git"
},
"keywords": [
"webdriverio",
"selenium",
"tests"
],
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/webdriverio/wdio-selenium-standalone-service/issues"
},
"homepage": "https://github.com/webdriverio/wdio-selenium-standalone-service#readme",
"dependencies": {
"denodeify": "^1.2.1",
"selenium-standalone": "^5.1.0"
},
"devDependencies": {
"babel": "^6.5.2",
"babel-preset-es2015": "^6.6.0",
"babel-register": "^6.7.2",
"eslint": "^2.5.1",
"eslint-config-standard": "^5.1.0",
"eslint-plugin-promise": "^1.1.0",
"eslint-plugin-standard": "^1.3.2",
"grunt": "^0.4.5",
"grunt-babel": "^6.0.0",
"grunt-cli": "^1.1.0",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-eslint": "^18.0.0",
"grunt-npm": "0.0.2",
"load-grunt-tasks": "^3.4.1",
"wdio-mocha-framework": "^0.2.12",
"webdriverio": "^4.0.5"
}
}
8 changes: 8 additions & 0 deletions test/.eslintrc
@@ -0,0 +1,8 @@
{
"env": {
"mocha": true
},
"globals": {
"browser": true
}
}
8 changes: 8 additions & 0 deletions test/main.spec.js
@@ -0,0 +1,8 @@
import assert from 'assert'

describe('webdriverio', function () {
it('a spec', function () {
browser.url('/')
assert.equal(browser.getTitle(), 'WebdriverIO - Selenium 2.0 javascript bindings for nodejs')
})
})
32 changes: 32 additions & 0 deletions test/wdio.conf.js
@@ -0,0 +1,32 @@
exports.config = {

specs: [
'./test/*.spec.js'
],

capabilities: [{
browserName: 'firefox'
}],

sync: true,
logLevel: 'silent',
coloredLogs: true,

baseUrl: 'http://webdriver.io',

waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,

framework: 'mocha',
mochaOpts: {
ui: 'bdd',
requires: [
'babel-register'
]
},

services: [
require('../')
]
}

0 comments on commit e35a67b

Please sign in to comment.