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

fix #4848 TS types of methods (Feature|Scenario)Config.config #4851

Merged
merged 2 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Go over the steps in [this](https://github.com/firstcontributions/first-contribu
To start you need:

1. Fork and clone the repo.
2. Run `npm i --force --omit=optional` to install all required libraries
2. Run `npm i --force` to install all required libraries
3. Do the changes.
4. Add/Update Test (if possible)
5. Update documentation
Expand All @@ -28,7 +28,6 @@ To run examples:
node bin/codecept.js run -c examples
```


Depending on a type of change you should do the following.

## Debugging
Expand All @@ -45,12 +44,12 @@ Please keep in mind that CodeceptJS have **unified API** for Playwright, WebDriv

### Updating Playwright | Puppeteer | WebDriver

*Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit** `docs/helpers/`, those files are generated from docblocks in corresponding helpers! *
_Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit** `docs/helpers/`, those files are generated from docblocks in corresponding helpers! _

Working test is highly appreciated. To run the test suite you need:

* selenium server + chromedriver
* PHP installed
- selenium server + chromedriver
- PHP installed

To launch PHP demo application run:

Expand Down Expand Up @@ -83,7 +82,7 @@ http://localhost:8000/form/myexample

### Updating REST | ApiDataFactory

*Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required!*
_Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required!_

Adding a test is highly appreciated.

Expand All @@ -97,7 +96,7 @@ Edit a test at `test/rest/REST_test.js` or `test/rest/ApiDataFactory_test.js`

## Appium

*Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit** `docs/helpers/`, those files are generated from docblocks in corresponding helpers! *
_Whenever a new method or new behavior is added it should be documented in a docblock. Valid JS-example is required! Do **not edit** `docs/helpers/`, those files are generated from docblocks in corresponding helpers! _

It is recommended to run mobile tests on CI.
So do the changes, make pull request, see the CI status.
Expand Down Expand Up @@ -212,6 +211,7 @@ docker-compose run --rm test-helpers test/rest
```

#### Run acceptance tests

To that we provide three separate services respectively for WebDriver, Nightmare and Puppeteer tests:

```sh
Expand All @@ -236,11 +236,13 @@ And now every command based on `test-helpers` service will use node 9.4.0. The
same argument can be passed when building unit and acceptance tests services.

### CI flow

We're currently using a bunch of CI services to build and test codecept in
different environments. Here's short summary of what are differences between
separate services

#### CircleCI

Here we use CodeceptJS docker image to build and execute tests inside it. We
start with building Docker container based on Dockerfile present in main project
directory. Then we run (in this order) unit tests, all helpers present in
Expand Down
14 changes: 11 additions & 3 deletions lib/mocha/featureConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* Can inject values and add custom configuration.
*/
class FeatureConfig {
/**
* @param {CodeceptJS.Suite} suite
*/
constructor(suite) {
this.suite = suite
}
Expand Down Expand Up @@ -41,12 +44,17 @@ class FeatureConfig {
return this
}

/**
* @callback FeatureConfigCallback
* @param {CodeceptJS.Suite} suite
* @returns {Object<string, any>}
*/

/**
* Configures a helper.
* Helper name can be omitted and values will be applied to first helper.
*
* @param {string|number} helper
* @param {*} obj
* @param {string | Object<string, any> | FeatureConfigCallback} helper
* @param {Object<string, any>} [obj]
* @returns {this}
*/
config(helper, obj) {
Expand Down
11 changes: 10 additions & 1 deletion lib/mocha/scenarioConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ const { isAsyncFunction } = require('../utils')

/** @class */
class ScenarioConfig {
/**
* @param {CodeceptJS.Test} test
*/
constructor(test) {
this.test = test
}
Expand Down Expand Up @@ -77,10 +80,16 @@ class ScenarioConfig {
return this
}

/**
* @callback ScenarioConfigCallback
* @param {CodeceptJS.Test} test
* @returns {Object<string, any>}
*/

/**
* Configures a helper.
* Helper name can be omitted and values will be applied to first helper.
* @param {string | Object<string, any>} helper
* @param {string | Object<string, any> | ScenarioConfigCallback} helper
* @param {Object<string, any>} [obj]
* @returns {this}
*/
Expand Down
Loading