diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..8afd67f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +sudo: false +language: node_js +notifications: + email: false +node_js: + - '8' +addons: + chrome: stable +before_script: + - "export DISPLAY=:99.0" + - "sh -e /etc/init.d/xvfb start" + - sleep 3 # give xvfb some time to start +script: + - npm test diff --git a/features/step_definitions/steps.ts b/features/step_definitions/steps.ts index 0ef7385..5362721 100644 --- a/features/step_definitions/steps.ts +++ b/features/step_definitions/steps.ts @@ -2,7 +2,7 @@ import { protractor } from 'protractor'; import { serenity } from 'serenity-js'; import { Actor, BrowseTheWeb, Open } from 'serenity-js/lib/screenplay-protractor'; -import { CheckIfDisplayedMessage, EnterTheName } from '../../spec/greeter'; +import { CheckIfDisplayedMessage, EnterTheName } from '../../test/greeter'; export = function steps() { diff --git a/protractor.conf.js b/protractor.conf.js index f9978c7..5988820 100644 --- a/protractor.conf.js +++ b/protractor.conf.js @@ -1,18 +1,19 @@ -const - glob = require('glob'), - protractor = require.resolve('protractor'), - node_modules = protractor.substring(0, protractor.lastIndexOf('node_modules') + 'node_modules'.length), - seleniumJar = glob.sync(`${node_modules}/protractor/**/selenium-server-standalone-*.jar`).pop(); +const isCI = () => process.env.CI && process.env.CI === 'true'; +/** + * To learn more about the protractor.conf.js check out: + * https://github.com/angular/protractor/blob/master/lib/config.ts + */ exports.config = { baseUrl: 'https://www.angularjs.org/', - seleniumServerJar: seleniumJar, + directConnect: true, // https://github.com/angular/protractor/blob/master/docs/timeouts.md allScriptsTimeout: 110000, + // Load Serenity/JS framework: 'custom', frameworkPath: require.resolve('serenity-js'), @@ -30,10 +31,14 @@ exports.config = { chromeOptions: { args: [ '--disable-infobars', - // "--headless", - // "--disable-gpu", - // "--window-size=1024x768" - ] + '--headless', + '--disable-gpu', + '--window-size=800,600' + ]. + + // Required on Travis CI when running the build without sudo + // https://developers.google.com/web/updates/2017/06/headless-karma-mocha-chai#running_it_all_on_travis_ci + concat(isCI() ? ['--no-sandbox'] : []) } } -}; \ No newline at end of file +}; diff --git a/spec/greeter/check_if_displayed_message.ts b/test/greeter/check_if_displayed_message.ts similarity index 100% rename from spec/greeter/check_if_displayed_message.ts rename to test/greeter/check_if_displayed_message.ts diff --git a/spec/greeter/enter_the_name.ts b/test/greeter/enter_the_name.ts similarity index 100% rename from spec/greeter/enter_the_name.ts rename to test/greeter/enter_the_name.ts diff --git a/spec/greeter/index.ts b/test/greeter/index.ts similarity index 100% rename from spec/greeter/index.ts rename to test/greeter/index.ts diff --git a/spec/greeter/ui/greeter_widget.ts b/test/greeter/ui/greeter_widget.ts similarity index 100% rename from spec/greeter/ui/greeter_widget.ts rename to test/greeter/ui/greeter_widget.ts diff --git a/tsconfig.json b/tsconfig.json index 99b9867..cf4a669 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,20 +3,19 @@ "target": "es5", "lib": [ "es5", "es6" ], "module": "commonjs", + "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "sourceMap": true, - "declaration": true, - "outDir": "./target/transpiled" + "declaration": true }, "include": [ "src/**/*.ts", - "spec/**/*.ts" + "test/**/*.ts" ], "exclude": [ - "node_modules", - "examples" + "node_modules" ] }