Skip to content

Commit

Permalink
Merge branch 'develop' (Release 3.0.2)
Browse files Browse the repository at this point in the history
  • Loading branch information
adiherzog committed Apr 20, 2017
2 parents 825efa1 + 82efc8e commit 3c45659
Show file tree
Hide file tree
Showing 16 changed files with 206 additions and 864 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Scenarioo JS Versions

## Version 3.0.2
* Change license to MIT
* Improve readme file and migration guide

### Format Compatibility
* Writes format 2.1 that is compatible with Scenarioo Viewer 3.x and 2.x

## Version 3.0.1

### Bug Fixes
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2013-2017, scenarioo.org Development Team

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:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

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.
685 changes: 0 additions & 685 deletions LICENSE.txt

This file was deleted.

56 changes: 56 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
## Migration Guide

This migration guide explains how to switch from SceanriooJS 1.x to ScenariooJS 2.x

### Jasmine 2 Support

Version 2.x of scenarioo-js will depend on jasmine 2. jasmine 1.x support will be dropped.
Check the [Examples](/example) for a working example.

### Scenarioo Configuration

The configuration of the reporter has become more easier and has to be changed accordingly in the preparation code of your end-2-end tests.

The `scenarioo.reporter` is not available anymore. Instead you just have to call the setup function `scenarioo.setupJasmineReporter` to setup the reporter for you with jasmine 2.

See documentation above for `Configuration` to see how this works now.

### Application-specific DSL

The `scenarioo.describeScenario` and `scenarioo.describeUseCase` functions are not defined anymore out of the box,
and have either to be replaced by pure jasmine, a custom written DSL or by one of the out of the box provided DSLs.

We recommend to use the new `Fluent DSL` or your own defined Application-Specific DSL
but for a fast migration it might be most easy to use the `Backwards DSL`, that is provided only for fast migration.

### Backwards DSL for Fast Migration

Using Backwards DSL you can use the same old functions, that you had in ScenariooJS 0.x and 1.x.

The `Backwards DSL` can be activated as follows:

```
// call this in your protractor onPrepare code to activate backwards DSL functions
scenarioo.setupBackwardsDsl();
```

This brings you the old 1.x style DSL with `describeUseCase` and `describeScenario` functions back, for easier migration
(with or without `scenarioo.` in front, both works).

You can then later migrate those tests to the new `Fluent DSL` or even your own defined DSL or the pure vanilla jasmine 2 syntax.
We recommend to have a look at the new [Examples](/example) to see what style fits best for your project.

### Save Steps with `scenarioo.saveStep`

The "saveStep" function is now directly exposed on scenarioo:

```javascript
scenarioo.describeUseCase('Example Usecase', function () {

scenarioo.describeScenario('Example Scenario ', function () {
scenarioo.saveStep('start'); // instead of scenarioo.docuWriter.saveStep
});

});

```
232 changes: 104 additions & 128 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/contribute/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

* **Run tests**:
* `gulp test`
* run all examples and check it works as expected
* 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)

* Commit everything to develop.
Expand Down
Binary file added docs/scenarioo-viewer-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@types/jasmine": "^2.5.47",
"@types/jasminewd2": "^2.0.2",
"http-server": "0.7.2",
"protractor": "4.0.11",
"jasmine-core": "^2.5.2",
"protractor": "5.1.1",
"ts-node": "^1.6.1",
"typescript": "~2.0.3"
},
Expand Down
11 changes: 5 additions & 6 deletions example/test/exampleFluentDslWithTypeScript.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,18 @@ useCase('Example Use Case with Fluent DSL in TypeScript')

