Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Execute before() or after() without call to capture() #919

Open
wabisabit opened this issue Jun 20, 2018 · 2 comments
Open

Execute before() or after() without call to capture() #919

wabisabit opened this issue Jun 20, 2018 · 2 comments

Comments

@wabisabit
Copy link

wabisabit commented Jun 20, 2018

Gemini version 5.7.2

I'm using executeJS in order to set a localStorage item for the next suite as explained here: #799

Although it works, in my case, I don't want to capture anything in the first suite, so using before or after instead of capture would make more sense. But without a call to capture the actions are ignored.

gemini.suite( 'Login (capture unwanted)', suite => {

  suite
    .setUrl( 'index.html' )
    .before( function( actions, find ) {

      actions.executeJS( function( window ) {
        window.localStorage.setItem( 'user', 'data' );
      } );

    } );

} );

gemini.suite( 'Logged-in app', suite => {

  suite
    .setUrl( 'index.html' )
    .setCaptureElements( 'html' )

    .capture( 'plain' )
} );

Command used to run the test:

gemini test

Result:
The localStorage item is unavailable in the second suite

Expected behaviour:
The localStorage item is available in the second suite

@FrEaKmAn
Copy link

FrEaKmAn commented Apr 1, 2019

I think you need to wrap second suite inside first one as described in Nested tests - https://gemini-testing.github.io/doc/tests.html#nested-suites to be able to access stored localStorage

@wabisabit
Copy link
Author

Thank you @FrEaKmAn I'll try that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants