CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

Unable to use BeforeSuite and AfterSuite hooks

Open viveklandeWK opened this issue 3 years ago • 3 comments

What are you trying to achieve?

I am trying to use BeforeSuite and AfterSuite hooks

What do you get instead?

Could not include object Step Definition from ../step_definitions/hooks.js from module 'C:\Projects\Aura-Core\aura-accelerate-seed\step_definitions\hooks.js' BeforeSuite is not a function TypeError: BeforeSuite is not a function at Object. (C:\Projects\Aura-Core\aura-accelerate-seed\step_definitions\hooks.js:4:1) at Module._compile (node:internal/modules/cjs/loader:1105:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Module.require (node:internal/modules/cjs/loader:1005:19) at require (node:internal/modules/cjs/helpers:102:18) at loadSupportObject (C:\Projects\Aura-Core\aura-accelerate-seed\node_modules\codeceptjs\lib\container.js:338:17) at loadGherkinSteps (C:\Projects\Aura-Core\aura-accelerate-seed\node_modules\codeceptjs\lib\container.js:317:7) at Function.create (C:\Projects\Aura-Core\aura-accelerate-seed\node_modules\codeceptjs\lib\container.js:48:25)

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

Provide test source code if related image


### Details

* CodeceptJS version: 3.3.3
* NodeJS Version: 16.5
* Operating System: Windows
* playwright
* Configuration file:

```js
# paste config here

viveklandeWK avatar Jul 05 '22 07:07 viveklandeWK

@viveklandeWK I think you should try to use _beforeSuite and _afterSuite instead of BeforeSuite and AfterSuite according to documentation of hooks

dyaroman avatar Jul 06 '22 06:07 dyaroman

Hi @dyaroman, Thanks, will give a try

viveklandeWK avatar Jul 06 '22 07:07 viveklandeWK

Hi @dyaroman, browser session not available in _beforeSuite(), do we have any way to make it available?

VivekLande avatar Sep 22 '22 11:09 VivekLande

Following documentation before creating an issue is highly recommended Thanks

DavertMik avatar Feb 15 '23 23:02 DavertMik