├── app └── .gitkeep ├── addon └── .gitkeep ├── vendor └── .gitkeep ├── tests ├── unit │ └── .gitkeep ├── dummy │ ├── app │ │ ├── helpers │ │ │ └── .gitkeep │ │ ├── models │ │ │ └── .gitkeep │ │ ├── routes │ │ │ └── .gitkeep │ │ ├── styles │ │ │ └── app.css │ │ ├── components │ │ │ └── .gitkeep │ │ ├── controllers │ │ │ ├── .gitkeep │ │ │ └── uses-service.js │ │ ├── templates │ │ │ ├── components │ │ │ │ └── .gitkeep │ │ │ └── application.hbs │ │ ├── router.js │ │ ├── app.js │ │ └── index.html │ ├── public │ │ ├── robots.txt │ │ └── crossdomain.xml │ └── config │ │ └── environment.js ├── test-helper.js ├── helpers │ ├── resolver.js │ └── start-app.js ├── acceptance │ └── uses-service-test.js ├── .jshintrc └── index.html ├── .watchmanconfig ├── .bowerrc ├── config ├── environment.js ├── release.js └── ember-try.js ├── .npmignore ├── index.js ├── testem.json ├── .ember-cli ├── .gitignore ├── bower.json ├── ember-cli-build.js ├── .jshintrc ├── .editorconfig ├── .travis.yml ├── selenium.js ├── LICENSE.md ├── commands └── selenium.js ├── package.json └── README.md /app/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /addon/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/unit/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/helpers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/models/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/routes/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/styles/app.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/components/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/controllers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/dummy/app/templates/components/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | { 2 | "ignore_dirs": ["tmp", "dist"] 3 | } 4 | -------------------------------------------------------------------------------- /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "bower_components", 3 | "analytics": false 4 | } 5 | -------------------------------------------------------------------------------- /tests/dummy/public/robots.txt: -------------------------------------------------------------------------------- 1 | # http://www.robotstxt.org 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /tests/dummy/app/templates/application.hbs: -------------------------------------------------------------------------------- 1 |

Welcome to Ember

