codeceptjs / codeceptjs/CodeceptJS

Not possible to use Before or BeforeSuite with BDD

Đang mở
#1,298 6 bình luận 2 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
4.2k
Fork
757
Merge trung bình
2 ngày 9 giờ
Pull request đã merge (30 ngày)
16

Mô tả

#### What are you trying to achieve?
I want to implemente a Before/BeforeSuite hook for all my tests

#### What do you get instead?
BeforeSuite is not defined

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

```bash
Could not include object Step Definition from ./tests/step_definitions/steps.js from module 'project/tests/step_definitions/steps.js'
BeforeSuite is not defined

Error:
at loadSupportObject (/Users/xxx/.nvm/versions/node/v8.10.0/lib/node_modules/codeceptjs/lib/container.js:212:11)
at loadGherkinSteps (/Users/xxx/.nvm/versions/node/v8.10.0/lib/node_modules/codeceptjs/lib/container.js:201:5)
at Function.create (/Users/xxx/.nvm/versions/node/v8.10.0/lib/node_modules/codeceptjs/lib/container.js:34:25)
at Codecept.init (/Users/xxx/.nvm/versions/node/v8.10.0/lib/node_modules/codeceptjs/lib/codecept.js:37:15)
at Command.module.exports (/Users/xxx/.nvm/versions/node/v8.10.0/lib/node_modules/codeceptjs/lib/command/run.js:35:14)
at Command.listener (/Users/xxx/.nvm/versions/node/v8.10.0/lib/node_modules/codeceptjs/node_modules/commander/index.js:315:8)
at emitTwo (events.js:126:13)
at Command.emit (events.js:214:7)
at Command.parseArgs (/Users/xxx/.nvm/versions/node/v8.10.0/lib/node_modules/codeceptjs/node_modules/commander/index.js:651:12)
at Command.parse (/Users/xxx/.nvm/versions/node/v8.10.0/lib/node_modules/codeceptjs/node_modules/commander/index.js:474:21)
```

> Provide test source code if related

```js
// Scenario:
Feature: Change published block type

As a Typeform user
I want to change the type of published blocks
So I can edit my forms quickly

Scenario: Change published block type

Given an editor with a multiple choice block
And I have changed the block type to dropdown
When the form is saved
Then the payload should be valid

//Steps definition
const I = actor()

const assert = require('assert')

BeforeSuite((I) => {
I.amOnPage('/')
})

```

### Details

* CodeceptJS version:1.4.2
* NodeJS Version: 8.10.0
* Operating System: Mojave
* Puppeteer
* Configuration file:

```js
{
"output": "./output",
"helpers": {
"Puppeteer": {
"url": "http://localhost:9000",
"waitForNavigation": [
"domcontentloaded",
"networkidle0"
],
"windowSize": "1280x800",
"chrome": {
"args": [
"--no-sandbox",
"--disable-setuid-sandbox"
]
},
"show": false
},
"RequestInterceptionHelper": {
"require": "./tests/request_interception_helper.js"
},
"StepHelper": {
"require": "./tests/step_helper.js"
}
},
"include": {
"customizeThemePage": "./tests/pages/customize-theme.js",
"notificationPanelPage": "./tests/pages/notifications_panel.js"
},
"mocha": {},
"bootstrap": false,
"teardown": null,
"hooks": [],
"gherkin": {
"features": "./tests/features/*.feature",
"steps": [
"./tests/step_definitions/steps.js"
]
},
"timeout": 10000,
"name": "xxx"
}
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.