Skip to content

Commit

Permalink
Merge branch '3.x' into fix-codeceptjs-test-glob
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent committed May 28, 2023
2 parents 765e20f + de8e0d4 commit 52097ba
Show file tree
Hide file tree
Showing 33 changed files with 154 additions and 70 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/appium.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [16.x]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm install --legacy-peer-deps
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
Expand All @@ -41,12 +41,12 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [16.x]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
name: Check Tests
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: testomatio/check-tests@master
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/dtslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ on:

jobs:
test:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
strategy:
matrix:
node-version: [14.x]
node-version: [16.x]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm install --legacy-peer-deps
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [16.x]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: shivammathur/setup-php@v2
with:
php-version: 7.4
- name: npm install
run: |
npm install
npm install --legacy-peer-deps
env:
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
- name: Install deps
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/puppeteer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@ env:
jobs:
build:

runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

strategy:
matrix:
node-version: [14.x]
node-version: [16.x]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: shivammathur/setup-php@v2
with:
php-version: 7.4
- name: npm install
run: |
npm install
npm install --legacy-peer-deps
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
- name: start a server
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ on:
jobs:
build:

runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

strategy:
matrix:
node-version: [14.x]
node-version: [16.x]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm install --legacy-peer-deps
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/testcafe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@ env:
jobs:
build:

runs-on: ubuntu-18.04
runs-on: ubuntu-20.04

strategy:
matrix:
node-version: [14.x]
node-version: [16.x]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: shivammathur/setup-php@v2
with:
php-version: 7.4
- name: npm install
run: |
npm install
npm install --legacy-peer-deps
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/webdriver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,23 @@ jobs:
build:

runs-on: ubuntu-20.04

strategy:
matrix:
node-version: [16.x]

steps:
- run: docker run -d --net=host --shm-size=2g selenium/standalone-chrome:3.141.59-oxygen
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: shivammathur/setup-php@v2
with:
php-version: 7.4
- name: npm install
run: |
npm install
npm install --legacy-peer-deps
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
Expand All @@ -44,3 +43,4 @@ jobs:
run: ./node_modules/.bin/mocha test/helper/WebDriver_test.js
- name: run tests
run: "./bin/codecept.js run -c test/acceptance/codecept.WebDriver.js --grep @WebDriver --debug"

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Download Playwright and its dependencies
FROM mcr.microsoft.com/playwright:bionic
FROM mcr.microsoft.com/playwright:focal

# Add our user and group first to make sure their IDs get assigned consistently,
# regardless of whatever dependencies get added.
Expand Down
8 changes: 4 additions & 4 deletions docs/helpers/JSONResponse.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,16 +207,16 @@ Use pre-initialized joi instance by passing function callback:

I.seeResponseMatchesJsonSchema(joi => {
return joi.object({
name: joi.string();
id: joi.number();
name: joi.string(),
id: joi.number()
})
});

// or pass a valid schema
const joi = require('joi);
const joi = require('joi');

I.seeResponseMatchesJsonSchema(joi.object({
name: joi.string();
name: joi.string(),
id: joi.number();
});
```
Expand Down
9 changes: 5 additions & 4 deletions docs/helpers/Playwright.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Type: [object][5]
### Properties

- `url` **[string][8]** base url of website to be tested
- `browser` **[string][8]?** a browser to test on, either: `chromium`, `firefox`, `webkit`, `electron`. Default: chromium.
- `browser` **(`"chromium"` | `"firefox"` | `"webkit"` | `"electron"`)?** a browser to test on, either: `chromium`, `firefox`, `webkit`, `electron`. Default: chromium.
- `show` **[boolean][26]?** show browser window.
- `restart` **([string][8] | [boolean][26])?** restart strategy between tests. Possible values:- 'context' or **false** - restarts [browser context][33] but keeps running browser. Recommended by Playwright team to keep tests isolated.
- 'browser' or **true** - closes browser and opens it again between tests.
Expand All @@ -57,13 +57,13 @@ Type: [object][5]
- `keepBrowserState` **[boolean][26]?** keep browser state between tests when `restart` is set to 'session'.
- `keepCookies` **[boolean][26]?** keep cookies between tests when `restart` is set to 'session'.
- `waitForAction` **[number][12]?** how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
- `waitForNavigation` **[string][8]?** When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle`. Choose one of those options is possible. See [Playwright API][36].
- `waitForNavigation` **(`"load"` | `"domcontentloaded"` | `"networkidle"`)?** When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle`. Choose one of those options is possible. See [Playwright API][36].
- `pressKeyDelay` **[number][12]?** Delay between key presses in ms. Used when calling Playwrights page.type(...) in fillField/appendField
- `getPageTimeout` **[number][12]?** config option to set maximum navigation time in milliseconds.
- `waitForTimeout` **[number][12]?** default wait* timeout in ms. Default: 1000.
- `basicAuth` **[object][5]?** the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
- `windowSize` **[string][8]?** default window size. Set a dimension like `640x480`.
- `colorScheme` **[string][8]?** default color scheme. Possible values: `dark` | `light` | `no-preference`.
- `colorScheme` **(`"dark"` | `"light"` | `"no-preference"`)?** default color scheme. Possible values: `dark` | `light` | `no-preference`.
- `userAgent` **[string][8]?** user-agent string.
- `locale` **[string][8]?** locale string. Example: 'en-GB', 'de-DE', 'fr-FR', ...
- `manualStart` **[boolean][26]?** do not start browser before a test, start it manually inside a helper with `this.helpers["Playwright"]._startBrowser()`.
Expand All @@ -73,6 +73,7 @@ Type: [object][5]
- `channel` **any?** (While Playwright can operate against the stock Google Chrome and Microsoft Edge browsers available on the machine. In particular, current Playwright version will support Stable and Beta channels of these browsers. See [Google Chrome & Microsoft Edge][37].
- `ignoreLog` **[Array][15]<[string][8]>?** An array with console message types that are not logged to debug log. Default value is `['warning', 'log']`. E.g. you can set `[]` to log all messages. See all possible [values][38].
- `ignoreHTTPSErrors` **[boolean][26]?** Allows access to untrustworthy pages, e.g. to a page with an expired certificate. Default value is `false`
- `bypassCSP` **[boolean][26]?** bypass Content Security Policy or CSP



Expand All @@ -87,7 +88,7 @@ By default, video is saved to `output/video` dir. You can customize this path by

#### Trace Recording Customization

Trace recording provides a complete information on test execution and includes DOM snapshots, screenshots, and network requests logged during run.
Trace recording provides complete information on test execution and includes DOM snapshots, screenshots, and network requests logged during run.
Traces will be saved to `output/trace`

- `trace`: enables trace recording for failed tests; trace are saved into `output/trace` folder
Expand Down
6 changes: 6 additions & 0 deletions docs/secrets.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ When executed it will be printed like this:
```
I fill field "password" "*****"
```
**Other Examples**
```js
I.fillField('password', secret('123456'));
I.append('password', secret('123456'));
I.type('password', secret('123456'));
```

For an object, which can be a payload to POST request, specify which fields should be masked:

Expand Down
4 changes: 2 additions & 2 deletions docs/tutorial.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
permalink: /tutorial
title: CoeceptJS Complete Tutorial
title: CodeceptJS Complete Tutorial
---

# Tutorial: Writing Tests for Checkout Page
Expand Down Expand Up @@ -216,7 +216,7 @@ module.exports = {
Feels really empty. What should we do about it? Should we write more code? No, we already have it. Let's copy code blocks from a test we have it and place them under a corredponnding function names:

```js
connst { I } = inject();
const { I } = inject();

module.exports = {

Expand Down
2 changes: 2 additions & 0 deletions docs/webapi/appendField.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Field is located by name, label, CSS or XPath

```js
I.appendField('#myTextField', 'appended');
// typing secret
I.appendField('password', secret('123456'));
```
@param {CodeceptJS.LocatorOrString} field located by label|name|CSS|XPath|strict locator
@param {string} value text value to append.
Expand Down
3 changes: 3 additions & 0 deletions docs/webapi/type.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ I.type('4141555311111111', 100);

// passing in an array
I.type(['T', 'E', 'X', 'T']);

// passing a secret
I.type(secret('123456'));
```

@param {string|string[]} key or array of keys to type.
Expand Down
2 changes: 1 addition & 1 deletion lib/command/dryRun.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function printTests(files) {
let numOfSuites = 0;

for (const suite of mocha.suite.suites) {
output.print(`${colors.white.bold(suite.title)} -- ${output.styles.log(suite.file || '')}`);
output.print(`${colors.white.bold(suite.title)} -- ${output.styles.log(suite.file || '')} -- ${suite.tests.length} tests`);
numOfSuites++;

for (const test of suite.tests) {
Expand Down
8 changes: 4 additions & 4 deletions lib/helper/JSONResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,16 +300,16 @@ class JSONResponse extends Helper {
*
* I.seeResponseMatchesJsonSchema(joi => {
* return joi.object({
* name: joi.string();
* id: joi.number();
* name: joi.string(),
* id: joi.number()
* })
* });
*
* // or pass a valid schema
* const joi = require('joi);
* const joi = require('joi');
*
* I.seeResponseMatchesJsonSchema(joi.object({
* name: joi.string();
* name: joi.string(),
* id: joi.number();
* });
* ```
Expand Down
2 changes: 1 addition & 1 deletion lib/helper/Nightmare.js
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ class Nightmare extends Helper {
async appendField(field, value) {
const el = await findField.call(this, field);
assertElementExists(el, field, 'Field');
return this.browser.enterText(el, value, false)
return this.browser.enterText(el, value.toString(), false)
.wait(this.options.waitForAction);
}

Expand Down
Loading

0 comments on commit 52097ba

Please sign in to comment.