Giter Site home page Giter Site logo

serenity-js / serenity-js Goto Github PK

View Code? Open in Web Editor NEW
535.0 35.0 159.0 453.46 MB

A next generation, full-stack acceptance testing framework optimised for collaboration, speed and scale!

Home Page: https://serenity-js.org

License: Apache License 2.0

TypeScript 97.52% JavaScript 1.18% HTML 0.94% Gherkin 0.31% Makefile 0.04% Shell 0.01%
bdd acceptance-testing screenplay-pattern e2e-testing playwright api-testing automated-testing end-to-end-testing test-automation test-integration

serenity-js's Introduction

Serenity/JS

NPM Version Downloads FOSSA Status CodeFactor Contributors GitHub stars

Build Status Coverage Status Known Vulnerabilities Libraries.io dependency status for latest release, scoped npm package semantic-release

Serenity/JS on GitHub Serenity/JS on StackOverflow Contribute with Gitpod

Follow Serenity/JS on LinkedIn Watch Serenity/JS on YouTube Join Serenity/JS Community Chat Support Serenity/JS on GitHub

Serenity/JS is an innovative framework designed to make acceptance and regression testing of complex software systems faster, more collaborative and easier to scale.

To get started, check out the comprehensive Serenity/JS Handbook, API documentation, and Serenity/JS project templates on GitHub.

If you have any questions or just want to say hello, join the Serenity/JS Community Chat.

Stay up to date

New tutorials and videos are coming soon, follow Serenity/JS on LinkedIn and subscribe to Serenity/JS YouTube channel to get notified when they're available!

Your feedback matters!

Do you find Serenity/JS useful? Give it a ⭐ star on GitHub!

GitHub stars

Found a bug? Need a feature? Raise an issue or submit a pull request.

Have feedback? Let me know on LinkedIn or leave a comment in Serenity/JS discussions on GitHub

If you'd like to chat with fellow users of Serenity/JS, join us on Serenity/JS Community Chat.

Support Serenity/JS

Serenity/JS is a free open-source framework, so we rely on our wonderful GitHub sponsors to keep the lights on.

If you appreciate all the effort that goes into making sophisticated tools easy to work with, please support our work and become a Serenity/JS GitHub Sponsor today!

GitHub Sponsors

For corporate sponsorship or commercial support, please contact Jan Molak.

License

The Serenity/JS code base is licensed under the Apache-2.0 license, while its documentation and the Serenity/JS Handbook are licensed under the Creative Commons BY-NC-SA 4.0 International. Learn more.

FOSSA Status


- Copyright © 2016- Jan Molak and the Serenity Team


Serenity/JS is available as part of your Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

serenity-js's People

Contributors

andreasmarkussen avatar asnov avatar benallard avatar damonpam avatar dependabot-preview[bot] avatar dependabot[bot] avatar fparmu avatar greenkeeper[bot] avatar himanshu21git avatar in1th avatar invictusmb avatar jan-molak avatar manuelfidalgo avatar mend-bolt-for-github[bot] avatar mustafa-turab-ali avatar nathannaveen avatar nbarrett avatar nchursin avatar renovate-bot avatar renovate[bot] avatar smartcode-devbot avatar sobolevn avatar swalchemist avatar testifyqa avatar theloniustester avatar toni-isidoro avatar turekbot avatar viper3400 avatar wakaleo avatar wswebcreation avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

serenity-js's Issues

RangeError: Maximum call stack size exceeded

I've updated serenity-js to version 1.4.1 then I did a sample test execution on it, but what happened is that all my test are failed and an RangeError has been thrown. Here's the sample log:

[12:28:57] I/launcher - Running 1 instances of WebDriver
[12:28:57] I/direct - Using ChromeDriver directly...
Feature: Country Selector

  In order to view products from other countries
  As a user of the website
  I want to be able to change my locale

@WMPAT-19 @AcademicEcommFlow
Scenario: Change Location
× Given that I am visiting the Corporate Home Page

  • When I change the country locale to United Kingdom
  • Then the country locale has changed to United Kingdom

Failures:

  1. Scenario: Change Location - features\shared\country_selector.feature:17
    Step: Given that I am visiting the Corporate Home Page - features\shared\country_selector.feature:11
    Step Definition: node_modules\serenity-js\src\serenity-cucumber\webdriver_synchroniser.ts:47
    Message:
    RangeError: Maximum call stack size exceeded
    at RegExp.[Symbol.replace] (native)
    at RegExp.[Symbol.replace] (native)
    at String.replace (native)
    at Object.describe_as (D:\Serenity\Temp\node_modules\serenity-js\src\serenity\recording\activity_description.ts:13:20)
    at Start.target.toString (D:\Serenity\Temp\node_modules\serenity-js\src\serenity\recording\step_annotation.ts:12:28)
    at stringify (D:\Serenity\Temp\node_modules\serenity-js\src\serenity\recording\activity_description.ts:26:50)
    at D:\Serenity\Temp\node_modules\serenity-js\src\serenity\recording\activity_description.ts:19:53
    at RegExp.[Symbol.replace] (native)
    at RegExp.[Symbol.replace] (native)
    at String.replace (native)
    From: Task:
    at World.stepWrapper (D:\Serenity\Temp\node_modules\serenity-js\src\serenity-cucumber\webdriver_synchroniser.ts:72:18)
    at World.stepWrapper (D:\Serenity\Temp\node_modules\serenity-js\src\serenity-cucumber\webdriver_synchroniser.ts:104:32)
    at World.arity0 (eval at (D:\Serenity\Temp\node_modules\util-arity\arity.js:22:24), :3:39)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)

1 scenario (1 failed)
3 steps (1 failed, 2 skipped)
0m00.010s
[12:29:11] I/launcher - 0 instance(s) of WebDriver still running
[12:29:11] I/launcher - chrome #1 failed 1 test(s)
[12:29:11] I/launcher - overall: 1 failed spec(s)
[12:29:11] E/launcher - Process exited with error code 1
.
.
.
.
(node:16472) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property '0'
of undefined
Some of the npm scripts have failed:
protractor | [email protected] protractor: protractor ./protractor.conf.js Exit status 1 |

npm ERR! Test failed. See above for more details.

Orphaned chromedriver processes

When moving from Serenity-js: 1.2.4 to Serenity-js: 1.3.0. When running more than one scenario (not sharded) there are orphaned Chromedriver instances hanging over at the end of each scenario.

I am running Windows 7, chromedriver 2.28

Task to create navigate to a URL

Hi,

I'm looking for a task to navigate to a URL in middle of the test execution, can any one help creating a task.

Currently we have a task to open a browser with a URL Open.browserOn(URL) ,

But we don't have a task to navigate to a URL in middle of a test case.

