codeceptjs
Advanced tools
Comparing version 0.4.9 to 0.4.10
@@ -0,1 +1,16 @@ | ||
## 0.4.10 | ||
* [Protractor] Protrctor 4.0.12+ support. | ||
* Enabled async bootstrap file by @abachar. Use inside `bootstrap.js`: | ||
```js | ||
module.exports = function(done) { | ||
// async instructions | ||
// call done() to continue execution | ||
// otherwise call done('error description') | ||
} | ||
``` | ||
* Changed 'pending' to 'skipped' in reports by @timja-kainos. See #315 | ||
## 0.4.9 | ||
@@ -2,0 +17,0 @@ |
@@ -32,3 +32,3 @@ 'use strict'; | ||
init(dir) { | ||
init(dir, callback) { | ||
// preparing globals | ||
@@ -49,9 +49,14 @@ global.codecept_dir = dir; | ||
this.bootstrap(); | ||
this.bootstrap(callback); | ||
} | ||
// loading bootstrap | ||
bootstrap() { | ||
bootstrap(callback) { | ||
if (this.config.bootstrap && fileExists(fsPath.join(codecept_dir, this.config.bootstrap))) { | ||
require(fsPath.join(codecept_dir, this.config.bootstrap)); | ||
var bootstrap = require(fsPath.join(codecept_dir, this.config.bootstrap)); | ||
if (typeof bootstrap === 'function') { | ||
bootstrap(callback); | ||
return; | ||
} | ||
callback(); | ||
} | ||
@@ -58,0 +63,0 @@ } |
@@ -39,40 +39,47 @@ 'use strict'; | ||
let codecept = new Codecept(config, {}); | ||
codecept.init(testsPath); | ||
let helpers = container.helpers(); | ||
let suppportI = container.support('I'); | ||
let translations = container.translation(); | ||
let methods = []; | ||
let actions = []; | ||
for (let name in helpers) { | ||
let helper = helpers[name]; | ||
methodsOfObject(helper).forEach((action) => { | ||
let actionAlias = container.translation() ? container.translation().actionAliasFor(action) : action; | ||
if (!actions[actionAlias]) { | ||
let params = getParamNames(helper[action]); | ||
if (params) params = params.join(', '); | ||
if (!params) params = ''; | ||
methods.push(` ${(actionAlias)}: (${params}) => any; \n`); | ||
actions[actionAlias] = 1 | ||
} | ||
}); | ||
} | ||
for (let name in suppportI) { | ||
if (actions[name]) { | ||
continue | ||
} | ||
let actor = suppportI[name]; | ||
let params = getParamNames(actor); | ||
if (params) params = params.join(', '); | ||
if (!params) params = ''; | ||
methods.push(` ${(name)}: (${params}) => any; \n`); | ||
} | ||
let definitionsTemplate = template.replace('{{methods}}', methods.join('')); | ||
definitionsTemplate = definitionsTemplate.replace(/\{\{I\}\}/g, container.translation().I); | ||
codecept.init(testsPath, function(err) { | ||
if (err) { | ||
output.error('Error while running bootstrap file :' + err); | ||
return; | ||
} | ||
fs.writeFileSync(path.join(testsPath, 'steps.d.ts'), definitionsTemplate); | ||
output.print('TypeScript Definitions provide autocompletion in Visual Studio Code and other IDEs'); | ||
output.print('Definitions were generated in steps.d.ts'); | ||
output.print('Load them by adding at the top of a test file:'); | ||
output.print(output.colors.grey(`\n/// <reference path="./steps.d.ts" />`)); | ||
let helpers = container.helpers(); | ||
let suppportI = container.support('I'); | ||
let translations = container.translation(); | ||
let methods = []; | ||
let actions = []; | ||
for (let name in helpers) { | ||
let helper = helpers[name]; | ||
methodsOfObject(helper).forEach((action) => { | ||
let actionAlias = container.translation() ? container.translation().actionAliasFor(action) : action; | ||
if (!actions[actionAlias]) { | ||
let params = getParamNames(helper[action]); | ||
if (params) params = params.join(', '); | ||
if (!params) params = ''; | ||
methods.push(` ${(actionAlias)}: (${params}) => any; \n`); | ||
actions[actionAlias] = 1 | ||
} | ||
}); | ||
} | ||
for (let name in suppportI) { | ||
if (actions[name]) { | ||
continue | ||
} | ||
let actor = suppportI[name]; | ||
let params = getParamNames(actor); | ||
if (params) params = params.join(', '); | ||
if (!params) params = ''; | ||
methods.push(` ${(name)}: (${params}) => any; \n`); | ||
} | ||
let definitionsTemplate = template.replace('{{methods}}', methods.join('')); | ||
definitionsTemplate = definitionsTemplate.replace(/\{\{I\}\}/g, container.translation().I); | ||
fs.writeFileSync(path.join(testsPath, 'steps.d.ts'), definitionsTemplate); | ||
output.print('TypeScript Definitions provide autocompletion in Visual Studio Code and other IDEs'); | ||
output.print('Definitions were generated in steps.d.ts'); | ||
output.print('Load them by adding at the top of a test file:'); | ||
output.print(output.colors.grey(`\n/// <reference path="./steps.d.ts" />`)); | ||
codecept.teardown(); | ||
}); | ||
} |
@@ -17,13 +17,19 @@ 'use strict'; | ||
let codecept = new Codecept(config, options); | ||
codecept.init(testsPath); | ||
if (options.verbose) output.level(3); | ||
codecept.init(testsPath, function(err) { | ||
if (err) { | ||
output.error('Error while running bootstrap file :' + err); | ||
return; | ||
} | ||
output.print("String interactive shell for current suite..."); | ||
recorder.start(); | ||
event.emit(event.suite.before, {}); | ||
event.emit(event.test.before); | ||
require('../pause')(); | ||
recorder.add(() => event.emit(event.test.after)); | ||
recorder.add(() => event.emit(event.suite.after, {})); | ||
recorder.add(() => codecept.teardown()); | ||
if (options.verbose) output.level(3); | ||
output.print("String interactive shell for current suite..."); | ||
recorder.start(); | ||
event.emit(event.suite.before, {}); | ||
event.emit(event.test.before); | ||
require('../pause')(); | ||
recorder.add(() => event.emit(event.test.after)); | ||
recorder.add(() => event.emit(event.suite.after, {})); | ||
recorder.add(() => codecept.teardown()); | ||
}); | ||
}; |
@@ -16,28 +16,36 @@ 'use strict'; | ||
let codecept = new Codecept(config, {}); | ||
codecept.init(testsPath); | ||
output.print('List of test actions: -- '); | ||
let helpers = container.helpers(); | ||
let suppportI = container.support('I'); | ||
let actions = []; | ||
for (let name in helpers) { | ||
let helper = helpers[name]; | ||
methodsOfObject(helper).forEach((action) => { | ||
let params = getParamNames(helper[action]); | ||
codecept.init(testsPath, function(err) { | ||
if (err) { | ||
output.error('Error while running bootstrap file :' + err); | ||
return; | ||
} | ||
output.print('List of test actions: -- '); | ||
let helpers = container.helpers(); | ||
let suppportI = container.support('I'); | ||
let actions = []; | ||
for (let name in helpers) { | ||
let helper = helpers[name]; | ||
methodsOfObject(helper).forEach((action) => { | ||
let params = getParamNames(helper[action]); | ||
if (params) params = params.join(', '); | ||
actions[action] = 1; | ||
output.print(` ${output.colors.grey(name)} I.${output.colors.bold(action)}(${params})`); | ||
}); | ||
} | ||
for (let name in suppportI) { | ||
if (actions[name]) { | ||
continue | ||
} | ||
let actor = suppportI[name]; | ||
let params = getParamNames(actor); | ||
if (params) params = params.join(', '); | ||
actions[action] = 1; | ||
output.print(` ${output.colors.grey(name)} I.${output.colors.bold(action)}(${params})`); | ||
}); | ||
} | ||
for (let name in suppportI) { | ||
if (actions[name]) { | ||
continue | ||
if (!params) params = ''; | ||
output.print(` I.${output.colors.bold(name)}(${params})`); | ||
} | ||
let actor = suppportI[name]; | ||
let params = getParamNames(actor); | ||
if (params) params = params.join(', '); | ||
if (!params) params = ''; | ||
output.print(` I.${output.colors.bold(name)}(${params})`); | ||
} | ||
output.print('PS: Actions are retrieved from enabled helpers. ') | ||
output.print('Implement custom actions in your helper classes.'); | ||
output.print('PS: Actions are retrieved from enabled helpers. ') | ||
output.print('Implement custom actions in your helper classes.'); | ||
codecept.teardown(); | ||
}); | ||
}; |
@@ -16,5 +16,8 @@ 'use strict'; | ||
let codecept = new Codecept(config, options); | ||
codecept.init(testRoot); | ||
codecept.loadTests(); | ||
codecept.run(test); | ||
codecept.init(testRoot, function(err) { | ||
if (err) throw new Error('Error while running bootstrap file :' + err); | ||
codecept.loadTests(); | ||
codecept.run(test); | ||
}); | ||
} catch (err) { | ||
@@ -21,0 +24,0 @@ output.print(''); |
@@ -93,10 +93,10 @@ 'use strict'; | ||
if (!protractorWrapper && ptor.ProtractorBrowser) protractorWrapper = ptor.ProtractorBrowser.wrapDriver; | ||
if (!protractorWrapper) throw Error('Current Protractor version is not supported'); | ||
if (!protractorWrapper) throw new Error('Current Protractor version is not supported'); | ||
let browser = ptor.ProtractorBrowser ? ptor.ProtractorBrowser : ptor.Browser; | ||
EC = browser.ExpectedConditions; | ||
global.by = browser.By; | ||
EC = browser.ExpectedConditions || new ptor.ProtractorExpectedConditions(browser); | ||
global.by = browser.By || ptor.ProtractorBy; | ||
if (!EC || !global.by) throw Error('Current Protractor version is not supported'); | ||
if (!EC || !global.by) throw new Error('Current Protractor version is not supported'); | ||
@@ -103,0 +103,0 @@ let driverProviderModule = requireg('protractor/built/driverProviders/'+this.options.driver); |
@@ -93,3 +93,3 @@ 'use strict'; | ||
result: (passed, failed, pending, duration) => { | ||
result: (passed, failed, skipped, duration) => { | ||
let style = colors.bgGreen; | ||
@@ -107,3 +107,3 @@ let msg = ` ${passed || 0} passed`; | ||
if (!failed) style = style.bgYellow; | ||
msg += `, ${pending} pending`; | ||
msg += `, ${skipped} skipped`; | ||
} | ||
@@ -110,0 +110,0 @@ msg += " "; |
{ | ||
"name": "codeceptjs", | ||
"version": "0.4.9", | ||
"version": "0.4.10", | ||
"description": "Modern Era Aceptance Testing Framework for NodeJS", | ||
@@ -5,0 +5,0 @@ "homepage": "http://codecept.io", |
209357
5885