scenario('Example Failing Scenario with several expectation failures')
.description('This scenario should demonstrate that also for each failed expectation a screenshot is taken')
.it(function exampleScenarioWithMultipleExpectationsFailingAndNoLabels() {
.it(async function exampleScenarioWithMultipleExpectationsFailingAndNoLabels() {

browser.get('/index.html');
expect(element.all(by.css('.element-not-existing')).count()).toBe(78); // will fail --> expectation failed step
expect(await element.all(by.css('.element-not-existing')).count()).toBe(78); // will fail --> expectation failed step

element(by.css('li#item_one')).click();
step('item one clicked');

expect(element.all(by.css('.another-element-not-existing')).count()).toEqual(13); // will fail --> expectation failed step

element(by.css('li#item_is_not_present')).click(); // will fail the scenario --> scenario failed step
expect(element.all(by.css('.another-element-not-existing-after-scenario-failed')).count()).toEqual(6); // will not be executed (no step)
expect(await element.all(by.css('.another-element-not-existing')).count()).toEqual(13); // will fail --> expectation failed step

await element(by.css('li#item_is_not_present')).click(); // will fail the scenario --> scenario failed step
expect(await element.all(by.css('.another-element-not-existing-after-scenario-failed')).count()).toEqual(6); // will not be executed (no step)
});

scenario('Example Failing Scenario that throws an Error')
Expand Down
4 changes: 2 additions & 2 deletions lib/docuWriter/docuWriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,10 @@ function saveScreenshot(stepCounter, absScenarioPath) {
var screenShotFileName = _path2.default.resolve(screenShotDir, (0, _utils.leadingZeros)(stepCounter) + '.png');

return browser.takeScreenshot().then(function (data) {
return(
return (
// recursively create the directory for our new screenshot
_q2.default.nfcall(_mkdirp2.default, screenShotDir).then(function () {
return(
return (
// then save screenshot file
_q2.default.nfcall(_fs2.default.writeFile, screenShotFileName, data, 'base64').then(function () {
return screenShotFileName;
Expand Down
4 changes: 2 additions & 2 deletions lib/docuWriter/screenshotSaver.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ function saveScreenshot(stepCounter, absScenarioPath) {
var screenShotFileName = _path2.default.resolve(screenShotDir, (0, _utils.leadingZeros)(stepCounter) + '.png');

return browser.takeScreenshot().then(function (data) {
return(
return (
// recursively create the directory for our new screenshot
_q2.default.nfcall(_mkdirp2.default, screenShotDir).then(function () {
return(
return (
// then save screenshot file
_q2.default.nfcall(_fs2.default.writeFile, screenShotFileName, data, 'base64').then(function () {
return screenShotFileName;
Expand Down
2 changes: 0 additions & 2 deletions lib/dsl/fluentDsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ var config = exports.config = {
*
* That is why we propose to use this DSL in real projects as a blueprint starting point for your own e2e-test DSL.
*/


function useCase(name) {

var _description, _labels, pendingMessage;
Expand Down
17 changes: 1 addition & 16 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,7 @@ Object.defineProperty(exports, "__esModule", {
value: true
});

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; /* scenarioo-js
* Copyright (C) 2014, scenarioo.org Development Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

var _scenariooJs = require('./scenarioo-js');

Expand Down
4 changes: 2 additions & 2 deletions lib/scenariooReporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function formatWithAnsiColorForStatus(message, status) {
};

var colorCode = colorsForStatus[status];
var startColor = colorCode ? '\u001b[' + colorCode + 'm' : '';
var endColor = colorCode ? '\u001b[39m' : '';
var startColor = colorCode ? '\x1B[' + colorCode + 'm' : '';
var endColor = colorCode ? '\x1B[39m' : '';
return startColor + message + endColor;
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "scenarioo-js",
"description": "Scenarioo API for Javascript to generate Scenarioo Documentations",
"version": "3.0.1",
"version": "3.0.2",
"homepage": "http://scenarioo.org",
"author": {
"name": "xeronimus",
Expand All @@ -14,7 +14,7 @@
"bugs": {
"url": "https://github.com/scenarioo/scenarioo-js/issues"
},
"license": "GPL-2.0",
"license": "MIT",
"main": "lib/index.js",
"engines": {
"node": ">= 0.10.0"
Expand Down
17 changes: 0 additions & 17 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@
/* scenarioo-js
* Copyright (C) 2014, scenarioo.org Development Team
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import scenarioo from './scenarioo-js';
import * as fluentDsl from './dsl/fluentDsl';

Expand Down

0 comments on commit 3c45659

Please sign in to comment.