Using selenium we can do it as below

driver.navigate().to("http://www.example.com")

Scenario:

A user has visited a shopping site and logged in

he want to navigate to a mobile accessories section which is possible in 2 ways

  1. search for the appropriate option from menu and select
  2. Directly use the deep link to navigate to that page

I want to test the second scenario so first I will start the browser with the home URL and login, now try navigating to the URL using deep link.

Regards
Srini

using latest serenity-cli

How to use latest version of serenity-cli jar when running node_modules/serenity-cli/bin/serenity update

its always download the old version

trying to modify config.js to

artifact: 'net.serenity-bdd:serenity-cli:jar:1.1.37-rc.6',
    repository: 'https://dl.bintray.com/serenity/maven/'

running npm run report produce an error

error: no main manifest attribute,
(node:14860) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): Error: no main manifest attribute,

Configuration: integrator-browserstack-tunnel

Hi, i tried configurate BrowserStack Tunel with:

npm install --save integrator-browserstack-tunnel

But I can't make it work. My configuration is as follows:

configurations: {
browserstack: {
plugins: [
new integratorBrowserstackTunnel('userKey')
],
common: {
hub: 'http://hub.browserstack.com/wd/hub',
capabilities: {
'browserstack.user' : process.env.BROWSERSTACK_USERNAME || 'userName',
'browserstack.key' : process.env.BROWSERSTACK_ACCESS_KEY || 'userKey',
'build': 'protractor-browserstack',
'name': 'local_test',
'browserName': 'chrome',
'browserstack.local': true,
'browserstack.debug': 'true'
}
},
}
}

And the Error shown is:

/launcher - Running 1 instances of WebDriver
[21:46:44] I/hosted - Using the selenium server at http://hub.browserstack.com/wd/hub
[21:46:45] E/launcher - Authorization required
[21:46:45] E/launcher - WebDriverError: Authorization required
at WebDriverError (D:\SerenityJs\serenity-js-getting-started\node_modules\selenium-webdriver\lib\error.js:27:5)
at parseHttpResponse (D:\SerenityJs\serenity-js-getting-started\node_modules\selenium-webdriver\lib\http.js:521:11)
at doSend.then.response (D:\SerenityJs\serenity-js-getting-started\node_modules\selenium-webdriver\lib\http.js:440:13)
at process._tickCallback (internal/process/next_tick.js:109:7)
From: Task: WebDriver.createSession()
at Function.createSession (D:\SerenityJs\serenity-js-getting-started\node_modules\selenium-webdriver\lib\webdriver.js:777:24)
at Function.createSession (D:\SerenityJs\serenity-js-getting-started\node_modules\selenium-webdriver\chrome.js:709:29)
at createDriver (D:\SerenityJs\serenity-js-getting-started\node_modules\selenium-webdriver\index.js:167:33)
at Builder.build (D:\SerenityJs\serenity-js-getting-started\node_modules\selenium-webdriver\index.js:623:16)
at Hosted.getNewDriver (D:\SerenityJs\serenity-js-getting-started\node_modules\protractor\lib\driverProviders\driverProvider.ts:60:29)
at Runner.createBrowser (D:\SerenityJs\serenity-js-getting-started\node_modules\protractor\lib\runner.ts:225:39)
at q.then.then (D:\SerenityJs\serenity-js-getting-started\node_modules\protractor\lib\runner.ts:391:27)
at _fulfilled (D:\SerenityJs\serenity-js-getting-started\node_modules\q\q.js:834:54)
at self.promiseDispatch.done (D:\SerenityJs\serenity-js-getting-started\node_modules\q\q.js:863:30)
at Promise.promise.promiseDispatch (D:\SerenityJs\serenity-js-getting-started\node_modules\q\q.js:796:13)
[21:46:45] E/launcher - Process exited with error code 199

If someone already configured this, please tell me how to do it

Thank you¡

Error: unable to get local issuer certificate

Hi Jan,
I am trying to run examples in serenity-js i get the below error .

$npm test

[email protected] pretest /Users/$user/Downloads/serenity-js-master/examples/todomvc-protractor-cucumber
serenity update

info: Looks like you need the latest Serenity BDD CLI jar. Let me download it for you...
events.js:160
throw er; // Unhandled 'error' event
^

Error: unable to get local issuer certificate
at Error (native)
at TLSSocket. (_tls_wrap.js:1079:38)
at emitNone (events.js:86:13)
at TLSSocket.emit (events.js:185:7)
at TLSSocket._finishInit (_tls_wrap.js:603:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:433:38)
npm ERR! Test failed. See above for more details.

Thanks
RJ

passing stack traces to serenity-cli

In Serenity BDD it's possible to pass full stack traces into the html report by means of the simplified.stack.traces property. Is it possible to do the same in serenity-js? Currently when I pop up the show stack trace modal I just get the error message, which doesn't provide much to go on:

image

btw, I'm currently trying to determine the root cause of a flickering test in tutorial-journey-planner aarrgh!

Unable to Fetch a text and store it into a string

@jan-molak ,

During my test I want to save the text of a web element and need to assert later during the test.

I'm sure "chai.expect" will help me in asserting, However I couldn't find any interaction to save the text of the Web element during the Test into a string. Do we have any such Interaction already Implemented??

Example:

WebElement txtBoxContent = driver.findElement(By.id(WebelementID)); String testValue=txtBoxContent.getText();

Above is the way to do it in Selenium, not sure how to do it here. I have tried Text.of However its returning me an object and when I try to assign it to Sting its throwing me error "argument type question string is not assignable to parameter type perform-able".

confirmationVoucher = Text.of(confirmationPage.VoucherCode)

I'm new to JavaScript/Typescript, Any help on how to handle the above scenario will be a great help. Kindly let me know if this issue is in-appropriate here I can close this issue.

Multiple Scenarios and Browserstack

Hi there,
I am using Serenity-JS fine with local Webdriver and with Selenium Grid - with multiple Features and Scenarios.
Starting to test with Browserstack cloud service only the first Scenario is finished.
After that all scenarios return with
"Step Definition: node_modules/serenity-js/src/serenity-cucumber/stage_cue.ts:6
Message:
function timed out after 10000 milliseconds
"
or
"Step Definition: node_modules/serenity-js/src/serenity-cucumber/stage_cue.ts:6
Message:
NoSuchSessionError: This driver instance does not have a valid session ID (did you call WebDriver.quit()?) and may no longer be used.
"

Using Version 1.2.1 and Protractor 5.1.1. Could this be related to angular/protractor#4087?
Have you tested this with browserstack?

Kind regards,
Torben

Error: TypeError: serenity.scenarioLifeCycleNotifier is not a function

Hi @jan-molak , After updating the version of serenity-js (1.5.0) in "package.json":

image

And then remove "plugins" from "protractor.conf.js":

image

When I try to run I get the following error:

[13:40:39] E/launcher - Error: TypeError: serenity.scenarioLifeCycleNotifier is not a function
    at Object.module.exports (D:\SerenityJs\serenity-js-getting-started\features\cucumber.hooks.ts:6:36)
    at D:\SerenityJs\serenity-js-getting-started\node_modules\cucumber\lib\cucumber\cli\support_code_loader.js:65:25
    at Array.forEach (native)
    at Object.wrapper (D:\SerenityJs\serenity-js-getting-started\node_modules\cucumber\lib\cucumber\cli\support_code_loader.js:62:15)
    at Object.initializer (D:\SerenityJs\serenity-js-getting-started\node_modules\cucumber\lib\cucumber\cli\support_code_loader.js:24:41)
    at Object.Library (D:\SerenityJs\serenity-js-getting-started\node_modules\cucumber\lib\cucumber\support_code\library.js:133:25)
    at Object.getSupportCodeLibrary (D:\SerenityJs\serenity-js-getting-started\node_modules\cucumber\lib\cucumber\cli\support_code_loader.js:10:58)
    at Object.getSupportCodeLibrary (D:\SerenityJs\serenity-js-getting-started\node_modules\cucumber\lib\cucumber\cli\configuration.js:128:32)
    at Object.getSupportCodeLibrary (D:\SerenityJs\serenity-js-getting-started\node_modules\cucumber\lib\cucumber\runtime.js:44:46)
    at Object.start (D:\SerenityJs\serenity-js-getting-started\node_modules\cucumber\lib\cucumber\runtime.js:12:37)
[13:40:39] E/launcher - Process exited with error code 100

npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "D:\\SerenityJs\\serenity-js-getting-started\\node_modules\\npm\\bin\\npm-cli.js" "run" "protractor"
npm ERR! node v6.10.3
npm ERR! npm  v2.15.12
npm ERR! code ELIFECYCLE
npm ERR! [email protected] protractor: `node ./node_modules/protractor/bin/protractor ./protractor.conf.js --silent`
npm ERR! Exit status 100

You have done the other more updated examples and they work for me, but I want this to work for me, since I need to know how to get the "index.html". And this is the only example that shows how to do it.

Thank you very much¡

Step definitions do not support callback style after being sychronized by serenity-js

If you do Getting WebDriver and Cucumber in sync step from tutorial before anything else then the test suite starts failing on Given step.

The worst part is that in console you don't see any output from test at all unless you disable preprotractor npm task. Probably not relevant to this issue, but preprotractor npm task just doesn't end properly on Mac OS.

I have created a branch to reproduce the issue
https://github.com/InvictusMB/serenity-js-getting-started/tree/syncIssue

Console output

➜  npm test

> [email protected] test /serenity-js-getting-started
> npm run protractor


> [email protected] protractor /serenity-js-getting-started
> protractor ./protractor.conf.js --silent

[11:11:37] I/local - Starting selenium standalone server...
[11:11:37] I/launcher - Running 1 instances of WebDriver
[11:11:38] I/local - Selenium standalone server started at http://192.168.0.103:56557/wd/hub
Feature: Add new items to the todo list

    In order to avoid having to remember things that need doing
    As a forgetful person
    I want to be able to record what I need to do in a place where I won't forget about them

cucumber event handlers attached via registerHandler are now passed the associated object instead of an event
getPayloadItem will be removed in the next major release
  Scenario: Adding an item to a list with other items
  ✖ Given that James has a todo list containing Buy some cookies, Walk the dog
  - When he adds Buy some cereal to his list
  - Then his todo list should contain Buy some cookies, Walk the dog, Buy some cereal

Failures:

1) Scenario: Adding an item to a list with other items - features/add_new_items.feature:7
   Step: Given that James has a todo list containing Buy some cookies, Walk the dog - features/add_new_items.feature:8
   Step Definition: node_modules/serenity-js/lib/serenity-cucumber/src/serenity-cucumber/webdriver_synchroniser.ts:44
   Message:
     function accepts a callback and returns a promise

1 scenario (1 failed)
3 steps (1 failed, 2 skipped)
0m00.001s
[11:11:40] I/local - Shutting down selenium standalone server.
[11:11:40] I/launcher - 0 instance(s) of WebDriver still running
[11:11:40] I/launcher - chrome #01 failed 1 test(s)
[11:11:40] I/launcher - overall: 1 failed spec(s)
[11:11:40] E/launcher - Process exited with error code 1

I believe this mismatch is caused by synchronizing wrapper that always returns a promise even though a wrapped function may accept a callback thus the arity of a created wrapper should be different. But I cannot reason why only the first step fails. Because others are skipped if the first one is pending or failed. Otherwise they would fail in this case too.

Initializers are not allowed in ambient contexts. (1039) within Question

I think I've got everything configured for my mocha-powered serenity project but I'm having a compilation error as follows:

[18:13:10] E/launcher - Error: TSError: ⨯ Unable to compile TypeScript
client/spec/screenplay/questions/walksProgrammeQuestions.ts (5,48): Initializers are not allowed in ambient contexts. (1039)
    at getOutput (/Users/nick/dev/git-personal/ekwg/node_modules/ts-node/src/index.ts:302:15)
    at /Users/nick/dev/git-personal/ekwg/node_modules/ts-node/src/index.ts:333:16
    at Object.compile (/Users/nick/dev/git-personal/ekwg/node_modules/ts-node/src/index.ts:492:17)
    at Module.m._compile (/Users/nick/dev/git-personal/ekwg/node_modules/ts-node/src/index.ts:385:43)
    at Module._extensions..js (module.js:580:10)
    at Object.require.extensions.(anonymous function) [as .ts] (/Users/nick/dev/git-personal/ekwg/node_modules/ts-node/src/index.ts:388:12)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)

In my Question class I'm getting this tell-tale sign:

image

Information on the web suggests I'm using a pre-2.1 version of typescript, but this isn't the case according to my package.json:

    "ts-node": "^3.0.4",
    "tslint": "4.2.0",
    "typescript": "2.3.3",

So @jan-molak --- heeeelp please!

serenity-js best practices

Hi,

What is the best practices for serenity-js?
especially for the directory structure

from serenity-js-getting-started it have page object in ui
but the feature and test file all in one directory

what is the best practices for this?

thx

Pass driver html source to serenity-cli

As an automation framework developer for my project it would be very useful if the driver html source at the point of failure could be sent to serenity-cli for consumption by the html report. Currently the HTML Source button as seen below, takes me to the first screenshot in my scenario which is not correct.

image

To me (as an enthusiastic user of the java product), being able to access the html source is a 'killer' feature of the reporting as it allows the exact DOM at the point of failure to be 'revisited' for debugging purposes. I can guess that @wakaleo added this for precisely that reason!

In fact I need to do that on my current project in order to work out which locator I need to wait for the disappearance of, in order to work around a StaleElementReferenceError that I could do without (which will become the subject of issue #60 😄 ). If you think this is a good idea @jan-molak, I could have a go at creating a PR for this feature?

Travis build for PRs is failing

I don't know why is that happening. I suspected that I broke something with changing TS compile target for specs but it seems to fail irrespective of those changes.
So I played around for a while and created 3 separate PRs touching different areas but builds for all of them fail.
I bet the build would fail even if I change only the readme.

Setup Errors

I am following the instructions to set up Serenity-js (here) , but ran into errors on "npm test" on one of the "updates" it tried to do:

C:\Users\cladroma\serenity-js-getting-started>npm test

[email protected] test C:\Users\cladroma\serenity-js-getting-started
npm run protractor

[email protected] preprotractor C:\Users\cladroma\serenity-js-getting-started
npm run webdriver:update -- --standalone

[email protected] webdriver:update C:\Users\cladroma\serenity-js-getting-started
npm run webdriver-manager update "--standalone"

[email protected] webdriver-manager C:\Users\cladroma\serenity-js-getting-started
./node_modules/protractor/bin/webdriver-manager "update"

'.' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] webdriver-manager: ./node_modules/protractor/bin/webdriver-manager "update"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] webdriver-manager script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\cladroma\AppData\Roaming\npm-cache_logs\2017-05-25T15_01_58_803Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] webdriver:update: npm run webdriver-manager update "--standalone"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] webdriver:update script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\cladroma\AppData\Roaming\npm-cache_logs\2017-05-25T15_01_58_936Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] preprotractor: npm run webdriver:update -- --standalone
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] preprotractor script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\cladroma\AppData\Roaming\npm-cache_logs\2017-05-25T15_01_59_087Z-debug.log
npm ERR! Test failed. See above for more details.

C:\Users\cladroma\serenity-js-getting-started>

C:\Users\cladroma\serenity-js-getting-started>

The logs displayed:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Users\cladroma\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'protractor' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'preprotractor', 'protractor', 'postprotractor' ]
5 info lifecycle [email protected]preprotractor: [email protected]
6 verbose lifecycle [email protected]
preprotractor: unsafe-perm in lifecycle true
7 verbose lifecycle [email protected]preprotractor: PATH: C:\Users\cladroma\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;C:\Users\cladroma\serenity-js-getting-started\node_modules.bin;C:\Users\cladroma\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;C:\Users\cladroma\serenity-js-getting-started\node_modules.bin;C:\Windows\System32;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn;C:\Program Files\Microsoft SQL Server\120\DTS\Binn;C:\WINDOWS\system32\config\systemprofile.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files\Java\jre1.8.0_71\bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\nodejs;C:\Program Files\apache-maven-3.5.0\bin;C:\Users\cladroma\AppData\Local\GitHubDesktop;C:\Program Files\Java\jdk1.8.0_131\bin;C:\Program Files\Git\cmd;C:\Program Files\Java\jre1.8.0_131\bin;C:\Program Files\nodejs;C:\Users\cladroma.dnx\bin;C:\Users\cladroma\AppData\Roaming\npm
8 verbose lifecycle [email protected]
preprotractor: CWD: C:\Users\cladroma\serenity-js-getting-started
9 silly lifecycle [email protected]preprotractor: Args: [ '/d /s /c', 'npm run webdriver:update -- --standalone' ]
10 silly lifecycle [email protected]
preprotractor: Returned: code: 1 signal: null
11 info lifecycle [email protected]~preprotractor: Failed to exec preprotractor script
12 verbose stack Error: [email protected] preprotractor: npm run webdriver:update -- --standalone
12 verbose stack Exit status 1
12 verbose stack at EventEmitter. (C:\Users\cladroma\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:279:16)
12 verbose stack at emitTwo (events.js:106:13)
12 verbose stack at EventEmitter.emit (events.js:191:7)
12 verbose stack at ChildProcess. (C:\Users\cladroma\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
12 verbose stack at emitTwo (events.js:106:13)
12 verbose stack at ChildProcess.emit (events.js:191:7)
12 verbose stack at maybeClose (internal/child_process.js:886:16)
12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
13 verbose pkgid [email protected]
14 verbose cwd C:\Users\cladroma\serenity-js-getting-started
15 verbose Windows_NT 10.0.10586
16 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Users\cladroma\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "protractor"
17 verbose node v6.10.3
18 verbose npm v4.6.1
19 error code ELIFECYCLE
20 error errno 1
21 error [email protected] preprotractor: npm run webdriver:update -- --standalone
21 error Exit status 1
22 error Failed at the [email protected] preprotractor script.
22 error This is probably not a problem with npm. There is likely additional logging output above.
23 verbose exit [ 1, true ]

Another: "RangeError: Maximum call stack size exceeded"

Hi,
When I use chai-string I get this:

RangeError: Maximum call stack size exceeded
         at Object (native)
         at baseGetTag (BLABLA\node_modules\lodash\lodash.js:3078:51)
         at baseClone (BLABLA\node_modules\lodash\lodash.js:2663:19)
         at BLABLA\node_modules\lodash\lodash.js:2702:34
         at arrayEach (BLABLA\node_modules\lodash\lodash.js:537:11)
         at baseClone (BLABLA\node_modules\lodash\lodash.js:2696:7)
         at cloneSet (BLABLA\node_modules\lodash\lodash.js:4591:28)
         at initCloneByTag (BLABLA\node_modules\lodash\lodash.js:6254:18)
         at baseClone (BLABLA\node_modules\lodash\lodash.js:2680:20)
         at BLABLA\node_modules\lodash\lodash.js:2702:34
         at arrayEach (BLABLA\node_modules\lodash\lodash.js:537:11)
         at baseClone (BLABLA\node_modules\lodash\lodash.js:2696:7)
         at BLABLA\node_modules\lodash\lodash.js:2702:34
         at arrayEach (BLABLA\node_modules\lodash\lodash.js:537:11)
         at baseClone (BLABLA\node_modules\lodash\lodash.js:2696:7)
         at BLABLA\node_modules\lodash\lodash.js:2702:34
     From: Task: <anonymous>
         at World.stepWrapper (BLABLA\node_modules\serenity-js\src\serenity-cucumber\webdriver_synchroniser.ts:72:18)
         at World.stepWrapper (BLABLA\node_modules\serenity-js\src\serenity-cucumber\webdriver_synchroniser.ts:104:32)
         at World.arity1 (eval at <anonymous> (BLABLA\node_modules\util-arity\arity.js:22:24), <anonymous>:3:41)
         at _combinedTickCallback (internal/process/next_tick.js:73:7)
         at process._tickCallback (internal/process/next_tick.js:104:9)

And the Step is doing this:

       this.Then(/^Bla bla$/, () => {
        return this.stage.theActorInTheSpotlight().attemptsTo(
            ...
            See.if(Tab.MyText("HEY!"),
                (txt) => expect(txt).to.eventually.deep.be.equalIgnoreCase("HELLO!"))
        );
       });

If I change equalIgnoreCase to equal, it works (the test fails, but it works...)
Any idea? Thanks.

Yet another Range Error: Maximum call stack size exceeded

Hi,
when I run my tests I get

RangeError: Maximum call stack size exceeded
    at baseClone (C:\df\src\frontend\node_modules\lodash\lodash.js:2641:23)
    at C:\df\src\frontend\node_modules\lodash\lodash.js:2702:34
    at arrayEach (C:\df\src\frontend\node_modules\lodash\lodash.js:537:11)
    at baseClone (C:\df\src\frontend\node_modules\lodash\lodash.js:2696:7)
    at C:\df\src\frontend\node_modules\lodash\lodash.js:2702:34
    at arrayEach (C:\df\src\frontend\node_modules\lodash\lodash.js:537:11)
    at baseClone (C:\df\src\frontend\node_modules\lodash\lodash.js:2696:7)
    at cloneSet (C:\df\src\frontend\node_modules\lodash\lodash.js:4591:28)
    at initCloneByTag (C:\df\src\frontend\node_modules\lodash\lodash.js:6254:18)
    at baseClone (C:\df\src\frontend\node_modules\lodash\lodash.js:2680:20)`

and no report is being generated.
I'm using

  • serenity-js 1.5
  • protractor 5.1.2
  • cucumber 1.3.3

A workaround is to disable protractor's promise manager by adding
SELENIUM_PROMISE_MANAGER: false,
to my protractor config. Not sure if this has any side effects, though.

this.And throws an error

I have created a cucumber scenario that has the following lines:

Given I am on the Cart page
When I change the quantity of <Title> to <Quantity>
And I click Update cart button
Then I should see <Total> as Total of the item <Title>, <Overall Total> as Overall Total and <Grand Total> as the Grand Total

But when I execute the test, it throws an error that is shown on the screenshot:
capture

Is this a legit issue or am I missing something? Thanks!

"eventually not a property of Assertion" error

While trying to run the tests (using the 2-reports branch). I get the following error:

[14:27:57] E/launcher - Error: TSError: ⨯ Unable to compile TypeScript
features\step_definitions\todo_user.steps.ts (31,14): Property 'eventually' does not exist on type 'Assertion'. (2339)
at getOutput (C:\src\js\tutorial-from-scripts-to-serenity\node_modules\ts-node\src\index.ts:312:17)
at C:\src\js\tutorial-from-scripts-to-serenity\node_modules\ts-node\src\index.ts:343:18
at Object.compile (C:\src\js\tutorial-from-scripts-to-serenity\node_modules\ts-node\src\index.ts:476:19)
at Module.m._compile (C:\src\js\tutorial-from-scripts-to-serenity\node_modules\ts-node\src\index.ts:406:44)
at Module._extensions..js (module.js:579:10)
at Object.require.extensions.(anonymous function) [as .ts] (C:\src\js\tutorial-from-scripts-to-serenity\node_modules\ts-node\src\index.ts:409:12)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)

It appears that either "chai as promises" isn't being setup properly or there is a typescript issue.

using node 6.10 and npm 4.4.1.

Am I missing something obvious?

Make the output directory configurable

Hello Jan,

Is there a way to modify the report folder that can be defined using config file or a command-line argument? As of now after I execute the tests the results are placed on the default folder mentioned. I'm planning to execute a parallel test on different URLs (example website A and B) and create different types of report per URL. By the way serenity-js is a great product. Thanks! ^_^V

Restarting protractor browser between tests can cause issues

It seems like restarting the protractor browser between tests can cause some issues:

  • an unnecessary browser session might get started after the test run is finished - #34, #43
  • the failing test might not get reported - #43

The possible root cause of those issues could be related to:

It would be great to get a reproducible scenario demonstrating this issue.

serenity-js for rest/db/appium

Hi all,

I have followed the tutorial and played around with serenity-js and have found it differs quite greatly from the serenity-bdd Java version.

One thing I haven't figured out how to do yet, is how to create test scenarios with cucumber-js that doesn't automatically instantiate protractor and a browser for each scenario.

As I'd like to use serenity-js for both our integration and acceptance tests, although I don't want it to instantiate protractor and open chrome etc. for the integration tests that only test REST-API.

Could anyone shed some light on this please?

Thanks and regards.

Gherkin 4.1.0 and above not working with Serenity/JS

Hi!

Serenity/JS works only with gherkin-javascript 4.0.0 (https://github.com/cucumber/gherkin-javascript).
The package comes with cucumber 1.3.1. Cucumber has the package as dependency (^4.0.0) configured.

With Gherkin version 4.1.0 and above following error occurs:

14:45:19.750 | SceneFinished: xxxx (result: FAILURE, error:TypeError: Path must be a string. Received undefined)

Failures:

[14:45:19] E/launcher - Error: TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.relative (path.js:1227:5)
at .../node_modules/serenity-js/src/serenity/reporting/serenity_bdd_reporter.ts:89:38
[14:45:19] E/launcher - Process exited with error code 100

I fixed this for now by adding the gherkin-javascript package to my dependencies with version 4.0.0

Hope you can fix the actual error.

Regards,
Daniel

Tag @Manual support

Hi!

Is in the future a plan to support the @Manual Tag. The behavior should be that Scenarios or Features with this annotation are in the report but not executed by the Test Framework like Cucumber.

For now my workaround is that i don't implement de Given When Then sentences in my step definitions and use @Manual on the Scenarios and Features to generate reports with manual tests. The problem here is that i always must use different sentences for my manual tests and cucumber report me that i must implement the step definitions.

For a better workaround: Is there a way to get the current tag annotation from a step definition like:

    this.Given(/^test$/, () => {
        let tags = serenity.getTags();
    });

If yes, I can use a if statement to run a step or not depend on the tag.

http://thucydides.info/docs/serenity-staging/:

Row Manual contains manual tests. In order to execute test manually you should use @Manual annotation, idea the same as for Automated row. Generally, it is possible to use it to mark scenarios (@Manual on scenario level) or all scenarios in story (@Manual on Story level). The @Manual annotation is not designed to be defined for an individual step within a test, but only for the whole test.

Regards,
Daniel

Serenity report links to the same result

Hello! I have an issue dealing with serenity report when I use a scenario outline. Given I have this feature content:

Scenario Outline: View items added in cart
Given I am in the Cart page
When I view the items in cart
Then I expect to see the added title of <Title>, with unit price of <Unit Price>, quantity of <Quantity> and total price of <Total>

Examples:
|Title                                        |Unit Price|Quantity|Total    |
|The Singular Universe and the Reality of Time|£19.99    |1       |£19.99   |
|The Reader's Brain                           |£12.99    |1       |£12.99   |

But in my serenity report, the links are only referring the same report page only after you click and it only displays the last test data executed on the report. Refer to screenshots below for clarity. Cheers!

URL links:
url links

Scenario durations:
scenario durations

Last scenario execution only displayed:
last scenario execution only displayed

failing tests not appearing in serenity html report

I might have done something completely wrong in my mocha-based serenity project but when I run the suite end to end using npm test, I see the following errors in the console:

image

But when I look at the serenity report, I don't see those failing tests at all.
If you want some context, I have a commit here in my personal project as an example.

I would expect all tests regardless of outcome to be represented in the final serenity report wouldn't I?

Make function a first-class Performable

It would be nice to have an API for defining tasks without having to declare classes.
Functions as Performable are more natural to JS. Also they make it easier to enforce single responsibility and promote composition over inheritance.

In our team when we reviewed the PoC of our own SerenityJS tests and the getting started guide we outlined a few points we didn't like about them:

  • There is too much cognitive load to figure out what the task does. You have to find the needed class, then scan the class for performAs method and then find what the actor does. At the end you already forgot where you started and why you where doing that.
  • Private methods make it easy to deviate from single responsibility and stuff the class with everything you can think of instead of doing proper composition.
  • Static methods look like a boilerplate only to provide a fluent DSL for Task. In most cases they can be combined and DRY'ed out to Map<setter, propertyName>. This also adds up to cognitive load when reviewing tasks.

Given the following code:

export class Start implements Task {

    static withATodoListContaining(items: string[]) {
        return new Start(items);
    }

    @step('{0} starts with a Todo List containing #items') 
    performAs(actor: PerformsTasks): PromiseLike<void> {
        return actor.attemptsTo(
            Open.browserOn('/examples/angularjs/'),
            ...this.addAll(this.items)                          
        );                                                    
    }

    constructor(private items: string[]) {
    }

    private addAll(items: string[]): Task[] {     
        return items.map(item => AddATodoItem.called(item)); 
    }
}

We would prefer to have instead:

const addAllTodos = (actor, {items}) => {
  const addItems = items.map(item => AddATodoItem.called(item));
  return actor.attemptsTo(
    ...addItems
  );
};

export const Start =
  defineTask()
    .annotate('{0} starts with a Todo List containing #items')
    .addActions(
      Open.browserOn('/examples/angularjs/'),
      addAllTodos
    )
    .defineSetters({withATodoListContaining: 'items'});

Which if needed can further be decomposed to:

const addAllTodos = (actor, {items}) => {
  const addItems = items.map(item => AddATodoItem.called(item));
  return actor.attemptsTo(
    ...addItems
  );
};

const RunApplication =
  defineTask()
    .addActions(Open.browserOn('/examples/angularjs/'));

export const Start =
  RunApplication
    .addActions(addAllTodos)
    .annotate('{0} starts with a Todo List containing #items')
    .defineSetters({withATodoListContaining: 'items'});

In fact I have already implemented this kind of API when playing around with getting started guide. And now my question is if it fits the philosophy of core SerenityJS and can be incorporated or should I release it as a standalone utility?

How to use .then(()=>) inside actor abilities

Hi Jan/Barret,

Is there any way I can use .then(()=>) inside the actor abilities. My issue is I am currently facing some stability issues as I have series of Tasks that are to be performed as a series I want to use it with then sample code is as below.

Execute a task after the completion of first task

return stage.theActorCalled(name).attemptsTo(
    Start.andNavigateToLoginPage().then(()=> {
        Login.UsingPNRReference(
            testBooking['bookingReference'] || testBooking['eTicket'], 
            testBooking['lastName']
        )
    })  
)

or something like Execute the action after completion of an action

@performAs(actor: PerformsTasks): PromiseLike<void> {
    if(this.stringValue.length>6&&this.stringValue.startsWith('0')==false) {		
        return actor.attemptsTo(
            Enter.theValue(this.stringValue)
                  .into(LoginPage.User_Name_Input_Box),
            Enter.theValue(this.stringValueTwo)
                  .into(LoginPage.Password_Input_Box).then(() => {
                      Click.on(LoginPage.Login_Button)
                  }),
            Wait.upTo(Duration.ofSeconds(60)).until(ProfilePage.Full_Name, Is.clickable())
        )
    }
    else {}

I'm learning with automation using serenityjs, kindly let me know if this is irrelevant here. I can close this

Fail: node_modules/serenity-js/lib/serenity-protractor/plugin Plugin Tests

When i try to run "npm test" The following error is displayed:

1 scenario (1 passed)
3 steps (3 passed)
0m04.651s
[SerenityProtractorPlugin] An error occurred during teardown TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.relative (path.js:539:5)
    at D:\SerenityJs\serenity-js-getting-started\node_modules\serenity-js\src\serenity\stage\json_reporter.ts:226:38
    at process._tickCallback (internal/process/next_tick.js:109:7)
[16:56:28] I/plugins -           Fail:  node_modules/serenity-js/lib/serenity-protractor/plugin Plugin Tests
[16:56:28] E/plugins -          Failure during teardown: Path must be a string. Received undefined
[16:56:28] E/plugins -          TypeError: Path must be a string. Received undefined
                    at assertPath (path.js:7:11)
                    at Object.relative (path.js:539:5)
                    at D:\SerenityJs\serenity-js-getting-started\node_modules\serenity-js\src\serenity\stage\json_reporter.ts:226:38
                    at process._tickCallback (internal/process/next_tick.js:109:7)
[16:56:29] I/local - Shutting down selenium standalone server.
[16:56:29] I/launcher - 0 instance(s) of WebDriver still running
[16:56:29] I/launcher - chrome #01 failed 1 test(s)
[16:56:29] I/launcher - overall: 1 failed spec(s)
[16:56:29] E/launcher - Process exited with error code 1

Support for cucumber 2 (rc's)

I believe support for cucumber 2 is missing at the moment. Is that correct?

$ npm ls serenity-js
+-- UNMET PEER DEPENDENCY [email protected]
`-- [email protected]

Installed both [email protected] and serenity-js 1.2.0.

node ..\..\node_modules\protractor\bin\protractor 
(node:11616) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
[08:00:18] I/launcher - Running 1 instances of WebDriver
[08:00:18] I/direct - Using ChromeDriver directly...
[08:00:22] E/launcher - Error: TypeError: Cannot call a class as a function
Error: TypeError: Cannot call a class as a function

I believe that error has to do with the cli changes in cucumber. See this PR for protractor-cucumber-framework

Consuming SerenityJS API from es5/6

Currently SerenityJS kind of forces you to use TypeScript which is not always feasible. It would be nice to expose an API that can be consumed from es5/6 code without an extra boilerplate.

There are two things that make me sad:

  • Step decorators require boilerplate to consume them in es5.
  • Defining a Task requires writing a class. Having a class only to host one performAs method is too Java like redundant.

The following steps could address those issues:

  • Expose a helper that will decorate a Task Provide a task description via toString method instead of a decorator
  • Make function a first-class Performable (#21)

I have converted getting started tutorial to es6 with Babel as a proof of concept. It required me to create a helper to reduce a boilerplate and wrap plain functions into SerenityJS compatible Task.

Task definitions ended up like this:

export const AddATodoItem = createTask('{0} adds a Todo Item called #itemName',
  {called: 'itemName'},
  function(actor) {
    return actor.attemptsTo(
      Enter.theValue(this.itemName)
        .into(TodoList.What_Needs_To_Be_Done)
        .thenHit(Key.ENTER)
    );
  }
);

Which was still far from perfect but a good place to start if you are limited to es5/6.

Allow Activity to be automatically retried on StaleElementReferenceError

Most WebDriver automation projects I've worked on require me to reluctantly spend a portion of my life wrestling with StaleElementReferenceError. Most of the time this is worked around by some form of ExpectedCondition that waits for some aspect of the DOM to appear or disappear before I can then safely resolve the Target I am really interested in.

But this always feels like the wrong thing to do. Another strategy that has worked in the java product has been to catch StaleElementReferenceError and then retry the performAs action again, however I have found myself repeatedly sprinkling this defensive coding around multiple tasks on my project which isn't very DRY.

Given that Serenity's Target wisely contains a locator rather than a WebElement reference, to me this lends itself to some form of retry mechanism being built into serenity itself e.g. in:

  • BrowseTheWeb.as(actor).locateAll()
  • BrowseTheWeb.as(actor).locate()
  • (others?)

Note: Unlike the case with a WebElement where an attempt to retry an action (e.g. getText()) following StaleElementReferenceError will always rethrow the same error, the smart thing about Target is that a new WebElement is created every time it's resolved therefore a retry is likely to succeed once the DOM has settled down.

What do the authors think?

Make huge example

Hi,

I haven't found any large example in github yet. Only this project use serenity-js

I want to see, how handle serenity (and screenplay pattern) this subject in a large example.

  • authentication/authorization
  • basic pages (user settings, blog etc..)
  • advanced pages (search, wizzard)
  • multiple environments (rest resources)
  • component test like datepicker, dropdown, datable, forms etc..

How do I ask a question in a task?

Hey @jan-molak - here's something that is stumping me now I am using Serenity in javascript rather than java....

I need to be able ask a question within a task as I need to perform actions based on what I find in the question data (aka: answer). In Java I would normally say <Question>.answeredBy(actor) -> <data>, however in the serenity-js I see we pass a different actor interface into the Task:

performAs(actor: PerformsTasks):

as opposed to the question...

answeredBy(actor: UsesAbilities):

So within my task, I'm getting this problem:

image

I did see in the serenity source this kind of magic performAs(actor: UsesAbilities & AnswersQuestions): PromiseLike<void>, but I was unable to decipher whether this treatment is applicable to the problem above. Any thoughts please?

PS: Thanks for helping us all learn typescript as well as the awesome serenity-js!

Timing issue with 2 select steps

Hi,

I'm calling 2 steps in my feature which pick values from a select box using a task which uses Select.theValue(..).from(..)

The 2nd value doesn't get chosen. If I repeat the step 10 times, it does get chosen, leading me to think it's a timing issue. Similarly if I omit the first step and use the 2nd on it's own, it works as expected.

Any ideas?

Support for Screenplay-style explicit and fluent wait

Hi,

I Loved the concept of Screenplay pattern. I would love to learn this. Concept is clear.
But I'm new to Automation with Javascript. Used serenity in the past with Java. I'm wondering if there is a boilerplate available for javascript/serenityjs(Screenplay pattern)/protractor combination.

Waiting to see a boilerplate using javascript :)
Thanks in Advance

Regards
Srini

TypeError: Cannot read property 'theActorCalled' of undefined

I have already advanced with the implementation but now I get the following error:

Failures:

  1. Scenario: Adding an item to a list with other items - features\add_new_items.feature:7
    Step: Given that James has a todo list containing Buy some cookies, Walk the dog - features\add_new_items.feature:9
    Step Definition: node_modules\serenity-js\src\serenity-cucumber\webdriver_synchroniser.ts:47
    Message:
    TypeError: Cannot read property 'theActorCalled' of undefined
    at . (D:\SerenityJs\serenity-js-getting-started\features\step_definitions\todo_user.steps.ts:26:26)
    at D:\SerenityJs\serenity-js-getting-started\node_modules\serenity-js\src\serenity-cucumber\webdriver_synchroniser.ts:72:45
    at TaskQueue.execute_ (D:\SerenityJs\serenity-js-getting-started\node_modules\selenium-webdriver\lib\promise.js:2970:14)
    at TaskQueue.executeNext_ (D:\SerenityJs\serenity-js-getting-started\node_modules\selenium-webdriver\lib\promise.js:2953:27)
    at asyncRun (D:\SerenityJs\serenity-js-getting-started\node_modules\selenium-webdriver\lib\promise.js:2860:25)
    at D:\SerenityJs\serenity-js-getting-started\node_modules\selenium-webdriver\lib\promise.js:676:7
    at process._tickCallback (internal/process/next_tick.js:109:7)
    From: Task:
    at stepWrapper (D:\SerenityJs\serenity-js-getting-started\node_modules\serenity-js\src\serenity-cucumber\webdriver_synchroniser.ts:72:18)
    at stepWrapper (D:\SerenityJs\serenity-js-getting-started\node_modules\serenity-js\src\serenity-cucumber\webdriver_synchroniser.ts:104:32)
    at arity2 (eval at (D:\SerenityJs\serenity-js-getting-started\node_modules\util-arity\arity.js:22:24), :3:45)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)

