CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

event.all.before and event.all.after not working

Open dwaned opened this issue 9 years ago • 4 comments

What are you trying to achieve?

Trying to use the event.all hooks. In the same file I have the event.test hooks which are working successfully.

What do you get instead?

event.all hooks are not called at all. I only have a console.log in them right now and they are not called.

Provide console output if related. Use --verbose mode for more details.

# paste output here

Provide test source code if related

event.dispatcher.on(event.all.before, function () { console.log('--- I am before all tests --'); });

// paste test

Details

  • CodeceptJS version: v0.6.3-pre
  • NodeJS Version: v6.10.3
  • Operating System: MacOS Sierra
  • Protractor || WebDriverIO || Nightmare version (if related)
  • Configuration file:
# paste suite config here

dwaned avatar Jul 17 '17 12:07 dwaned

Hi , I followed the link http://codecept.io/hooks to create a file that has below code `const event = require('codeceptjs').event;

module.exports = function() {

event.dispatcher.on(event.test.before, function (test) {

console.log('--- I am before test --');

}); }`

and added this file in hooks in codecept.json config file.

After running the test case it doesn't show any error and neither event is triggered. I tried with both before and after and neither works.

I added console.log for event.dispatcher and it shows events that I add, but they doesn't trigger. I have a requirement where I want to close other tabs before or after test event.

Do I need to include any files for this?

@dwaned Can you please help on this, as these events work for you.

himanshuqdabra avatar Dec 26 '17 11:12 himanshuqdabra

@APshenkin : Please look into this

ninpop25 avatar Dec 26 '17 11:12 ninpop25

I don't see where these events are emitted. Maybe @DavertMik can help us with these events

APshenkin avatar Dec 28 '17 11:12 APshenkin

Fixed in v1.1.6 which was release today.

These events now exist (again)

reubenmiller avatar Mar 01 '18 14:03 reubenmiller