Skip to content

Commit

Permalink
feat(serenity-js): upgraded Serenity/JS to 3.13.0 to introduce suppor…
Browse files Browse the repository at this point in the history
…t for Cucumber 10 (#278)
  • Loading branch information
jan-molak committed Oct 19, 2023
1 parent 9b2c389 commit b1d4fbc
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 111 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v2
Expand Down
204 changes: 102 additions & 102 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 12 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@
},
"homepage": "https://github.com/protractor-cucumber-framework/protractor-cucumber-framework",
"dependencies": {
"@serenity-js/core": "^3.11.1",
"@serenity-js/cucumber": "^3.11.1",
"@serenity-js/protractor": "^3.11.1"
"@serenity-js/core": "^3.13.0",
"@serenity-js/cucumber": "^3.13.0",
"@serenity-js/protractor": "^3.13.0"
},
"peerDependencies": {
"@cucumber/cucumber": "^7.3.2 || ^8.0.0 || ^9.0.0",
"@cucumber/cucumber": "^7.3.2 || ^8.5.0 || ^9.1.0 || ^10.0.0",
"cucumber": "^1.3.3 || ^2.3.1 || ^3.2.1 || ^4.2.1 || ^5.0.0 || ^6.0.0",
"protractor": "^5.0.0 || ^7.0.0"
},
Expand All @@ -91,15 +91,15 @@
"chai": "^4.3.10",
"chai-as-promised": "^7.1.1",
"chai-like": "^1.1.1",
"chromedriver": "^117.0.3",
"chromedriver": "^118.0.1",
"colors": "^1.4.0",
"commitizen": "^4.3.0",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.50.0",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-mocha": "^10.2.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-unicorn": "^48.0.1",
"eslint-plugin-unused-imports": "^3.0.0",
Expand Down Expand Up @@ -149,7 +149,11 @@
},
"version9": {
"module": "@cucumber/cucumber",
"version": "9.5.1"
"version": "9.6.0"
},
"version10": {
"module": "@cucumber/cucumber",
"version": "10.0.0"
}
},
"prettier": {
Expand Down
10 changes: 10 additions & 0 deletions test/cucumber/conf/cucumber10Conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
let env = require('./environment.js');

exports.config = Object.assign({}, env, {
cucumberOpts: {
require: `${__dirname}/../stepDefinitions/**/cucumber10Steps.js`,
tags: '',
format: 'summary',
'format-options': '{"colorsEnabled": false}',
},
});
13 changes: 13 additions & 0 deletions test/cucumber/stepDefinitions/cucumber10Steps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
const expect = chai.expect;
const {Given, Then} = require('@cucumber/cucumber');

Given('I go on {string}', async function (url) {
await browser.get(url);
});

Then(/the title should equal "([^"]*)"$/, async function (text) {
expect(await browser.getTitle()).to.equal(text);
});
16 changes: 16 additions & 0 deletions test/cucumber10.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
let util = require('./test_util');

describe('cucumber version 9', function () {
it('runs successful features', function () {
return util
.runOne(
'test/cucumber/conf/cucumber10Conf.js --cucumberOpts.tags @cucumber10'
)
.cucumberVersion10()
.expectExitCode(0)
.expectOutput('1 scenario (1 passed)')
.expectOutput('2 steps (2 passed)')
.expectErrors([])
.run();
});
});
17 changes: 17 additions & 0 deletions test/test_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ let CommandlineTest = function (cucumberVersion, args) {
this.cucumberVersion_ = cucumberConf.version7;
break;

case 8:
this.cucumberVersion_ = cucumberConf.version8;
break;

case 9:
this.cucumberVersion_ = cucumberConf.version9;
break;

case 10:
this.cucumberVersion_ = cucumberConf.version10;
break;

default:
throw new Error(`Cucumber ${cucumberVersion} not supported`);
}
Expand Down Expand Up @@ -105,6 +117,11 @@ let CommandlineTest = function (cucumberVersion, args) {
return self;
};

this.cucumberVersion10 = function () {
self.cucumberVersion_ = cucumberConf.version10;
return self;
};

this.expectSuccessfulRun = function (expectedOutput) {
this.expectExitCode(0);
this.expectErrors([]);
Expand Down

0 comments on commit b1d4fbc

Please sign in to comment.