Skip to content
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

Bugfix/valid session on mutliple features with restart false #519

Merged
merged 4 commits into from
May 17, 2017
Merged

Bugfix/valid session on mutliple features with restart false #519

merged 4 commits into from
May 17, 2017

Conversation

MitkoTschimev
Copy link

@MitkoTschimev MitkoTschimev commented May 13, 2017

This PR fixes the problem for the issues:

#241
#506

The problem was that the promise was returned but the resolve function then(…) was executed much later -> in this case after then next beforeSuite -> before
This means that the browser already was closed with .end().
So I moved the delete Cookies above and it worked.

Here is my debugging log to see the problem

Before fix

   Emitted | test.passed ([object Object])
 ✓ OK in 15825ms

   Emitted | test.after
   [2] Queued | hook WebDriverIO._after()
   [2] Queued | hook WebdriverioExtension._after()
after
 > [Session] cleaning cookies and localStorage
{ path: '/session/:sessionId/execute' }
   [3] Starting recording promises
   Emitted | suite.after ([object Object])
   [3] Queued | hook WebDriverIO._afterSuite()
   [3] Queued | hook WebdriverioExtension._afterSuite()
afterSuite
browser.end
{ path: '/session/498a10b3d7539a50a17baf809fa8cc5985efbbd1',
  method: 'DELETE',
  requiresSession: false }
#auth, #regressionTest - reset password --
   [4] Starting recording promises
   Emitted | suite.before ([object Object])
   [4] Queued | hook WebDriverIO._beforeSuite()
   [4] Queued | hook WebdriverioExtension._beforeSuite()
 must reset its password 2 times
beforeSuite
 > [Session] Starting singleton browser session
{ path: '/session', method: 'POST' }
   [5] Starting recording promises
   Emitted | test.before
   [5] Queued | hook WebDriverIO._before()
   [5] Queued | hook WebdriverioExtension._before()
   Error processing test.before event:
   TypeError: Cannot read property 'title' of undefined
    at EventEmitter.<anonymous> (/Users/mtschimev/workspace/porsche/pcck/slices/pcck-e2e-codeceptjs/hooks.js:29:39)
    at emitNone (events.js:91:20)
    at EventEmitter.emit (events.js:185:7)
    at Object.emit (/Users/mtschimev/ownCloud/private_workspace/CodeceptJS/lib/event.js:36:28)
    at Context.module.exports.setup (/Users/mtschimev/ownCloud/private_workspace/CodeceptJS/lib/scenario.js:94:9)
    at callFn (/Users/mtschimev/ownCloud/private_workspace/CodeceptJS/node_modules/mocha/lib/runnable.js:345:21)
    at Hook.Runnable.run (/Users/mtschimev/ownCloud/private_workspace/CodeceptJS/node_modules/mocha/lib/runnable.js:337:7)
    at next (/Users/mtschimev/ownCloud/private_workspace/CodeceptJS/node_modules/mocha/lib/runner.js:309:10)
    at Immediate.<anonymous> (/Users/mtschimev/ownCloud/private_workspace/CodeceptJS/node_modules/mocha/lib/runner.js:339:5)
    at runCallback (timers.js:651:20)
   Emitted | test.start ([object Object])
   Emitted | step.before (I am on page "https://login.porsche.com/auth/at/de_DE/login")
   [5] Queued | amOnPage: "https://login.porsche.com/auth/at/de_DE/login"
   Emitted | step.after (I am on page "https://login.porsche.com/auth/at/de_DE/login")
   [5] Queued | return step result
   [5] Queued | create new promises queue for generator
before
delete cookies after
{ path: '/session/:sessionId/cookie', method: 'DELETE' }
   [5] Error | Error: A session id is required for this command but wasn't found in the response payload
   [5] Starting <teardown> session
   Emitted | test.failed ([object Object])
   [5] <teardown> Queued | hook WebDriverIO._failed()
   [5] <teardown> Queued | hook WebdriverioExtension._failed()
   [5] <teardown> Queued | () => done(err)
   [5] <teardown> Stopping recording promises

After the fix:

   Emitted | test.passed ([object Object])
 ✓ OK in 15626ms

   Emitted | test.after
   [2] Queued | hook WebDriverIO._after()
   [2] Queued | hook WebdriverioExtension._after()
after
 > [Session] cleaning cookies and localStorage
{ path: '/session/:sessionId/execute' }
{ path: '/session/:sessionId/cookie', method: 'DELETE' }
   [3] Starting recording promises
   Emitted | suite.after ([object Object])
   [3] Queued | hook WebDriverIO._afterSuite()
   [3] Queued | hook WebdriverioExtension._afterSuite()
afterSuite
browser.end
{ path: '/session/f37dc843201906d1900712c7c3900a40150b6cec',
  method: 'DELETE',
  requiresSession: false }
#auth, #regressionTest - reset password --

Mitko Tschimev and others added 4 commits December 22, 2016 10:22
# Conflicts:
#	lib/interfaces/bdd.js
The problem was that the promise was returned but the resolve function then(…) was executed much later -> in this case after then next beforeSuite -> before
This means that the browser already was closed with .end().
So I moved the delete Cookies above and it worked.
@DavertMik
Copy link
Contributor

Ok, I can't reproduce it so I will trust you 🙃

@DavertMik DavertMik merged commit 21d4996 into codeceptjs:master May 17, 2017
@MitkoTschimev MitkoTschimev deleted the bugfix/valid-session-on-mutliple-features-with-restart-false branch May 18, 2017 20:43
@MitkoTschimev MitkoTschimev restored the bugfix/valid-session-on-mutliple-features-with-restart-false branch May 18, 2017 20:44
@MitkoTschimev MitkoTschimev deleted the bugfix/valid-session-on-mutliple-features-with-restart-false branch May 18, 2017 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants