New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError: Maximum call stack size exceeded #38

Closed
marktigno opened this Issue May 2, 2017 · 5 comments

Comments

2 participants
@marktigno

marktigno commented May 2, 2017

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 | wmp-serenityjs-automation@1.0.0 protractor: protractor ./protractor.conf.js Exit status 1 |

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

@jan-molak

This comment has been minimized.

Show comment
Hide comment
@jan-molak

jan-molak May 2, 2017

Owner

Hey @marktigno, could you please share the task that's mapped to Given that I am visiting the Corporate Home Page? I'm interested in its @step annotation in particular. Thanks!

Owner

jan-molak commented May 2, 2017

Hey @marktigno, could you please share the task that's mapped to Given that I am visiting the Corporate Home Page? I'm interested in its @step annotation in particular. Thanks!

@marktigno

This comment has been minimized.

Show comment
Hide comment
@marktigno

marktigno May 3, 2017

Hello @jan-molak, here's the task mapped on the above mentioned gherkin statement:

    //From the user steps:
    this.Given(/^.*that I am visiting the Corporate Home Page$/, function() {
        return stage.theActorCalled("User").attemptsTo(
            Start.openHomePage()
        )
    });

    //The class with the mapped task:
    export class Start implements Task {
        static openHomePage() {
            return new Start();
        }

        @step('{0} start visiting the website')
        performAs(actor: PerformsTasks): PromiseLike<void> {
            return actor.attemptsTo(
                Open.browserOn('/')
            );
        }

        constructor() {}
   }

marktigno commented May 3, 2017

Hello @jan-molak, here's the task mapped on the above mentioned gherkin statement:

    //From the user steps:
    this.Given(/^.*that I am visiting the Corporate Home Page$/, function() {
        return stage.theActorCalled("User").attemptsTo(
            Start.openHomePage()
        )
    });

    //The class with the mapped task:
    export class Start implements Task {
        static openHomePage() {
            return new Start();
        }

        @step('{0} start visiting the website')
        performAs(actor: PerformsTasks): PromiseLike<void> {
            return actor.attemptsTo(
                Open.browserOn('/')
            );
        }

        constructor() {}
   }

@jan-molak jan-molak added the bug label May 3, 2017

@jan-molak

This comment has been minimized.

Show comment
Hide comment
@jan-molak

jan-molak May 3, 2017

Owner

Thanks, I managed to reproduce the issue and should be able to release a fix this evening.

To make it work in the meantime, please replace the @step annotation:

    export class Start implements Task {
        static openHomePage() {
            return new Start();
        }

        @step('{0} start visiting the website')
        performAs(actor: PerformsTasks): PromiseLike<void> {
            return actor.attemptsTo(
                Open.browserOn('/')
            );
        }

        constructor() {}
   }

with toString():

    export class Start implements Task {
        static openHomePage() {
            return new Start();
        }

        performAs(actor: PerformsTasks): PromiseLike<void> {
            return actor.attemptsTo(
                Open.browserOn('/')
            );
        }

        toString = () => '{0} start visiting the website';

        constructor() {}
   }
Owner

jan-molak commented May 3, 2017

Thanks, I managed to reproduce the issue and should be able to release a fix this evening.

To make it work in the meantime, please replace the @step annotation:

    export class Start implements Task {
        static openHomePage() {
            return new Start();
        }

        @step('{0} start visiting the website')
        performAs(actor: PerformsTasks): PromiseLike<void> {
            return actor.attemptsTo(
                Open.browserOn('/')
            );
        }

        constructor() {}
   }

with toString():

    export class Start implements Task {
        static openHomePage() {
            return new Start();
        }

        performAs(actor: PerformsTasks): PromiseLike<void> {
            return actor.attemptsTo(
                Open.browserOn('/')
            );
        }

        toString = () => '{0} start visiting the website';

        constructor() {}
   }

@jan-molak jan-molak closed this in 1a8ad0f May 3, 2017

@jan-molak

This comment has been minimized.

Show comment
Hide comment
@jan-molak

jan-molak May 3, 2017

Owner

The fix is available in serenity-js v. 1.4.2, thanks for reporting the issue!

Owner

jan-molak commented May 3, 2017

The fix is available in serenity-js v. 1.4.2, thanks for reporting the issue!

@marktigno

This comment has been minimized.

Show comment
Hide comment
@marktigno

marktigno May 4, 2017

Hello @jan-molak!

Verified the fix and it is now working. Cheers!

marktigno commented May 4, 2017

Hello @jan-molak!

Verified the fix and it is now working. Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment