Skip to content

Commit

Permalink
Merge branch '3.x' into task-4576-bump-json-server
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashohn committed Nov 15, 2024
2 parents 54d14e9 + 5d26692 commit b753839
Show file tree
Hide file tree
Showing 28 changed files with 1,955 additions and 1,937 deletions.
2 changes: 0 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ updates:
ignore:
- dependency-name: "escape-string-regexp"
versions: [">=5.0"]
- dependency-name: "apollo-server-express"
versions: [">=3.0"]
- dependency-name: "eslint"
versions: [ ">8.57.0" ]

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,9 @@ Thanks all to those who are and will have contributing to this awesome project!
<a href="https://github.com/tsuemura"><img src="https://avatars.githubusercontent.com/u/17092259?v=4" title="tsuemura" width="80" height="80"></a>
<a href="https://github.com/EgorBodnar"><img src="https://avatars.githubusercontent.com/u/63167966?v=4" title="EgorBodnar" width="80" height="80"></a>
<a href="https://github.com/VikalpP"><img src="https://avatars.githubusercontent.com/u/11846339?v=4" title="VikalpP" width="80" height="80"></a>
<a href="https://github.com/BorisOsipov"><img src="https://avatars.githubusercontent.com/u/6514276?v=4" title="BorisOsipov" width="80" height="80"></a>
<a href="https://github.com/thomashohn"><img src="https://avatars.githubusercontent.com/u/3414869?v=4" title="thomashohn" width="80" height="80"></a>
<a href="https://github.com/elaichenkov"><img src="https://avatars.githubusercontent.com/u/29764053?v=4" title="elaichenkov" width="80" height="80"></a>
<a href="https://github.com/BorisOsipov"><img src="https://avatars.githubusercontent.com/u/6514276?v=4" title="BorisOsipov" width="80" height="80"></a>
<a href="https://github.com/nitschSB"><img src="https://avatars.githubusercontent.com/u/39341455?v=4" title="nitschSB" width="80" height="80"></a>
<a href="https://github.com/hubidu"><img src="https://avatars.githubusercontent.com/u/13134082?v=4" title="hubidu" width="80" height="80"></a>
<a href="https://github.com/jploskonka"><img src="https://avatars.githubusercontent.com/u/669483?v=4" title="jploskonka" width="80" height="80"></a>
Expand All @@ -322,7 +323,6 @@ Thanks all to those who are and will have contributing to this awesome project!
<a href="https://github.com/abhimanyupandian"><img src="https://avatars.githubusercontent.com/u/36107381?v=4" title="abhimanyupandian" width="80" height="80"></a>
<a href="https://github.com/martomo"><img src="https://avatars.githubusercontent.com/u/1850135?v=4" title="martomo" width="80" height="80"></a>
<a href="https://github.com/hatufacci"><img src="https://avatars.githubusercontent.com/u/4963181?v=4" title="hatufacci" width="80" height="80"></a>
<a href="https://github.com/thomashohn"><img src="https://avatars.githubusercontent.com/u/3414869?v=4" title="thomashohn" width="80" height="80"></a>

[//]: contributor-faces

Expand Down
4 changes: 2 additions & 2 deletions docs/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ var Factory = require('rosie').Factory;
var faker = require('@faker-js/faker');

module.exports = new Factory()
.attr('name', () => faker.name.findName())
.attr('name', () => faker.person.findName())
.attr('email', () => faker.internet.email());
```

Expand Down Expand Up @@ -271,7 +271,7 @@ module.exports = new Factory((buildObj) => {
input: { ...buildObj },
}
})
.attr('name', () => faker.name.findName())
.attr('name', () => faker.person.findName())
.attr('email', () => faker.internet.email());
```

Expand Down
26 changes: 13 additions & 13 deletions docs/helpers/AI.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ Use it only in development mode. It is recommended to run it only inside pause()

This helper should be configured in codecept.conf.{js|ts}

- `chunkSize`: - The maximum number of characters to send to the AI API at once. We split HTML fragments by 8000 chars to not exceed token limit. Increase this value if you use GPT-4.
* `chunkSize`: - The maximum number of characters to send to the AI API at once. We split HTML fragments by 8000 chars to not exceed token limit. Increase this value if you use GPT-4.

### Parameters

- `config`
* `config` &#x20;

### askForPageObject

Expand All @@ -50,21 +50,21 @@ Asks for a page object based on the provided page name, locator, and extra promp

#### Parameters

- `pageName` **[string][1]** The name of the page to retrieve the object for.
- `extraPrompt` **([string][1] | null)** An optional extra prompt for additional context or information.
- `locator` **([string][1] | null)** An optional locator to find a specific element on the page.
* `pageName` **[string][1]** The name of the page to retrieve the object for.
* `extraPrompt` **([string][1] | null)** An optional extra prompt for additional context or information.
* `locator` **([string][1] | null)** An optional locator to find a specific element on the page.

Returns **[Promise][2]&lt;[Object][3]>** A promise that resolves to the requested page object.
Returns **[Promise][2]<[Object][3]>** A promise that resolves to the requested page object.

### askGptGeneralPrompt

Send a general request to AI and return response.

#### Parameters

- `prompt` **[string][1]**
* `prompt` **[string][1]**&#x20;

Returns **[Promise][2]&lt;[string][1]>** A Promise that resolves to the generated response from the GPT model.
Returns **[Promise][2]<[string][1]>** A Promise that resolves to the generated response from the GPT model.

### askGptOnPage

Expand All @@ -76,9 +76,9 @@ I.askGptOnPage('what does this page do?');

#### Parameters

- `prompt` **[string][1]** The question or prompt to ask the GPT model.
* `prompt` **[string][1]** The question or prompt to ask the GPT model.

Returns **[Promise][2]&lt;[string][1]>** A Promise that resolves to the generated responses from the GPT model, joined by newlines.
Returns **[Promise][2]<[string][1]>** A Promise that resolves to the generated responses from the GPT model, joined by newlines.

### askGptOnPageFragment

Expand All @@ -90,10 +90,10 @@ I.askGptOnPageFragment('describe features of this screen', '.screen');

#### Parameters

- `prompt` **[string][1]** The question or prompt to ask the GPT-3.5 model.
- `locator` **[string][1]** The locator or selector used to identify the HTML fragment on the page.
* `prompt` **[string][1]** The question or prompt to ask the GPT-3.5 model.
* `locator` **[string][1]** The locator or selector used to identify the HTML fragment on the page.

Returns **[Promise][2]&lt;[string][1]>** A Promise that resolves to the generated response from the GPT model.
Returns **[Promise][2]<[string][1]>** A Promise that resolves to the generated response from the GPT model.

[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

Expand Down
55 changes: 28 additions & 27 deletions docs/helpers/ApiDataFactory.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const { faker } = require('@faker-js/faker');

module.exports = new Factory()
// no need to set id, it will be set by REST API
.attr('author', () => faker.name.findName())
.attr('author', () => faker.person.findName())
.attr('title', () => faker.lorem.sentence())
.attr('body', () => faker.lorem.paragraph());
```
Expand All @@ -71,12 +71,12 @@ Then configure ApiDataHelper to match factories and REST API:

ApiDataFactory has following config options:

- `endpoint`: base URL for the API to send requests to.
- `cleanup` (default: true): should inserted records be deleted up after tests
- `factories`: list of defined factories
- `returnId` (default: false): return id instead of a complete response when creating items.
- `headers`: list of headers
- `REST`: configuration for REST requests
* `endpoint`: base URL for the API to send requests to.
* `cleanup` (default: true): should inserted records be deleted up after tests
* `factories`: list of defined factories
* `returnId` (default: false): return id instead of a complete response when creating items.
* `headers`: list of headers
* `REST`: configuration for REST requests

See the example:

Expand Down Expand Up @@ -121,25 +121,26 @@ For instance, to set timeout you should add:

By default to create a record ApiDataFactory will use endpoint and plural factory name:

- create: `POST {endpoint}/{resource} data`
- delete: `DELETE {endpoint}/{resource}/id`
* create: `POST {endpoint}/{resource} data`
* delete: `DELETE {endpoint}/{resource}/id`

Example (`endpoint`: `http://app.com/api`):

- create: POST request to `http://app.com/api/users`
- delete: DELETE request to `http://app.com/api/users/1`
* create: POST request to `http://app.com/api/users`
* delete: DELETE request to `http://app.com/api/users/1`

This behavior can be configured with following options:

- `uri`: set different resource uri. Example: `uri: account` => `http://app.com/api/account`.
- `create`: override create options. Expected format: `{ method: uri }`. Example: `{ "post": "/users/create" }`
- `delete`: override delete options. Expected format: `{ method: uri }`. Example: `{ "post": "/users/delete/{id}" }`
* `uri`: set different resource uri. Example: `uri: account` => `http://app.com/api/account`.
* `create`: override create options. Expected format: `{ method: uri }`. Example: `{ "post": "/users/create" }`
* `delete`: override delete options. Expected format: `{ method: uri }`. Example: `{ "post": "/users/delete/{id}" }`

Requests can also be overridden with a function which returns [axois request config][4].

```js
create: (data) => ({ method: 'post', url: '/posts', data }),
delete: (id) => ({ method: 'delete', url: '/posts', data: { id } })

```

Requests can be updated on the fly by using `onRequest` function. For instance, you can pass in current session from a cookie.
Expand Down Expand Up @@ -189,7 +190,7 @@ By default `id` property of response is taken. This behavior can be changed by s

### Parameters

- `config`
* `config` &#x20;

### _requestCreate

Expand All @@ -198,8 +199,8 @@ Can be replaced from a in custom helper.

#### Parameters

- `factory` **any**
- `data` **any**
* `factory` **any**&#x20;
* `data` **any**&#x20;

### _requestDelete

Expand All @@ -208,8 +209,8 @@ Can be replaced from a custom helper.

#### Parameters

- `factory` **any**
- `id` **any**
* `factory` **any**&#x20;
* `id` **any**&#x20;

### have

Expand All @@ -227,11 +228,11 @@ I.have('user', { }, { age: 33, height: 55 })

#### Parameters

- `factory` **any** factory to use
- `params` **any?** predefined parameters
- `options` **any?** options for programmatically generate the attributes
* `factory` **any** factory to use
* `params` **any?** predefined parameters
* `options` **any?** options for programmatically generate the attributes

Returns **[Promise][5]&lt;any>**
Returns **[Promise][5]<any>**&#x20;

### haveMultiple

Expand All @@ -250,10 +251,10 @@ I.haveMultiple('post', 3, { author: 'davert' }, { publish_date: '01.01.1997' });

#### Parameters

- `factory` **any**
- `times` **any**
- `params` **any?**
- `options` **any?**
* `factory` **any**&#x20;
* `times` **any**&#x20;
* `params` **any?**&#x20;
* `options` **any?**&#x20;

[1]: https://github.com/rosiejs/rosie

Expand Down
Loading

0 comments on commit b753839

Please sign in to comment.