Skip to content

Commit

Permalink
Merge branch '3.x' into tune-workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent committed May 21, 2023
2 parents e04eed0 + 2c0c250 commit a1da8dd
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/webdriver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
build:

runs-on: ubuntu-20.04

strategy:
matrix:
node-version: [16.x]
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"

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
6 changes: 3 additions & 3 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 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
6 changes: 3 additions & 3 deletions lib/helper/Playwright.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const pathSeparator = path.sep;
* @typedef PlaywrightConfig
* @type {object}
* @prop {string} url - base url of website to be tested
* @prop {string} [browser] - a browser to test on, either: `chromium`, `firefox`, `webkit`, `electron`. Default: chromium.
* @prop {'chromium' | 'firefox'| 'webkit' | 'electron'} [browser='chromium'] - a browser to test on, either: `chromium`, `firefox`, `webkit`, `electron`. Default: chromium.
* @prop {boolean} [show=false] - show browser window.
* @prop {string|boolean} [restart=false] - restart strategy between tests. Possible values:
* * 'context' or **false** - restarts [browser context](https://playwright.dev/docs/api/class-browsercontext) but keeps running browser. Recommended by Playwright team to keep tests isolated.
Expand All @@ -72,13 +72,13 @@ const pathSeparator = path.sep;
* @prop {boolean} [keepBrowserState=false] - keep browser state between tests when `restart` is set to 'session'.
* @prop {boolean} [keepCookies=false] - keep cookies between tests when `restart` is set to 'session'.
* @prop {number} [waitForAction] - how long to wait after click, doubleClick or PressKey actions in ms. Default: 100.
* @prop {string} [waitForNavigation] - When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle`. Choose one of those options is possible. See [Playwright API](https://playwright.dev/docs/api/class-page#page-wait-for-navigation).
* @prop {'load' | 'domcontentloaded' | 'networkidle'} [waitForNavigation] - When to consider navigation succeeded. Possible options: `load`, `domcontentloaded`, `networkidle`. Choose one of those options is possible. See [Playwright API](https://playwright.dev/docs/api/class-page#page-wait-for-navigation).
* @prop {number} [pressKeyDelay=10] - Delay between key presses in ms. Used when calling Playwrights page.type(...) in fillField/appendField
* @prop {number} [getPageTimeout] - config option to set maximum navigation time in milliseconds.
* @prop {number} [waitForTimeout] - default wait* timeout in ms. Default: 1000.
* @prop {object} [basicAuth] - the basic authentication to pass to base url. Example: {username: 'username', password: 'password'}
* @prop {string} [windowSize] - default window size. Set a dimension like `640x480`.
* @prop {string} [colorScheme] - default color scheme. Possible values: `dark` | `light` | `no-preference`.
* @prop {'dark' | 'light' | 'no-preference'} [colorScheme] - default color scheme. Possible values: `dark` | `light` | `no-preference`.
* @prop {string} [userAgent] - user-agent string.
* @prop {string} [locale] - locale string. Example: 'en-GB', 'de-DE', 'fr-FR', ...
* @prop {boolean} [manualStart] - do not start browser before a test, start it manually inside a helper with `this.helpers["Playwright"]._startBrowser()`.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"@cucumber/cucumber-expressions": "^16",
"@cucumber/gherkin": "^26",
"@cucumber/messages": "^21.0.1",
"@xmldom/xmldom": "^0.7.9",
"acorn": "^7.4.1",
"arrify": "^2.0.1",
"axios": "^1.3.3",
Expand Down Expand Up @@ -138,7 +139,6 @@
"wdio-docker-service": "^1.5.0",
"webdriverio": "^8.3.8",
"xml2js": "^0.4.23",
"xmldom": "^0.1.31",
"xpath": "0.0.27"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion test/helper/WebDriver_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,7 @@ describe('WebDriver', function () {
});

describe('#scrollIntoView', () => {
it('should scroll element into viewport', async () => {
it.skip('should scroll element into viewport', async () => {
await wd.amOnPage('/form/scroll_into_view');
const element = await wd.browser.$('#notInViewportByDefault');
expect(await element.isDisplayedInViewport()).to.be.false;
Expand Down
4 changes: 2 additions & 2 deletions test/unit/locator_test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { expect } = require('chai');
const Dom = require('xmldom').DOMParser;
const { DOMParser } = require('@xmldom/xmldom');
const xpath = require('xpath');

const Locator = require('../../lib/locator');
Expand Down Expand Up @@ -56,7 +56,7 @@ const xml = `<body>

describe('Locator', () => {
beforeEach(() => {
doc = new Dom().parseFromString(xml);
doc = new DOMParser().parseFromString(xml, 'application/xhtml+xml');
});

describe('constructor', () => {
Expand Down
5 changes: 4 additions & 1 deletion typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ declare namespace CodeceptJS {

type Cookie = {
name: string;
value: string;
value: string | boolean;
domain?: string,
path?: string,
};
Expand Down Expand Up @@ -489,6 +489,9 @@ declare const Background: CodeceptJS.IHook;
declare const Before: CodeceptJS.IHook;
declare const After: CodeceptJS.IHook;

// Plugins
declare const __: any

interface Window {
codeceptjs: typeof CodeceptJS.browserCodecept;
resq: any;
Expand Down

0 comments on commit a1da8dd

Please sign in to comment.