Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlahner committed May 29, 2019
2 parents 2c96c3c + d8eca90 commit 829b068
Show file tree
Hide file tree
Showing 63 changed files with 9,447 additions and 757 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"presets": [
"es2015"
"@babel/preset-env"
],
"retainLines": false
}
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
language: node_js

node_js:
- "4"
- "5"
- "6"
- "8"
- "10"

cache:
directories:
- node_modules

before_install:
- npm install -g gulp
script:
- npm test

after_success:
- gulp docu
- npm run docu
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Scenarioo JS Versions

## Version 4.0.0

### Breaking Changes

* Not using the WebDriver Control Flow anymore, so you should set `SELENIUM_PROMISE_MANAGER` to `0` in your protractor config file.

### Bug Fixes
* When saveLastStep is activated then both the screenshot and the step.xml are correctly created. ([#80](https://github.com/scenarioo/scenarioo-js/issues/80))
* When using the fluent DSL, description is now optional for use cases. ([#88](https://github.com/scenarioo/scenarioo-js/issues/88))

### Other Changes

* Update Libraries

## Version 3.0.2
* Change license to MIT
* Improve readme file and migration guide
Expand Down
18 changes: 16 additions & 2 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
## Migration Guide
# Migration Guide

This migration guide explains how to switch from SceanriooJS 1.x to ScenariooJS 2.x
This migration guide explains how to upgrade major versions of ScenariooJS.

## 3.x to 4.x

This section explains how to switch from ScenariooJS 3.x to ScenariooJS 4.x

### Scenarioo Configuration

ScenariooJS is no longer using WebDriver Control Flow. This means you should set `SELENIUM_PROMISE_MANAGER` to `0` in your protractor config file.

For a complete example where `SELENIUM_PROMISE_MANAGER` has been configured correctly, see [Example protractor.conf.js](example/protractor.conf.js)

## 1.x to 2.x

This section explains how to switch from ScenariooJS 1.x to ScenariooJS 2.x

### Jasmine 2 Support

Expand Down
3 changes: 3 additions & 0 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fixes #{issusenumber}

describe shortly what you did and what is missing before we can merge
37 changes: 25 additions & 12 deletions README.md
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ScenariooJS
> Scenarioo writer library to produce feature rich e2e test reports, e.g. from Protractor/WebDriverJS tests with Jasmine
[![Version](https://badge.fury.io/js/scenarioo-js.png)](http://badge.fury.io/js/scenarioo-js) [![Build Status](https://travis-ci.org/scenarioo/scenarioo-js.svg?branch=develop)](https://travis-ci.org/scenarioo/scenarioo-js)
[![Version](https://badge.fury.io/js/scenarioo-js.png)](http://badge.fury.io/js/scenarioo-js) [![Build Status](https://travis-ci.org/scenarioo/scenarioo-js.svg?branch=develop)](https://travis-ci.org/scenarioo/scenarioo-js) [![Greenkeeper badge](https://badges.greenkeeper.io/scenarioo/scenarioo-js.svg)](https://greenkeeper.io/)

Using ScenariooJS in your protractor (or pure [WebDriverJs](https://code.google.com/p/selenium/wiki/WebDriverJs)) e2e tests you can generate powerful e2e test reports including screenshots and make it available to everybody involved in your project through the Scenarioo Viewer Web Application: **[see Scenarioo Viewer Demo](http://demo.scenarioo.org)**.

Expand All @@ -23,9 +23,13 @@ Some feature highlights include detection of changes in recorded screenshots and

## How to Use

### Quickstart

If you just want to get a quick glance at how it all works, then you can follow this [Quickstart Guide](http://scenarioo.org/docs/master/tutorial/Quickstart-JS.html).

### Version Notice

This documentation is for version 3.x of ScenariooJS. See [Changelog](CHANGELOG.md).
This documentation is for version 4.x of ScenariooJS. See [Changelog](CHANGELOG.md).

### Installation

Expand Down Expand Up @@ -111,10 +115,12 @@ For a quick reference, you can also have a look at the following example files a
- [Fluent DSL for simple and clean UI tests _(Recommended)_](#scenarioo-fluent-dsl)
- [exampleFluentDsl.spec.js](example/test/exampleFluentDsl.spec.js)
- [exampleFluentDslWithTypeScript.spec.ts](example/test/exampleFluentDslWithTypeScript.spec.ts)
- [exampleFluentDslLabelDefinitions.spec.js](example/test/exampleFluentDslLabelDefinitions.spec.js)
- [exampleFluentDslWithTypeScriptAndPageObjects.spec.ts](example/test/exampleFluentDslWithTypeScriptAndPageObjects.spec.ts)
- [exampleFluentDslLabelDefinitions.js](example/test/exampleFluentDslLabelDefinitions.js)
- [exampleFluentDslPendingUseCase.spec.js](example/test/exampleFluentDslPendingUseCase.spec.js)
- [Vanilla Jasmine](#vanilla-jasmine-style)
- [exampleBasicJasmine.spec.js](example/test/exampleBasicJasmine.spec.js)
- [exampleBasicJasmineWithTypeScript.spec.ts](example/test/exampleBasicJasmineWithTypeScript.spec.ts)
- [exampleFailingTests.spec.js](example/test/exampleFailingTests.spec.js)
- [Backwards DSL for fast Migration from ScenariooJS 1 to ScenariooJS 2](#backwards-dsl-for-migration)
- [exampleBackwardsDsl.spec.js](example/test/exampleBackwardsDsl.spec.js)
Expand Down Expand Up @@ -163,18 +169,18 @@ Scenarioo will as well automatically report one additional step with a screensho
To make this example work, the Labels have to be registered first before usage with the Fluent DSL.
Refer to [exampleFluentDslLabelDefinitions.js](example/test/exampleFluentDslLabelDefinitions.js) to see how to register
labels for usage in useCases, scenarios and steps. This is to avoid misspelling and cluttering of labels in all your tests.
But of course you do not have to add any labels, as long as you not want to label your tests.
But of course you do not have to add any labels, as long as you do not want to label your tests.

There are also functions like `fdescribe`, `xdescribe`, `xit`, `fit` in the DSL such that you have the same comfort as with using jasmine directly - or even more: there is even a special `pending` to mark temporarily disabled tests with a special pending-comment, which even works with protractor's asynch tests (contains a workaround for a known bug to the `pend`-feature of jasmine, which not works with protractor).
There are also functions like `fdescribe`, `xdescribe`, `xit`, `fit` in the DSL such that you have the same comfort as with using jasmine directly - or even more: there is even a special `pending` to mark temporarily disabled tests with a special pending-comment, which even works with protractor's async tests (contains a workaround for a known bug to the `pend`-feature of jasmine, which does not work with protractor).

If you do not like to use a special DSL in your tests, you can still use [Vanilla Jasmine Style](#vanilla-jasmine-style) to write your tests. But we not recommend to do so, because adding additional informations to your reports is less elegant using that other style.
If you do not like to use a special DSL in your tests, you can still use [Vanilla Jasmine Style](#vanilla-jasmine-style) to write your tests. But we do not recommend to do so, because adding additional information to your reports is less elegant using that style.

#### Using Scenarioo with Typescript

Typescript Typings are provided for the Fluent DSL (only).
Since the Fluent DSL is the recommended API of the future, older Scenarioo APIs do not come with typings as their usage is discouraged.
Refer to [exampleFluentDslWithTypeScript.spec.ts](example/test/exampleFluentDslWithTypeScript.spec.ts)
for a simple example using TypeScript with the Fluent DSL, which looks almost the same as above javascript example.
for a simple example using TypeScript with the Fluent DSL, which looks almost the same as the javascript example above.

#### General Recommendations About Recording Steps

Expand All @@ -184,9 +190,16 @@ Or you can try to do this by hooking into protractor functions, to ensure that a

We recommend to do it in the page objects, because that is usually the place where you know, that something worthy of recording as a step happened.

If you are using Typescript (old Jasmine syntax or the new Fluent DSL), you can follow the examples
[exampleFluentDslWithTypeScriptAndPageObjects.spec.ts](example/test/exampleFluentDslWithTypeScriptAndPageObjects.spec.ts),
[exampleBasicJasmineWithTypeScript.spec.ts](example/test/exampleBasicJasmineWithTypeScript.spec.ts) and the used page
object [startPage.ts](example/test/pages/startPage.ts) as a reference on how to use a
[Typescript Decorator](http://www.typescriptlang.org/docs/handbook/decorators.html) to perform this in an easy manner.


#### Vanilla Jasmine Style

If you prefer to write your e2e tests in your usual Jasmine style with Protractor without using special Scenarioo DSL, you can do so:
If you prefer to write your e2e tests in your usual Jasmine style with Protractor without using the special Scenarioo DSL, you can do so:

```javascript

Expand All @@ -209,17 +222,17 @@ describe('Example Usecase', function() {

```

ScenariooJS will automatically report a `use case` for every `describe`-block and a `scenario` inside this use case for every contained `it`-block during running the tests.
ScenariooJS will automatically report a `use case` for every `describe`-block and a `scenario` inside this use case for every contained `it`-block during running of the tests.

Also a step (including a screenshot and additional details about the step) is reported at the end of each test scenario (on failure or success), if you configured so (see configuration possibilities in `example/protractor.conf.js`). We recommend to turn this on, because the last step is one of the most important ones in a test, especially if there are failures.
Also a step (including a screenshot and additional details about the step) is reported at the end of each test scenario (on failure or success), if you configured this (see configuration possibilities in [Example protractor.conf.js](example/protractor.conf.js)). We recommend to turn this on, because the last step is one of the most important ones in a test, especially if there are failures.

Additional steps of a scenario can be reported by manually calling `scenarioo.saveStep('stepName');` in your tests.

Instead of using the Vanilla Jasmine Style, we recommend to use the special [Scenarioo Fluent DSL](#) which makes it even more easier to add additional information (like descriptions, labels, etc.) to your test reports.
Instead of using the Vanilla Jasmine Style, we recommend to use the special [Scenarioo Fluent DSL](#scenarioo-fluent-dsl) which makes it even easier to add additional information (like descriptions, labels, etc.) to your test reports.

#### Backwards DSL for Migration

There is also a `Backward DSL` that is only interesting for easier migration from old scenarioo 1.x tests to the new scenarioo 2.x library with jasmine 2. See [Migration Guide](MIGRATION.md) on how to use this.
There is also a `Backward DSL` that is only interesting for an easier migration from old scenarioo 1.x tests to the new scenarioo 2.x library with jasmine 2. See [Migration Guide](MIGRATION.md) on how to use this.

#### Define Custom App-specific DSL

Expand Down
28 changes: 9 additions & 19 deletions build/build.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
var
const
gulp = require('gulp'),
babel = require('gulp-babel'),
del = require('del');

gulp.task('cleanLib', function () {
return del('lib/*');
});
gulp.task('clean', () => del('lib/*'));

gulp.task('copyTypings', ['cleanLib'], function () {
return gulp.src('src/**/*.d.ts')
.pipe(gulp.dest('lib'));
});
gulp.task('copyTypings', () => gulp.src('src/**/*.d.ts').pipe(gulp.dest('lib')));

gulp.task('copyJsons', ['cleanLib'], function () {
return gulp.src('src/**/*.json')
.pipe(gulp.dest('lib'));
});
gulp.task('copyJsons', () => gulp.src('src/**/*.json').pipe(gulp.dest('lib')));

gulp.task('build', ['copyJsons', 'copyTypings', 'lint', 'test'], function () {
return gulp.src('src/**/*.js')
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('lib'));
});
gulp.task('build', gulp.series(['clean', 'copyJsons', 'copyTypings', 'lint', 'test'], () => gulp.src('src/**/*.js')
.pipe(babel({
presets: ['@babel/env']
}))
.pipe(gulp.dest('lib'))));

40 changes: 0 additions & 40 deletions build/dependencyCheck.js

This file was deleted.

12 changes: 5 additions & 7 deletions build/docu.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
var
const
gulp = require('gulp'),
del = require('del'),
run = require('gulp-run');


gulp.task('docu', ['cleanDocuOut'], function () {
run('jsdoc src -r -d docu --readme ./README.md -c ./build/jsdoc.conf.json').exec().pipe(gulp.dest('output'));
});
gulp.task('cleanDocuOut', () => del('docu/*'));

gulp.task('cleanDocuOut', function () {
return del('docu/*');
});
gulp.task('docu', gulp.series(['cleanDocuOut'], () => {
run('jsdoc src -r -d docu --readme ./README.md -c ./build/jsdoc.conf.json').exec().pipe(gulp.dest('output'));
}));
16 changes: 7 additions & 9 deletions build/lint.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
var
gulp = require('gulp'),
eslint = require('gulp-eslint');
const
gulp = require('gulp'),
eslint = require('gulp-eslint');

gulp.task('lint', function () {
return gulp.src(['./gulpfile.js', './src/**/*.js', './test/unit/**/*.js', './build/*.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('lint', () => gulp.src(['./gulpfile.js', './src/**/*.js', './test/unit/**/*.js', './build/*.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError()));
21 changes: 6 additions & 15 deletions build/test.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
var
const
gulp = require('gulp'),
mocha = require('gulp-mocha'),
babelRegister = require('babel-register'),
del = require('del');


var mochaOpts = {
const mochaOpts = {
reporter: 'spec',
// our code is written in ES2015, transpile with babel before running mocha tests
// note, when you run mocha from the command line : mocha --compilers js:babel-register
compilers: {
js: babelRegister
}
compilers: ['js:@babel/register']
};

gulp.task('test', ['cleanTestOut'], function () {
return gulp.src('./test/unit/**/*.js', {read: false})
.pipe(mocha(mochaOpts));
});
gulp.task('cleanTestOut', () => del('test/out/*'));

gulp.task('cleanTestOut', function () {
return del('test/out/*');
});
gulp.task('test', gulp.series(['cleanTestOut'], () => gulp.src('./test/unit/**/*.js', {read: false})
.pipe(mocha(mochaOpts))));
2 changes: 1 addition & 1 deletion docs/contribute/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* Set correct version in `package.json` and run a full build

* **Run tests**:
* `gulp test`
* `npm test`
* run all examples and check it works as expected (see [example/README.md](../../example/README.md) for details)
* also test generated output from examples can be read by Viewer Webapp (import generated output)

Expand Down
5 changes: 5 additions & 0 deletions docs/greenkeeper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Greenkeeper
Greenkeeper will automatically generate pull requests if a dependency update is available.

For more information visit [greenkeeper.io](https://www.greenkeeper.io)

16 changes: 5 additions & 11 deletions example/README.MD
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
# Example

This example shows how to use scenarioo-js in a protractor (webdriverJS) environment.
This example shows how to use *scenarioo-js* in a *Protractor* (*WebDriverJS*) environment.

example/app contains a very simple angularJS application.
`example/app` contains a very simple *AngularJS* application, which can be used for demonstration purposes and also for contributing to *scenarioo-js*.

build the scenarioo js writer library (in scenarioo-js root)
Build the *scenarioo-js* writer library (in `scenarioo-js` root) and run the example application:

```
npm install
npm run build
```

serve the example application
by calling following in directory scenarioo-js root

```
npm run serve-example
```

Install needed dependencies (protractor) and run the tests:
Now in a second terminal change to the `example` directory. Install the dependencies and run the tests like this:

```
npm install
Expand All @@ -29,7 +23,7 @@ npm run e2e

**You should see following in the output:**<br/>
```
14 specs, 5 failures, 5 pending specs
17 specs, 5 failures, 5 pending specs
```

This is for testing and demonstrating how test failures and also pending tests are reported in scenarioo.
Expand Down
2 changes: 1 addition & 1 deletion example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<div class="container">

<h1>Scenarioo-JS Example</h1>
<h1 id="header">Scenarioo-JS Example</h1>

<ul class="list-group">
<li class="list-group-item" id="item_{{listItem}}" ng-repeat="listItem in exampleController.items"
Expand Down
Loading

0 comments on commit 829b068

Please sign in to comment.