2 | 3 | {{outlet}} 4 | -------------------------------------------------------------------------------- /config/environment.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function(/* environment, appConfig */) { 4 | return { }; 5 | }; 6 | -------------------------------------------------------------------------------- /tests/test-helper.js: -------------------------------------------------------------------------------- 1 | import resolver from './helpers/resolver'; 2 | import { 3 | setResolver 4 | } from 'ember-qunit'; 5 | 6 | setResolver(resolver); 7 | -------------------------------------------------------------------------------- /tests/dummy/app/controllers/uses-service.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | 3 | export default Ember.Controller.extend({ 4 | profiling: Ember.inject.service() 5 | }); 6 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | bower_components/ 2 | tests/ 3 | tmp/ 4 | dist/ 5 | 6 | .bowerrc 7 | .editorconfig 8 | .ember-cli 9 | .travis.yml 10 | .npmignore 11 | **/.gitkeep 12 | bower.json 13 | ember-cli-build.js 14 | Brocfile.js 15 | testem.json 16 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | module.exports = { 5 | name: 'ember-cli-selenium', 6 | 7 | includedCommands: function() { 8 | return { 9 | 'selenium': require('./commands/selenium') 10 | }; 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /testem.json: -------------------------------------------------------------------------------- 1 | { 2 | "framework": "qunit", 3 | "test_page": "tests/index.html?hidepassed", 4 | "disable_watching": true, 5 | "launch_in_ci": [ 6 | "PhantomJS" 7 | ], 8 | "launch_in_dev": [ 9 | "PhantomJS", 10 | "Chrome" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /tests/dummy/app/router.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import config from './config/environment'; 3 | 4 | var Router = Ember.Router.extend({ 5 | location: config.locationType 6 | }); 7 | 8 | Router.map(function() { 9 | this.route('uses-service'); 10 | }); 11 | 12 | export default Router; 13 | -------------------------------------------------------------------------------- /.ember-cli: -------------------------------------------------------------------------------- 1 | { 2 | /** 3 | Ember CLI sends analytics information by default. The data is completely 4 | anonymous, but there are times when you might want to disable this behavior. 5 | 6 | Setting `disableAnalytics` to true will prevent any data from being sent. 7 | */ 8 | "disableAnalytics": false 9 | } 10 | -------------------------------------------------------------------------------- /tests/helpers/resolver.js: -------------------------------------------------------------------------------- 1 | import Resolver from 'ember-resolver'; 2 | import config from '../../config/environment'; 3 | 4 | var resolver = Resolver.create(); 5 | 6 | resolver.namespace = { 7 | modulePrefix: config.modulePrefix, 8 | podModulePrefix: config.podModulePrefix 9 | }; 10 | 11 | export default resolver; 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | 7 | # dependencies 8 | /node_modules 9 | /bower_components 10 | 11 | # misc 12 | /.sass-cache 13 | /connect.lock 14 | /coverage/* 15 | /libpeerconnection.log 16 | npm-debug.log 17 | testem.log 18 | -------------------------------------------------------------------------------- /config/release.js: -------------------------------------------------------------------------------- 1 | /* jshint node:true */ 2 | 3 | var execSync = require('child_process').execSync; 4 | 5 | module.exports = { 6 | // Publish the new release to NPM after a successful push 7 | afterPush: function() { 8 | console.log('publishing to npm'); 9 | var output = execSync('npm publish', { encoding: 'utf8' }); 10 | console.log(output); 11 | } 12 | }; 13 | -------------------------------------------------------------------------------- /tests/dummy/app/app.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import Resolver from 'ember-resolver'; 3 | import loadInitializers from 'ember/load-initializers'; 4 | import config from './config/environment'; 5 | 6 | var App; 7 | 8 | Ember.MODEL_FACTORY_INJECTIONS = true; 9 | 10 | App = Ember.Application.extend({ 11 | modulePrefix: config.modulePrefix, 12 | podModulePrefix: config.podModulePrefix, 13 | Resolver: Resolver 14 | }); 15 | 16 | loadInitializers(App, config.modulePrefix); 17 | 18 | export default App; 19 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ember-cli-selenium", 3 | "dependencies": { 4 | "ember": "2.0.0", 5 | "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.5", 6 | "ember-cli-test-loader": "ember-cli-test-loader#0.1.3", 7 | "ember-data": "2.0.0", 8 | "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.5", 9 | "ember-qunit": "0.4.10", 10 | "ember-qunit-notifications": "0.0.7", 11 | "jquery": "^1.11.3", 12 | "loader.js": "ember-cli/loader.js#3.2.1", 13 | "qunit": "~1.18.0" 14 | }, 15 | "resolutions": { 16 | "ember": "2.0.0" 17 | } 18 | } -------------------------------------------------------------------------------- /tests/acceptance/uses-service-test.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import { module, test } from 'qunit'; 3 | import startApp from '../../tests/helpers/start-app'; 4 | 5 | module('Acceptance | uses service', { 6 | beforeEach: function() { 7 | this.application = startApp(); 8 | }, 9 | 10 | afterEach: function() { 11 | Ember.run(this.application, 'destroy'); 12 | } 13 | }); 14 | 15 | test('visiting /uses-service', function(assert) { 16 | visit('/uses-service'); 17 | 18 | andThen(function() { 19 | assert.equal(currentURL(), '/uses-service'); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /tests/helpers/start-app.js: -------------------------------------------------------------------------------- 1 | import Ember from 'ember'; 2 | import Application from '../../app'; 3 | import config from '../../config/environment'; 4 | 5 | export default function startApp(attrs) { 6 | var application; 7 | 8 | var attributes = Ember.merge({}, config.APP); 9 | attributes = Ember.merge(attributes, attrs); // use defaults, but you can override; 10 | 11 | Ember.run(function() { 12 | application = Application.create(attributes); 13 | application.setupForTesting(); 14 | application.injectTestHelpers(); 15 | }); 16 | 17 | return application; 18 | } 19 | -------------------------------------------------------------------------------- /ember-cli-build.js: -------------------------------------------------------------------------------- 1 | /* global require, module */ 2 | var EmberAddon = require('ember-cli/lib/broccoli/ember-addon'); 3 | 4 | module.exports = function(defaults) { 5 | var app = new EmberAddon(defaults, { 6 | // Add options here 7 | }); 8 | 9 | /* 10 | This build file specifes the options for the dummy test app of this 11 | addon, located in `/tests/dummy` 12 | This build file does *not* influence how the addon or the app using it 13 | behave. You most likely want to be modifying `./index.js` or app's build file 14 | */ 15 | 16 | return app.toTree(); 17 | }; 18 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "predef": [ 3 | "document", 4 | "window", 5 | "-Promise" 6 | ], 7 | "browser": true, 8 | "boss": true, 9 | "curly": true, 10 | "debug": false, 11 | "devel": true, 12 | "eqeqeq": true, 13 | "evil": true, 14 | "forin": false, 15 | "immed": false, 16 | "laxbreak": false, 17 | "newcap": true, 18 | "noarg": true, 19 | "noempty": false, 20 | "nonew": false, 21 | "nomen": false, 22 | "onevar": false, 23 | "plusplus": false, 24 | "regexp": false, 25 | "undef": true, 26 | "sub": true, 27 | "strict": false, 28 | "white": false, 29 | "eqnull": true, 30 | "esnext": true, 31 | "unused": true 32 | } 33 | -------------------------------------------------------------------------------- /tests/dummy/public/crossdomain.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 16 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | 8 | [*] 9 | end_of_line = lf 10 | charset = utf-8 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | indent_style = space 14 | indent_size = 2 15 | 16 | [*.js] 17 | indent_style = space 18 | indent_size = 2 19 | 20 | [*.hbs] 21 | insert_final_newline = false 22 | indent_style = space 23 | indent_size = 2 24 | 25 | [*.css] 26 | indent_style = space 27 | indent_size = 2 28 | 29 | [*.html] 30 | indent_style = space 31 | indent_size = 2 32 | 33 | [*.{diff,md}] 34 | trim_trailing_whitespace = false 35 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: node_js 3 | node_js: 4 | - "0.12" 5 | 6 | sudo: false 7 | 8 | cache: 9 | directories: 10 | - node_modules 11 | 12 | env: 13 | - EMBER_TRY_SCENARIO=default 14 | - EMBER_TRY_SCENARIO=ember-release 15 | - EMBER_TRY_SCENARIO=ember-beta 16 | - EMBER_TRY_SCENARIO=ember-canary 17 | 18 | matrix: 19 | fast_finish: true 20 | allow_failures: 21 | - env: EMBER_TRY_SCENARIO=ember-canary 22 | 23 | before_install: 24 | - export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH 25 | - "npm config set spin false" 26 | - "npm install -g npm@^2" 27 | 28 | install: 29 | - npm install -g bower 30 | - npm install 31 | - bower install 32 | 33 | script: 34 | - ember try $EMBER_TRY_SCENARIO test 35 | -------------------------------------------------------------------------------- /tests/dummy/app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Dummy 7 | 8 | 9 | 10 | {{content-for 'head'}} 11 | 12 | 13 | 14 | 15 | {{content-for 'head-footer'}} 16 | 17 | 18 | {{content-for 'body'}} 19 | 20 | 21 | 22 | 23 | {{content-for 'body-footer'}} 24 | 25 | 26 | -------------------------------------------------------------------------------- /config/ember-try.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | scenarios: [ 3 | { 4 | name: 'default', 5 | dependencies: { } 6 | }, 7 | { 8 | name: 'ember-release', 9 | dependencies: { 10 | 'ember': 'components/ember#release' 11 | }, 12 | resolutions: { 13 | 'ember': 'release' 14 | } 15 | }, 16 | { 17 | name: 'ember-beta', 18 | dependencies: { 19 | 'ember': 'components/ember#beta' 20 | }, 21 | resolutions: { 22 | 'ember': 'beta' 23 | } 24 | }, 25 | { 26 | name: 'ember-canary', 27 | dependencies: { 28 | 'ember': 'components/ember#canary' 29 | }, 30 | resolutions: { 31 | 'ember': 'canary' 32 | } 33 | } 34 | ] 35 | }; 36 | -------------------------------------------------------------------------------- /tests/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "predef": [ 3 | "document", 4 | "window", 5 | "location", 6 | "setTimeout", 7 | "$", 8 | "-Promise", 9 | "define", 10 | "console", 11 | "visit", 12 | "exists", 13 | "fillIn", 14 | "click", 15 | "keyEvent", 16 | "triggerEvent", 17 | "find", 18 | "findWithAssert", 19 | "wait", 20 | "DS", 21 | "andThen", 22 | "currentURL", 23 | "currentPath", 24 | "currentRouteName" 25 | ], 26 | "node": false, 27 | "browser": false, 28 | "boss": true, 29 | "curly": true, 30 | "debug": false, 31 | "devel": false, 32 | "eqeqeq": true, 33 | "evil": true, 34 | "forin": false, 35 | "immed": false, 36 | "laxbreak": false, 37 | "newcap": true, 38 | "noarg": true, 39 | "noempty": false, 40 | "nonew": false, 41 | "nomen": false, 42 | "onevar": false, 43 | "plusplus": false, 44 | "regexp": false, 45 | "undef": true, 46 | "sub": true, 47 | "strict": false, 48 | "white": false, 49 | "eqnull": true, 50 | "esnext": true, 51 | "unused": true 52 | } 53 | -------------------------------------------------------------------------------- /selenium.js: -------------------------------------------------------------------------------- 1 | module.exports = function(options) { 2 | var webdriver = options.webdriver; 3 | var chrome = options.chrome; 4 | var By = webdriver.By; 5 | var until = webdriver.until; 6 | 7 | var chromeOptions = new chrome.Options(); 8 | chromeOptions.addArguments(['--incognito']); 9 | 10 | var driver = new webdriver.Builder() 11 | .forBrowser('chrome') 12 | .setChromeOptions( 13 | new chrome.Options() 14 | .addArguments('--incognito') 15 | ) 16 | .build(); 17 | 18 | driver.get('https://www.google.com'); 19 | 20 | var input = driver.findElement({ name: 'q'}); 21 | 22 | input.sendKeys('webdriver'); 23 | input.submit(); 24 | 25 | driver.wait(until.titleIs('webdriver - Google Search'), 1000); 26 | driver.wait(until.elementLocated( { partialLinkText: 'Selenium' })); 27 | driver.findElement({ partialLinkText: 'Selenium' }).click(); 28 | 29 | driver.getTitle() 30 | .then(function(title) { 31 | console.log('final title is: ' + title); 32 | }); 33 | 34 | return driver.quit(); 35 | }; 36 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /tests/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Dummy Tests 7 | 8 | 9 | 10 | {{content-for 'head'}} 11 | {{content-for 'test-head'}} 12 | 13 | 14 | 15 | 16 | 17 | {{content-for 'head-footer'}} 18 | {{content-for 'test-head-footer'}} 19 | 20 | 21 | 22 | {{content-for 'body'}} 23 | {{content-for 'test-body'}} 24 | 25 | 26 | 27 | 28 | 29 | 30 | {{content-for 'body-footer'}} 31 | {{content-for 'test-body-footer'}} 32 | 33 | 34 | -------------------------------------------------------------------------------- /tests/dummy/config/environment.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 3 | module.exports = function(environment) { 4 | var ENV = { 5 | modulePrefix: 'dummy', 6 | environment: environment, 7 | baseURL: '/', 8 | locationType: 'auto', 9 | EmberENV: { 10 | FEATURES: { 11 | // Here you can enable experimental features on an ember canary build 12 | // e.g. 'with-controller': true 13 | } 14 | }, 15 | 16 | APP: { 17 | // Here you can pass flags/options to your application instance 18 | // when it is created 19 | } 20 | }; 21 | 22 | if (environment === 'development') { 23 | // ENV.APP.LOG_RESOLVER = true; 24 | // ENV.APP.LOG_ACTIVE_GENERATION = true; 25 | // ENV.APP.LOG_TRANSITIONS = true; 26 | // ENV.APP.LOG_TRANSITIONS_INTERNAL = true; 27 | // ENV.APP.LOG_VIEW_LOOKUPS = true; 28 | } 29 | 30 | if (environment === 'test') { 31 | // Testem prefers this... 32 | ENV.baseURL = '/'; 33 | ENV.locationType = 'none'; 34 | 35 | // keep test console output quieter 36 | ENV.APP.LOG_ACTIVE_GENERATION = false; 37 | ENV.APP.LOG_VIEW_LOOKUPS = false; 38 | 39 | ENV.APP.rootElement = '#ember-testing'; 40 | } 41 | 42 | if (environment === 'production') { 43 | 44 | } 45 | 46 | return ENV; 47 | }; 48 | -------------------------------------------------------------------------------- /commands/selenium.js: -------------------------------------------------------------------------------- 1 | var path = require('path'); 2 | 3 | module.exports = { 4 | name: 'selenium', 5 | description: 'Runs the provided selenium script.', 6 | 7 | availableOptions: [ 8 | { name: 'build', type: Boolean, default: true }, 9 | { name: 'script', type: String, default: 'selenium.js' }, 10 | { name: 'environment', type: String, default: 'production', aliases: ['e',{'dev' : 'development'}, {'prod' : 'production'}] }, 11 | { name: 'output-path', type: String, default: 'selenium-dist' } 12 | ], 13 | 14 | runCommand: function() { 15 | var cwd = this.project.root; 16 | var script = require(path.join(cwd, this.commandOptions.script)); 17 | var chromedriver = require('chromedriver'); 18 | var webdriver = require('selenium-webdriver'); 19 | var chrome = require('selenium-webdriver/chrome'); 20 | var firefox = require('selenium-webdriver/firefox'); 21 | 22 | process.env.PATH = process.env.PATH + path.delimiter + path.dirname(chromedriver.path); 23 | 24 | return script({ 25 | webdriver: webdriver, 26 | chrome: chrome, 27 | firefox: firefox 28 | }); 29 | }, 30 | 31 | triggerBuild: function(commandOptions) { 32 | var BuildTask = this.tasks.Build; 33 | var buildTask = new BuildTask({ 34 | ui: this.ui, 35 | analytics: this.analytics, 36 | project: this.project 37 | }); 38 | 39 | return buildTask.run(commandOptions); 40 | }, 41 | 42 | run: function(options, args) { 43 | var _this = this; 44 | this.commandOptions = options; 45 | 46 | if (options.build) { 47 | return this.triggerBuild(options) 48 | .then(function() { 49 | return _this.runCommand(); 50 | }); 51 | } else { 52 | return this.runCommand(); 53 | } 54 | } 55 | }; 56 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ember-cli-selenium", 3 | "version": "0.1.1", 4 | "description": "A simple command to run selenium scripts against ember-cli apps.", 5 | "directories": { 6 | "test": "tests" 7 | }, 8 | "scripts": { 9 | "build": "ember build", 10 | "start": "ember server", 11 | "test": "ember try:testall" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/rwjblue/ember-cli-selenium.git" 16 | }, 17 | "engines": { 18 | "node": ">= 0.10.0" 19 | }, 20 | "author": "Robert Jackson ", 21 | "license": "MIT", 22 | "devDependencies": { 23 | "broccoli-asset-rev": "^2.1.2", 24 | "ember-cli": "1.13.8", 25 | "ember-cli-app-version": "^1.0.0", 26 | "ember-cli-content-security-policy": "0.4.0", 27 | "ember-cli-dependency-checker": "^1.1.0", 28 | "ember-cli-htmlbars": "^1.0.0", 29 | "ember-cli-htmlbars-inline-precompile": "^0.2.0", 30 | "ember-cli-ic-ajax": "0.2.1", 31 | "ember-cli-inject-live-reload": "^1.3.1", 32 | "ember-cli-qunit": "^1.0.1", 33 | "ember-cli-release": "^0.2.6", 34 | "ember-cli-sri": "^1.0.3", 35 | "ember-cli-uglify": "^1.2.0", 36 | "ember-data": "2.0.0", 37 | "ember-disable-prototype-extensions": "^1.0.0", 38 | "ember-disable-proxy-controllers": "^1.0.0", 39 | "ember-export-application-global": "^1.0.4", 40 | "ember-resolver": "^2.0.2", 41 | "ember-try": "~0.0.8" 42 | }, 43 | "keywords": [ 44 | "ember-addon" 45 | ], 46 | "dependencies": { 47 | "chromedriver": "^2.19.0", 48 | "ember-cli-babel": "^5.1.3", 49 | "ember-perf": "0.0.12", 50 | "selenium-webdriver": "^2.46.1" 51 | }, 52 | "ember-addon": { 53 | "configPath": "tests/dummy/config" 54 | }, 55 | "main": "index.js", 56 | "bugs": { 57 | "url": "https://github.com/rwjblue/ember-cli-selenium/issues" 58 | }, 59 | "homepage": "https://github.com/rwjblue/ember-cli-selenium#readme" 60 | } 61 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ember-cli-selenium 2 | 3 | A simple integration of Selenium into an ember-cli command. 4 | 5 | ## Quick Start 6 | 7 | Running: 8 | 9 | ``` 10 | ember selenium --script=scripts/search-for-webdriver.js 11 | ``` 12 | 13 | And having: 14 | 15 | ```js 16 | // scripts/search-for-webdriver.js 17 | 18 | module.exports = function(options) { 19 | var webdriver = options.webdriver; 20 | var chrome = options.chrome; 21 | var until = webdriver.until; 22 | var chromeOptions = new chrome.Options(); 23 | 24 | chromeOptions.addArguments(['--incognito']); 25 | 26 | var driver = new webdriver.Builder() 27 | .forBrowser('chrome') 28 | .setChromeOptions(chromeOptions) 29 | .build(); 30 | 31 | driver.get('https://www.google.com'); 32 | 33 | var input = driver.findElement({ name: 'q'}); 34 | 35 | input.sendKeys('webdriver'); 36 | input.submit(); 37 | 38 | driver.wait(until.titleIs('webdriver - Google Search'), 1000); 39 | driver.wait(until.elementLocated( { partialLinkText: 'Selenium' })); 40 | driver.findElement({ partialLinkText: 'Selenium' }).click(); 41 | 42 | driver.getTitle() 43 | .then(function(title) { 44 | console.log('final title is: ' + title); 45 | }); 46 | 47 | return driver.quit(); 48 | }; 49 | ``` 50 | 51 | Will: 52 | 53 | * launch an incognito Chrome window 54 | * navigate to google.com 55 | * search for `webdriver` 56 | * click the first link that has the text "Selenium" 57 | * `console.log` the title of the resulting page 58 | 59 | ## Selenium Script Arguments 60 | 61 | The script is expected to return a function, that gets an options hash 62 | with these items: 63 | 64 | * `webdriver` - the result of `require('selenium-webdriver')` 65 | * `chrome` - the result of `require('selenium-webdriver/chrome')` 66 | * `firefox` - the result of `require('selenium-webdriver/firefox')` 67 | 68 | The script should return a promise that resolves when the script is 69 | complete (typically `return driver.quit();` is all you will need). 70 | 71 | ## Command Arguments 72 | 73 | * `--build` / `--no-build` -- Used to trigger a build (default) or suppress a build (via `--no-build`). 74 | * `--script=< path relative to project root>` -- The script to require and invoke (defaults to `selenium.js`). 75 | * `--environment` -- The environment to use when building (defaults to `"production"`). 76 | 77 | ## Working on the Addon Itself 78 | 79 | ### Installation 80 | 81 | * `git clone` this repository 82 | * `npm install` 83 | * `bower install` 84 | 85 | ### Running 86 | 87 | * `ember server` 88 | * Visit your app at http://localhost:4200. 89 | 90 | ### Running Tests 91 | 92 | * `ember test` 93 | * `ember test --server` 94 | 95 | ### Building 96 | 97 | * `ember build` 98 | 99 | For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/). 100 | --------------------------------------------------------------------------------