Skip to content

Commit 7e4f493

Browse files
author
DavertMik
committed
Merge branch '3.x' into refactor/downgrade-chai-5
2 parents ac4da06 + 0275acb commit 7e4f493

File tree

15 files changed

+74
-61
lines changed

15 files changed

+74
-61
lines changed

.github/workflows/playwright.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616
jobs:
1717
build:
1818

19-
runs-on: ubuntu-22.04
19+
runs-on: ubuntu-latest
2020

2121
strategy:
2222
matrix:

.github/workflows/webdriver.devtools.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

docs/api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ REST helper can send GET/POST/PATCH/etc requests to REST API endpoint:
148148
* [`I.sendPutRequest()`](/helpers/REST#sendPutRequest)
149149
* [`I.sendPatchRequest()`](/helpers/REST#sendPatchRequest)
150150
* [`I.sendDeleteRequest()`](/helpers/REST#sendDeleteRequest)
151+
* [`I.sendDeleteRequestWithPayload()`](/helpers/REST#sendDeleteRequestWithPayload)
151152
* ...
152153

153154
Authentication headers can be set in [helper's config](https://codecept.io/helpers/REST/#configuration) or per test with headers or special methods like `I.amBearerAuthenticated`.

docs/data.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ I.sendPostRequest()
5454
I.sendPutRequest()
5555
I.sendPatchRequest()
5656
I.sendDeleteRequest()
57+
I.sendDeleteRequestWithPayload()
5758
```
5859

5960
As well as a method for setting headers: `haveRequestHeaders`.

docs/helpers/REST.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,22 @@ I.sendDeleteRequest('/api/users/1');
156156

157157
Returns **[Promise][2]<any>** response
158158

159+
### sendDeleteRequestWithPayload
160+
161+
Sends DELETE request to API with payload.
162+
163+
```js
164+
I.sendDeleteRequestWithPayload('/api/users/1', { author: 'john' });
165+
```
166+
167+
#### Parameters
168+
169+
- `url` **any**
170+
- `payload` **any** the payload to be sent. By default it is sent as an empty object
171+
- `headers` **[object][4]** the headers object to be sent. By default, it is sent as an empty object
172+
173+
Returns **[Promise][2]<any>** response
174+
159175
### sendGetRequest
160176

161177
Send GET request to REST API

lib/helper/Playwright.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2843,7 +2843,10 @@ class Playwright extends Helper {
28432843
const _contextObject = this.frame ? this.frame : contextObject
28442844
let count = 0
28452845
do {
2846-
waiter = await _contextObject.locator(`:has-text("${text}")`).first().isVisible()
2846+
waiter = await _contextObject
2847+
.locator(`:has-text(${JSON.stringify(text)})`)
2848+
.first()
2849+
.isVisible()
28472850
if (waiter) break
28482851
await this.wait(1)
28492852
count += 1000

lib/helper/REST.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,30 @@ class REST extends Helper {
408408

409409
return this._executeRequest(request)
410410
}
411+
412+
/**
413+
* Sends DELETE request to API with payload.
414+
*
415+
* ```js
416+
* I.sendDeleteRequestWithPayload('/api/users/1', { author: 'john' });
417+
* ```
418+
*
419+
* @param {*} url
420+
* @param {*} [payload={}] - the payload to be sent. By default it is sent as an empty object
421+
* @param {object} [headers={}] - the headers object to be sent. By default, it is sent as an empty object
422+
*
423+
* @returns {Promise<*>} response
424+
*/
425+
async sendDeleteRequestWithPayload(url, payload = {}, headers = {}) {
426+
const request = {
427+
baseURL: this._url(url),
428+
method: 'DELETE',
429+
data: payload,
430+
headers,
431+
}
432+
433+
return this._executeRequest(request)
434+
}
411435
}
412436

413437
module.exports = REST

lib/locator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ class Locator {
389389
}
390390

391391
/**
392-
* @param {CodeceptJS.LocatorOrString} locator
392+
* @param {CodeceptJS.LocatorOrString} [locator]
393393
* @returns {Locator}
394394
*/
395395
Locator.build = (locator) => {

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"@codeceptjs/helper": "2.0.4",
7373
"@cucumber/cucumber-expressions": "17",
7474
"@cucumber/gherkin": "29",
75-
"@cucumber/messages": "25.0.1",
75+
"@cucumber/messages": "27.0.0",
7676
"@xmldom/xmldom": "0.9.4",
7777
"acorn": "8.14.0",
7878
"arrify": "2.0.1",
@@ -96,12 +96,12 @@
9696
"lodash.clonedeep": "4.5.0",
9797
"lodash.merge": "4.6.2",
9898
"mkdirp": "1.0.4",
99-
"mocha": "10.7.3",
99+
"mocha": "10.8.2",
100100
"monocart-coverage-reports": "2.10.3",
101101
"ms": "2.1.3",
102102
"ora-classic": "5.4.2",
103103
"parse-function": "5.6.10",
104-
"parse5": "7.1.2",
104+
"parse5": "7.2.1",
105105
"promise-retry": "1.1.1",
106106
"resq": "1.11.0",
107107
"sprintf-js": "1.1.1",
@@ -120,7 +120,7 @@
120120
"@types/chai": "4.3.19",
121121
"@types/inquirer": "9.0.3",
122122
"@types/node": "22.5.5",
123-
"@wdio/sauce-service": "9.0.9",
123+
"@wdio/sauce-service": "9.2.8",
124124
"@wdio/selenium-standalone-service": "8.3.2",
125125
"@wdio/utils": "9.1.2",
126126
"@xmldom/xmldom": "0.9.4",
@@ -153,7 +153,7 @@
153153
"sinon": "18.0.0",
154154
"sinon-chai": "3.7.0",
155155
"testcafe": "3.5.0",
156-
"ts-morph": "23.0.0",
156+
"ts-morph": "24.0.0",
157157
"ts-node": "10.9.2",
158158
"tsd": "^0.31.0",
159159
"tsd-jsdoc": "2.5.0",

test/acceptance/config_test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ Scenario('change config 1 @WebDriverIO @Puppeteer @Playwright', ({ I }) => {
88

99
Scenario('change config 2 @WebDriverIO @Puppeteer @Playwright', ({ I }) => {
1010
I.amOnPage('/')
11-
I.seeInCurrentUrl('github.com')
12-
}).config({ url: 'https://github.com' })
11+
I.seeInCurrentUrl('codecept.io')
12+
}).config({ url: 'https://codecept.io' })
1313

1414
Scenario('change config 3 @WebDriverIO @Puppeteer @Playwright', ({ I }) => {
1515
I.amOnPage('/')
16-
I.dontSeeInCurrentUrl('github.com')
16+
I.dontSeeInCurrentUrl('codecept.io')
1717
I.seeInCurrentUrl('google.com')
1818
})
1919

@@ -26,7 +26,7 @@ Scenario('change config 4 @WebDriverIO @Puppeteer @Playwright', ({ I }) => {
2626

2727
Scenario('change config 5 @WebDriverIO @Puppeteer @Playwright', ({ I }) => {
2828
I.amOnPage('/')
29-
I.dontSeeInCurrentUrl('github.com')
29+
I.dontSeeInCurrentUrl('codecept.io')
3030
I.seeInCurrentUrl('google.com')
3131
})
3232

@@ -38,10 +38,10 @@ Scenario('make API call and check response @Playwright', ({ I }) => {
3838

3939
Scenario('change config 6 @WebDriverIO @Puppeteer @Playwright', ({ I }) => {
4040
I.amOnPage('/')
41-
I.seeInCurrentUrl('github.com')
41+
I.seeInCurrentUrl('codecept.io')
4242
}).config(async () => {
4343
await new Promise((r) => {
4444
setTimeout(r, 50)
4545
})
46-
return { url: 'https://github.com' }
46+
return { url: 'https://codecept.io' }
4747
})

0 commit comments

Comments
 (0)