1 scenario (1 failed)
3 steps (1 failed, 2 skipped)

image

image

image

image

image

image

Better experience when running tests with IntelliJ/WebStorm

To provide a better developer experience when running tests with IntelliJ and WebStorm, Serenity/JS should report additional information to the Protractor test runner:

  • Test execution time, via a durationMillis property on the scenarioInfo object

It seems like it would be cool to also report:

  • Top-level steps executed (Given/When/Then), so that the test execution tree can provide more information (YouTrack)
  • "ignored" (mocha) and "pending" (cucumber) steps - currently Protractor only recognises passes and failures, but we could augment the testInfo object with some additional information. @segrey?
  • I'm not sure what would enable going from a specific test result in the test execution tree to the actual file? Probably IntelliJ would need to know about the file path somehow? @segrey?

import { protractor } from 'protractor'; in serenityJS guide

Hello,

i have update to serenity-js 0.6.2, when i type this

// features/step_definitions/todo_user.steps.ts

import { protractor } from 'protractor';

// ...

export = function todoUserSteps() {

    let actor: Actor;

    this.Given(/^.*that (.*) has a todo list containing (.*)$/, (actorName: string, items: string) => {

        actor = Actor.named(actorName).whoCan(BrowseTheWeb.using(protractor.browser));

got an error Unresolved variable browser.

and i should use import { protractor } from 'protractor/built'; and its works.

something wrong with my code or the guide?

multiCapabilities - multiReports

Hello everyone,

In this moment i am run the test cases with the option multiCapabilities of BrowserStack, thus the test cases run parallel. The problem is that only generate the report with the last browser that run. I would like to know if i can define diferents routes to generate a "Serenity" report for each browser in which the test cases are executed?

Then send my configuration:

var browserstack = require('browserstack-local');
const crew = require('serenity-js/lib/stage_crew');
require('ts-node/register');

exports.config = {

    baseUrl: 'http://todomvc.com',

    // https://github.com/angular/protractor/blob/master/docs/timeouts.md
    allScriptsTimeout: 110000,
    seleniumAddress: 'http://hub-cloud.browserstack.com/wd/hub',
    framework: 'custom',
    //frameworkPath: require.resolve('protractor-cucumber-framework'),
    frameworkPath: require.resolve('serenity-js'),
    serenity: {
        dialect: 'cucumber',
        crew: [
            crew.serenityBDDReporter(),
            crew.consoleReporter(),
            crew.Photographer.who(_ => _
                .takesPhotosOf(_.Tasks_and_Interactions)
                .takesPhotosWhen(_.Activity_Finishes)
            )
        ]
    },

    specs: [ 'features/**/*.feature' ],
    cucumberOpts: {
        require:    [ 'features/**/*.ts' ],
        format:     'pretty',
        compiler:   'ts:ts-node/register'
    },

    'commonCapabilities': {
    'browserstack.user' : process.env.BROWSERSTACK_USERNAME || 'userName',
    'browserstack.key' : process.env.BROWSERSTACK_ACCESS_KEY || 'accesKey',
    'build': 'protractor-browserstack',
    'name': 'parallel_local_test',
    'browserstack.local': true,
    'browserstack.debug': 'true'
  },

  'multiCapabilities': [{
    'browserName': 'Chrome'
  },{
    'browserName': 'Firefox'
  },{
    'browserName': 'IE'
  }],

   beforeLaunch: function(){
    console.log("Connecting local");
    return new Promise(function(resolve, reject){
      exports.bs_local = new browserstack.Local();
      exports.bs_local.start({'key': exports.config.commonCapabilities['browserstack.key'] }, function(error) {
        if (error) return reject(error);
        console.log('Connected. Now testing...');

        resolve();
      });
    });
  },

  // Code to stop browserstack local after end of test
  afterLaunch: function(){
    return new Promise(function(resolve, reject){
      exports.bs_local.stop(resolve);
    });
  }

    // so that every tests starts with a system in a known state
    //restartBrowserBetweenTests: true
};

exports.config.multiCapabilities.forEach(function(caps){
  for(var i in exports.config.commonCapabilities) caps[i] = caps[i] || exports.config.commonCapabilities[i];
});

Serentiy Report with protracor and cucumber

I have protractor cucumber example works fine, now I'm trying to create report by serenity.js

protractor.conf.js file

exports.config = {
    getPageTimeout: 600000,
    allScriptsTimeout: 700000,
    framework: 'custom',
    frameworkPath: require.resolve('serenity-js'),
    capabilities: {
        'browserName': 'chrome'
    },
    specs: [
        '/home/git/adap_gateway/src/test/features/*.feature'
    ],
    baseURL: 'http://localhost:8099/',
    cucumberOpts: {
        require: '/home/git/adap_gateway/src/test/javascript/stepDefinitions.js',
        format: ['pretty'],
    }
};

The feature file

Feature: Running Cucumber with Protractor

  Scenario: Protractor and Cucumber Test
    Given I go to "http://localhost:8099/#/"
    When I add login credential
    Then I go to scenario home page
    Then I go to scenario details page
    Then I go to edit attack tree page
    Then build attack tree

ANd package.json file is

{
    "name": "c",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
     "dependencies": {
      "gulp": "^3.9.1",
      "protractor-cucumber": "^0.1.8",
     "protractor-cucumber-framework": "^3.1.0"
     },
     "devDependencies": {
     "protractor-cucumber": "^0.1.8",
     "serenity-cli": "^0.2.4",
     "serenity-js": "^1.4.1",
     },
    "scripts": {
     "test": "echo \"Error: no test specified\" && exit 1",
     "prereport": "serenity update",
     "report":  "serenity run"
    },
    "author": "",
    "license": "ISC"
}

I get

E/launcher - Error: Error: EACCES: permission denied, scandir '/etc/cups/ssl' at Error (native) at Object.fs.readdirSync (fs.js:952:18) at GlobSync._readdir (/home/ali/node_modules/cucumber/node_modules/glob/sync.js:2‌​88:41) [18:15:41] E/launcher - 
Process exited with error code 100,

Do you have any instructions?

Serenity-BDD Report generation with requirements

During report generation I get a warning that the requirements coverage reports could not be generated:

warn: net.thucydides.core.requirements.PackageRequirementsTagProvider - To generate correct requirements coverage reports you need to set the 'serenity.test.root' property to the package representing the top of your requirements hierarchy.

I see in the reports that the requirements are not mapped to the tests..

Could this be fixed by passing the requirements directory to Serenity-BDD CLI? This is not done right now?
Does it makes sense to upgrade to the latest Serentiy-BDD CLI? Or is there a reason to not do that?
I tested with the latest version and got a hanging java process..

Unable to Input value into a dropdown

Hi Jan,

First of all thank you for closing the issue 7. I was trying to explore and find how to enter the value into a drop down using a task.

I tried using below syntax it didn't work,
Enter.theValue(XX).into(XXX)

Also It would be of great help if you can suggest how to clear the data which is already in input box(I mean something to suport driver.findElementby(XXX).clear())

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.