Skip to content

Instantly share code, notes, and snippets.

@arranbartish
Created March 17, 2017 11:51
Show Gist options
  • Save arranbartish/defc43ae628af01d13e68c85aef38ce3 to your computer and use it in GitHub Desktop.
Save arranbartish/defc43ae628af01d13e68c85aef38ce3 to your computer and use it in GitHub Desktop.
Protractor + mocha config for typescript
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
exports.config = {
allScriptsTimeout: 11000, // Timeout of each script
specs: [
'./e2e/**/*.e2e-spec.ts' // pattern for your tests
],
baseUrl: 'http://localhost:4200/', // URL of your SUT
capabilities: {
'browserName': 'chrome' // name of the browser you want to test in
},
directConnect: true, // No need to run selenium server for chrome and firefox
framework: 'mocha', // The framework we want to use instead of say jasmine
mochaOpts: { // Some reasonable mocha config
reporter: "spec",
slow: 3000,
ui: 'bdd',
timeout: 30000
},
beforeLaunch: function() { // If you're using type script then you need compiler options
require('ts-node').register({
project: 'tsconfig.e2e.json'
});
},
onPrepare: function() { // making chai available globally. in your test use `const expect = global['chai'].expect;`
var chai = require('chai');
var chaiAsPromised = require("chai-as-promised");
chai.use(chaiAsPromised);
global.chai = chai;
}
};
{
"compileOnSave": false,
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"es2016"
],
"module": "commonjs",
"moduleResolution": "node",
"outDir": "../dist/out-tsc-e2e",
"sourceMap": true,
"target": "es6",
"typeRoots": [
"../node_modules/@types"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment