From 28f0512a1f9d600a30c131b43d9a962349f94a6a Mon Sep 17 00:00:00 2001 From: Peter Nguyen Tr Date: Mon, 28 Jan 2019 13:43:48 +0100 Subject: [PATCH 1/5] synced with master (#1) * Added WebDriver to autoDelay supported helpers (#1455) WebDriverIO is deprecated and should be removed from the list when the deprecation notices are removed. * Fix multiple-execution link (#1456) * add label to allure report + fix collect tag (#1449) * Skip test in allure-report (#1448) * Fix issue 1445 and 1443 (#1446) * Fix running tests with different data and with only * fix * remove only * fix comment * fix comments * fix issue 1443 * use JSON.stringify for all obj * Change setValue() to addValue() (and add some tests) (#1460) * improved TS definitions * fixed the case when there are more than one matched element (#1453) * fixed the case when there are more than one matched element * fixed the same thing for nightmare and protractor * prepare release and website update --- .eslintrc.json | 3 +- CHANGELOG.md | 14 ++++++++ docs/configuration.md | 2 +- docs/helpers/Nightmare.md | 1 + docs/helpers/Protractor.md | 1 + docs/helpers/Puppeteer.md | 1 + docs/helpers/WebDriver.md | 1 + docs/helpers/WebDriverIO.md | 1 + docs/webapi/grabAttributeFrom.mustache | 1 + lib/command/definitions.js | 6 +++- lib/data/context.js | 18 +++++++--- lib/helper/Nightmare.js | 13 +++++-- lib/helper/Protractor.js | 9 +++-- lib/helper/Puppeteer.js | 10 ++++-- lib/helper/WebDriver.js | 2 +- lib/parser.js | 4 ++- lib/plugin/allure.js | 15 ++++++++ lib/plugin/autoDelay.js | 1 + lib/ui.js | 4 +-- lib/utils.js | 13 ++++++- package.json | 2 +- test/data/app/view/form/file.php | 4 +++ test/data/sandbox/codecept.addt.json | 11 ++++++ test/data/sandbox/codecept.gddt.json | 11 ++++++ test/data/sandbox/ddt_test.addt.js | 5 +++ test/data/sandbox/ddt_test.ddt.js | 7 ++++ test/data/sandbox/ddt_test.gddt.js | 8 +++++ test/helper/WebDriver_test.js | 9 +++++ test/runner/interface_test.js | 48 ++++++++++++++++++++++++-- website/i18n/en.json | 3 +- website/pages/en/reference.js | 7 +++- website/sidebars.json | 2 +- website/siteConfig.js | 4 ++- 33 files changed, 215 insertions(+), 26 deletions(-) create mode 100644 test/data/sandbox/codecept.addt.json create mode 100644 test/data/sandbox/codecept.gddt.json create mode 100644 test/data/sandbox/ddt_test.addt.js create mode 100644 test/data/sandbox/ddt_test.gddt.js diff --git a/.eslintrc.json b/.eslintrc.json index f6f62b141..7ad2a1d04 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -36,6 +36,7 @@ "no-cond-assign": 0, "import/no-unresolved": 0, "no-await-in-loop": 0, - "arrow-body-style": 0 + "arrow-body-style": 0, + "no-loop-func": 0 } } diff --git a/CHANGELOG.md b/CHANGELOG.md index 56f3125dd..dfe55be2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +## 2.0.4 + +* [WebDriver][Protractor][Nightmare][Puppeteer] `grabAttributeFrom` returns an array when multiple elements matched. By @PeterNgTr +* [autoLogin plugin] Fixed merging users config by @nealfennimore +* [autoDelay plugin] Added WebDriver to list of supported helpers by @mattin4d +* [Appium] Fixed using locators in `waitForElement`, `waitForVisible`, `waitForInvisible`. By @eduardofinotti +* [allure plugin] Add tags to allure reports by @Vorobeyko +* [allure plugin] Add skipped tests to allure reports by @Vorobeyko +* Fixed `Logged Test name | [object Object]` when used Data().Scenario(). By @Vorobeyko +* Fixed Data().only.Scenario() to run for all datasets. By @Vorobeyko +* [WebDriver] `attachFile` to work with hidden elements. Fixed in [#1460](https://github.com/Codeception/CodeceptJS/pull/1460) by @tsuemura + + + ## 2.0.3 * [**autoLogin plugin**](https://codecept.io/plugins#autologin) added. Allows to log in once and reuse browser session. When session expires - automatically logs in again. Can persist session between runs by saving cookies to file. diff --git a/docs/configuration.md b/docs/configuration.md index 98a85b261..f03a59f8d 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -17,7 +17,7 @@ Here is an overview of available options with their defaults: * **output**: `"./output"` - where to store failure screenshots, etc * **helpers**: `{}` - list of enabled helpers * **mocha**: `{}` - mocha options, [reporters](http://codecept.io/reports/) can be configured here -* **multiple**: `{}` - multiple options, see [Multiple Execution](http://codecept.io/advanced/#multiple-execution) +* **multiple**: `{}` - multiple options, see [Multiple Execution](http://codecept.io/advanced/#multiple-browsers-execution) * **bootstrap**: `"./bootstrap.js"` - an option to run code _before_ tests are run. See [Hooks](http://codecept.io/hooks/#bootstrap-teardown)). * **bootstrapAll**: `"./bootstrap.js"` - an option to run code _before_ all test suites are run when using the run-multiple mode. See [Hooks](http://codecept.io/hooks/#bootstrap-teardown)). * **teardown**: - an option to run code _after_ all test suites are run when using the run-multiple mode. See [Hooks](http://codecept.io/hooks/#bootstrap-teardown). diff --git a/docs/helpers/Nightmare.md b/docs/helpers/Nightmare.md index d3d92fb79..8ca5df552 100644 --- a/docs/helpers/Nightmare.md +++ b/docs/helpers/Nightmare.md @@ -374,6 +374,7 @@ I.fillField({css: 'form#login input[name=username]'}, 'John'); ### grabAttributeFrom Retrieves an attribute from an element located by CSS or XPath and returns it to test. +An array as a result will be returned if there are more than one matched element. Resumes test execution, so **should be used inside async with `await`** operator. ```js diff --git a/docs/helpers/Protractor.md b/docs/helpers/Protractor.md index 6bea49dc1..548fbf9f4 100644 --- a/docs/helpers/Protractor.md +++ b/docs/helpers/Protractor.md @@ -520,6 +520,7 @@ I.fillField({css: 'form#login input[name=username]'}, 'John'); ### grabAttributeFrom Retrieves an attribute from an element located by CSS or XPath and returns it to test. +An array as a result will be returned if there are more than one matched element. Resumes test execution, so **should be used inside async with `await`** operator. ```js diff --git a/docs/helpers/Puppeteer.md b/docs/helpers/Puppeteer.md index 969123a4a..f5421f52e 100644 --- a/docs/helpers/Puppeteer.md +++ b/docs/helpers/Puppeteer.md @@ -581,6 +581,7 @@ I.fillField({css: 'form#login input[name=username]'}, 'John'); ### grabAttributeFrom Retrieves an attribute from an element located by CSS or XPath and returns it to test. +An array as a result will be returned if there are more than one matched element. Resumes test execution, so **should be used inside async with `await`** operator. ```js diff --git a/docs/helpers/WebDriver.md b/docs/helpers/WebDriver.md index 27783701a..c140f8cbd 100644 --- a/docs/helpers/WebDriver.md +++ b/docs/helpers/WebDriver.md @@ -623,6 +623,7 @@ I.fillField({css: 'form#login input[name=username]'}, 'John'); ### grabAttributeFrom Retrieves an attribute from an element located by CSS or XPath and returns it to test. +An array as a result will be returned if there are more than one matched element. Resumes test execution, so **should be used inside async with `await`** operator. ```js diff --git a/docs/helpers/WebDriverIO.md b/docs/helpers/WebDriverIO.md index 11dbeb571..812faf77b 100644 --- a/docs/helpers/WebDriverIO.md +++ b/docs/helpers/WebDriverIO.md @@ -631,6 +631,7 @@ I.fillField({css: 'form#login input[name=username]'}, 'John'); ### grabAttributeFrom Retrieves an attribute from an element located by CSS or XPath and returns it to test. +An array as a result will be returned if there are more than one matched element. Resumes test execution, so **should be used inside async with `await`** operator. ```js diff --git a/docs/webapi/grabAttributeFrom.mustache b/docs/webapi/grabAttributeFrom.mustache index c6c2f437b..5720c8b9f 100644 --- a/docs/webapi/grabAttributeFrom.mustache +++ b/docs/webapi/grabAttributeFrom.mustache @@ -1,4 +1,5 @@ Retrieves an attribute from an element located by CSS or XPath and returns it to test. +An array as a result will be returned if there are more than one matched element. Resumes test execution, so **should be used inside async with `await`** operator. ```js diff --git a/lib/command/definitions.js b/lib/command/definitions.js index 4f3c911be..96b1afdd9 100644 --- a/lib/command/definitions.js +++ b/lib/command/definitions.js @@ -206,9 +206,13 @@ module.exports = function (genPath, options) { function addAllMethodsInObject(supportObj, actions, methods, translations) { for (const action of methodsOfObject(supportObj)) { + let fn = supportObj[action]; + if (!fn.name) { + Object.defineProperty(fn, "name", {value: action}); + } const actionAlias = translations ? translations.actionAliasFor(action) : action; if (!actions[actionAlias]) { - methods.push(toTypeDef(supportObj[action])); + methods.push(toTypeDef(fn)); actions[actionAlias] = 1; } } diff --git a/lib/data/context.js b/lib/data/context.js index d1f9d5fa3..0f5f1aa97 100644 --- a/lib/data/context.js +++ b/lib/data/context.js @@ -11,11 +11,12 @@ module.exports = function (context) { opts = {}; } data.forEach((dataRow) => { + const dataTitle = replaceTitle(title, dataRow); if (dataRow.skip) { - context.xScenario(`${title} | ${dataRow.data}`); + context.xScenario(dataTitle); } else { opts.data = dataRow; - context.Scenario(`${title} | ${dataRow.data}`, opts, fn) + context.Scenario(dataTitle, opts, fn) .inject({ current: dataRow.data }); } }); @@ -27,11 +28,12 @@ module.exports = function (context) { opts = {}; } data.forEach((dataRow) => { + const dataTitle = replaceTitle(title, dataRow); if (dataRow.skip) { - context.xScenario(`${title} | ${dataRow.data}`); + context.xScenario(dataTitle); } else { opts.data = dataRow; - context.Scenario.only(`${title} | ${dataRow.data}`, opts, fn) + context.Scenario.only(dataTitle, opts, fn) .inject({ current: dataRow.data }); } }); @@ -46,6 +48,14 @@ module.exports = function (context) { }; }; +function replaceTitle(title, dataRow) { + if (typeof dataRow.data !== 'object') { + return `${title} | {${JSON.stringify(dataRow.data)}}`; + } + + return `${title} | ${JSON.stringify(dataRow.data)}`; +} + function isTableDataRow(row) { const has = Object.prototype.hasOwnProperty; return has.call(row, 'data') && has.call(row, 'skip'); diff --git a/lib/helper/Nightmare.js b/lib/helper/Nightmare.js index 886bdddcb..f95be1aa7 100644 --- a/lib/helper/Nightmare.js +++ b/lib/helper/Nightmare.js @@ -792,9 +792,16 @@ class Nightmare extends Helper { */ async grabAttributeFrom(locator, attr) { locator = new Locator(locator, 'css'); - const el = await this.browser.findElement(locator.toStrict()); - assertElementExists(el, locator); - return this.browser.evaluate((el, attr) => window.codeceptjs.fetchElement(el).getAttribute(attr), el, attr); + const els = await this.browser.findElements(locator.toStrict()); + const array = []; + + for (let index = 0; index < els.length; index++) { + const el = els[index]; + assertElementExists(el, locator); + array.push(await this.browser.evaluate((el, attr) => window.codeceptjs.fetchElement(el).getAttribute(attr), el, attr)); + } + + return array.length === 1 ? array[0] : array; } diff --git a/lib/helper/Protractor.js b/lib/helper/Protractor.js index 362a25e19..3fa9749f0 100644 --- a/lib/helper/Protractor.js +++ b/lib/helper/Protractor.js @@ -728,9 +728,14 @@ class Protractor extends Helper { async grabAttributeFrom(locator, attr) { const els = await this._locate(locator); assertElementExists(els); - return els[0].getAttribute(attr); - } + const array = []; + for (let index = 0; index < els.length; index++) { + const el = els[index]; + array.push(await el.getAttribute(attr)); + } + return array.length === 1 ? array[0] : array; + } /** * {{> ../webapi/seeInTitle }} */ diff --git a/lib/helper/Puppeteer.js b/lib/helper/Puppeteer.js index 4559a74aa..98451ab83 100644 --- a/lib/helper/Puppeteer.js +++ b/lib/helper/Puppeteer.js @@ -1363,8 +1363,14 @@ class Puppeteer extends Helper { async grabAttributeFrom(locator, attr) { const els = await this._locate(locator); assertElementExists(els, locator); - return this._evaluateHandeInContext((el, attr) => el[attr] || el.getAttribute(attr), els[0], attr) - .then(t => t.jsonValue()); + const array = []; + + for (let index = 0; index < els.length; index++) { + const a = await this._evaluateHandeInContext((el, attr) => el[attr] || el.getAttribute(attr), els[index], attr); + array.push(await a.jsonValue()); + } + + return array.length === 1 ? array[0] : array; } /** diff --git a/lib/helper/WebDriver.js b/lib/helper/WebDriver.js index 6c8fa2e17..573bad4a3 100644 --- a/lib/helper/WebDriver.js +++ b/lib/helper/WebDriver.js @@ -710,7 +710,7 @@ class WebDriver extends Helper { } } - return el.setValue(file); + return el.addValue(file); } /** diff --git a/lib/parser.js b/lib/parser.js index 10c82f304..7583eb050 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -36,6 +36,7 @@ module.exports.toTypeDef = function (fn) { }; function methodSignature(fn, paramNames, params) { + if (!fn.name) return; if (!params) params = []; params = params.map((p, i) => `${paramNames[i]}: ${p}`).join(', '); let returnType = 'void'; @@ -86,7 +87,8 @@ function getParams(fn) { }); return params; } catch (err) { - console.error(err, newFn); + console.log('Error in ' + newFn.toString()); + console.error(err); } } diff --git a/lib/plugin/allure.js b/lib/plugin/allure.js index e902a9457..af79c1bbc 100644 --- a/lib/plugin/allure.js +++ b/lib/plugin/allure.js @@ -65,6 +65,14 @@ module.exports = (config) => { reporter.startSuite(suite.fullTitle()); }); + event.dispatcher.on(event.suite.before, (suite) => { + for (const test of suite.tests) { + if (test.pending) { + reporter.pendingCase(test.title); + } + } + }); + event.dispatcher.on(event.hook.started, (hook) => { isHookSteps = true; }); @@ -82,6 +90,13 @@ module.exports = (config) => { currentStep = null; }); + event.dispatcher.on(event.test.started, (test) => { + const currentTest = reporter.getCurrentTest(); + for (const tag of test.tags) { + currentTest.addLabel('tag', tag); + } + }); + event.dispatcher.on(event.test.failed, (test, err) => { if (currentStep) reporter.endStep('failed'); if (currentMetaStep.length) { diff --git a/lib/plugin/autoDelay.js b/lib/plugin/autoDelay.js index a82499231..dc5a89b7d 100644 --- a/lib/plugin/autoDelay.js +++ b/lib/plugin/autoDelay.js @@ -5,6 +5,7 @@ const event = require('../event'); const log = require('../output').log; const supportedHelpers = [ + 'WebDriver', 'WebDriverIO', 'Protractor', 'Appium', diff --git a/lib/ui.js b/lib/ui.js index 3b6e9d173..2a2631909 100644 --- a/lib/ui.js +++ b/lib/ui.js @@ -52,7 +52,7 @@ module.exports = function (suite) { }); }; - test.tags = (suite.tags || []).concat(title.match(/(\@\w+)/g)); // match tags from title + test.tags = (suite.tags || []).concat(title.match(/(\@[a-zA-Z0-9-_]+)/g)); // match tags from title test.file = file; test.async = true; test.timeout(0); @@ -97,7 +97,7 @@ module.exports = function (suite) { if (opts.retries) suite.retries(opts.retries); if (opts.timeout) suite.timeout(opts.timeout); - suite.tags = title.match(/(\@\w+)/g) || []; // match tags from title + suite.tags = title.match(/(\@[a-zA-Z0-9-_]+)/g) || []; // match tags from title suite.file = file; suite.fullTitle = () => `${suite.title}:`; suites.unshift(suite); diff --git a/lib/utils.js b/lib/utils.js index 90a03a308..1f02abd7c 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -39,6 +39,10 @@ const isGenerator = module.exports.isGenerator = function (fn) { return fn.constructor.name === 'GeneratorFunction'; }; +const isFunction = module.exports.isFunction = function (fn) { + return typeof fn === 'function' +}; + const isAsyncFunction = module.exports.isAsyncFunction = function (fn) { if (!fn) return false; return fn[Symbol.toStringTag] === 'AsyncFunction'; @@ -83,12 +87,19 @@ module.exports.methodsOfObject = function (obj, className) { 'toLocaleString', 'valueOf', 'hasOwnProperty', + 'bind', + 'apply', + 'call', 'isPrototypeOf', 'propertyIsEnumerable', ]; function pushToMethods(prop) { - if (typeof obj[prop] !== 'function') return; + try { + if (!isFunction(obj[prop]) && !isAsyncFunction(obj[prop])) return; + } catch (err) { // can't access property + return; + } if (standard.indexOf(prop) >= 0) return; if (prop.indexOf('_') === 0) return; methods.push(prop); diff --git a/package.json b/package.json index 9eb77f372..218c01f2c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codeceptjs", - "version": "2.0.3", + "version": "2.0.4", "description": "Modern Era Acceptance Testing Framework for NodeJS", "keywords": [ "acceptance", diff --git a/test/data/app/view/form/file.php b/test/data/app/view/form/file.php index 47e037f07..13b03bca0 100755 --- a/test/data/app/view/form/file.php +++ b/test/data/app/view/form/file.php @@ -5,5 +5,9 @@ +
+ + +
\ No newline at end of file diff --git a/test/data/sandbox/codecept.addt.json b/test/data/sandbox/codecept.addt.json new file mode 100644 index 000000000..e38a62cac --- /dev/null +++ b/test/data/sandbox/codecept.addt.json @@ -0,0 +1,11 @@ +{ + "tests": "./*_test.addt.js", + "timeout": 10000, + "output": "./output", + "helpers": { + }, + "include": {}, + "bootstrap": false, + "mocha": {}, + "name": "sandbox" +} diff --git a/test/data/sandbox/codecept.gddt.json b/test/data/sandbox/codecept.gddt.json new file mode 100644 index 000000000..013c61769 --- /dev/null +++ b/test/data/sandbox/codecept.gddt.json @@ -0,0 +1,11 @@ +{ + "tests": "./*_test.gddt.js", + "timeout": 10000, + "output": "./output", + "helpers": { + }, + "include": {}, + "bootstrap": false, + "mocha": {}, + "name": "sandbox" +} diff --git a/test/data/sandbox/ddt_test.addt.js b/test/data/sandbox/ddt_test.addt.js new file mode 100644 index 000000000..b98aa95f7 --- /dev/null +++ b/test/data/sandbox/ddt_test.addt.js @@ -0,0 +1,5 @@ +Feature('ADDT'); + +Data(['1', '2', '3']).only.Scenario('Should log array of strings', (I, current) => { + console.log(`Got array item ${current}`); +}); diff --git a/test/data/sandbox/ddt_test.ddt.js b/test/data/sandbox/ddt_test.ddt.js index 1c8320464..5c4086f56 100644 --- a/test/data/sandbox/ddt_test.ddt.js +++ b/test/data/sandbox/ddt_test.ddt.js @@ -23,6 +23,13 @@ Data(function* () { console.log(`Got changed login ${current[0]}`); }); +Data(function* () { + yield { user: 'nick' }; + yield { user: 'pick' }; +}).Scenario('Should log accounts4', (I, current) => { + console.log(`Got generator login ${current.user}`); +}); + Data(['1', '2', '3']).Scenario('Should log array of strings', (I, current) => { console.log(`Got array item ${current}`); }); diff --git a/test/data/sandbox/ddt_test.gddt.js b/test/data/sandbox/ddt_test.gddt.js new file mode 100644 index 000000000..9322aacdf --- /dev/null +++ b/test/data/sandbox/ddt_test.gddt.js @@ -0,0 +1,8 @@ +Feature('ADDT'); + +Data(function* () { + yield { user: 'nick' }; + yield { user: 'pick' }; +}).only.Scenario('Should log generator of strings', (I, current) => { + console.log(`Got generator login ${current.user}`); +}); diff --git a/test/helper/WebDriver_test.js b/test/helper/WebDriver_test.js index 5ca3a1c6b..ea8ba3000 100644 --- a/test/helper/WebDriver_test.js +++ b/test/helper/WebDriver_test.js @@ -629,4 +629,13 @@ describe('WebDriver', function () { .then(() => wd.see('Information', 'h1')) .then(() => wd.dontSee('Iframe test', 'h1'))); }); + + describe('#AttachFile', () => { + it('should attach to regular input element', () => wd.amOnPage('/form/file') + .then(() => wd.attachFile('Avatar', './app/avatar.jpg')) + .then(() => wd.seeInField('Avatar', 'avatar.jpg'))); + + it('should attach to invisible input element', () => wd.amOnPage('/form/file') + .then(() => wd.attachFile('hidden', '/app/avatar.jpg'))); + }); }); diff --git a/test/runner/interface_test.js b/test/runner/interface_test.js index a311933e5..34fe59c67 100644 --- a/test/runner/interface_test.js +++ b/test/runner/interface_test.js @@ -61,11 +61,55 @@ describe('CodeceptJS Interface', () => { ✔ Should log accounts2 | {"login":"collaborator","password":"222222"}`); output.should.include(`Got changed login nick - ✔ Should log accounts3 | nick`); + ✔ Should log accounts3 | ["nick","pick"]`); output.should.include(`Got changed login jack - ✔ Should log accounts3 | jack`); + ✔ Should log accounts3 | ["jack","sacj"]`); + output.should.include(`Got generator login nick + ✔ Should log accounts4 | {"user":"nick"}`); + + output.should.include(`Got generator login pick + ✔ Should log accounts4 | {"user":"pick"}`); + + output.should.include(`Got array item 1 + ✔ Should log array of strings | {"1"}`); + + output.should.include(`Got array item 2 + ✔ Should log array of strings | {"2"}`); + + output.should.include(`Got array item 3 + ✔ Should log array of strings | {"3"}`); + + assert(!err); + done(); + }); + }); + + it('should run all tests with data of array by only', (done) => { + exec(config_run_config('codecept.addt.json'), (err, stdout, stderr) => { + const output = stdout.replace(/in [0-9]ms/g, '').replace(/\r/g, ''); + output.should.include(`Got array item 1 + ✔ Should log array of strings | {"1"}`); + + output.should.include(`Got array item 2 + ✔ Should log array of strings | {"2"}`); + + output.should.include(`Got array item 3 + ✔ Should log array of strings | {"3"}`); + assert(!err); + done(); + }); + }); + + it('should run all tests with data of generator by only', (done) => { + exec(config_run_config('codecept.gddt.json'), (err, stdout, stderr) => { + const output = stdout.replace(/in [0-9]ms/g, '').replace(/\r/g, ''); + output.should.include(`Got generator login nick + ✔ Should log generator of strings | {"user":"nick"}`); + + output.should.include(`Got generator login pick + ✔ Should log generator of strings | {"user":"pick"}`); assert(!err); done(); }); diff --git a/website/i18n/en.json b/website/i18n/en.json index 6a410dc7b..0c72aa40a 100644 --- a/website/i18n/en.json +++ b/website/i18n/en.json @@ -137,7 +137,8 @@ "Guides": "Guides", "Reference": "Reference", "Releases": "Releases", - "Support": "Support" + "Support": "Support", + "Forum": "Forum" }, "categories": { "Quickstart": "Quickstart", diff --git a/website/pages/en/reference.js b/website/pages/en/reference.js index d39ed49f4..99bfb1e18 100644 --- a/website/pages/en/reference.js +++ b/website/pages/en/reference.js @@ -25,10 +25,15 @@ let sidebar = { id: 'reference', className="productShowcaseSection" style={{textAlign: 'left'}}>

Reference

+
CodeceptJS has enterprise support: trainings, consulting, test automation. Contact us at SDCLabs!
-

Want some more? We have a nice set of community helpers. Check them out and add yours!

+
+

Practical tips in Cookbook »

+

We have Community helpers. Check them out and add yours!

+ +
); diff --git a/website/sidebars.json b/website/sidebars.json index 4623a1faf..790a5c884 100755 --- a/website/sidebars.json +++ b/website/sidebars.json @@ -29,7 +29,7 @@ "Reference": [ "installation", "commands", - "config", + "configuration", "plugins", "docker", "reports", diff --git a/website/siteConfig.js b/website/siteConfig.js index 186ff91aa..ac8e36450 100755 --- a/website/siteConfig.js +++ b/website/siteConfig.js @@ -46,6 +46,8 @@ const siteConfig = { {page: 'reference', label: 'Reference'}, {page: 'changelog', label: 'Releases'}, {page: 'help', label: 'Support'}, + { href: 'https://codecept.discourse.group', label: 'Forum' }, + // {doc: 'changelog', label: 'Reference'}, // {blog: true, label: 'Blog'}, ], @@ -62,7 +64,7 @@ const siteConfig = { /* Colors for website */ colors: { primaryColor: '#7B1FA2', - secondaryColor: '#e1b0f6', + secondaryColor: '#7B1FA2', }, fonts: { From 400eed596aa86376c4b7618451697abe22407871 Mon Sep 17 00:00:00 2001 From: Thanh Nguyen Date: Mon, 28 Jan 2019 17:30:40 +0100 Subject: [PATCH 2/5] fixed the case the folder to save screenshot is duplicated on windows --- lib/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils.js b/lib/utils.js index 1f02abd7c..a9c4f0e75 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -286,7 +286,7 @@ module.exports.screenshotOutputFolder = function (fileName) { if (!fileName.includes(fileSep) || fileName.includes('record_')) { return path.join(global.output_dir, fileName); } - return path.join(process.cwd(), fileName); + return path.join(__dirname, fileName); }; module.exports.fileToBase64Zip = async function (localPath) { From 0390705a1f61439a9316b0dd8c88a750c959ffc3 Mon Sep 17 00:00:00 2001 From: Thanh Nguyen Date: Mon, 28 Jan 2019 18:13:54 +0100 Subject: [PATCH 3/5] fixed the case the folder to save screenshot is duplicated on windows --- lib/utils.js | 3 ++- package.json | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/utils.js b/lib/utils.js index a9c4f0e75..694b12bf2 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -283,10 +283,11 @@ module.exports.deleteDir = function (dir_path) { module.exports.screenshotOutputFolder = function (fileName) { const fileSep = path.sep; + const relative = require("relative"); if (!fileName.includes(fileSep) || fileName.includes('record_')) { return path.join(global.output_dir, fileName); } - return path.join(__dirname, fileName); + return path.join(relative(process.cwd()), fileName); }; module.exports.fileToBase64Zip = async function (localPath) { diff --git a/package.json b/package.json index 218c01f2c..1e2dcb48d 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "mocha": "^4.1.0", "parse-function": "^5.2.10", "promise-retry": "^1.1.1", + "relative": "^3.0.2", "requireg": "^0.1.8", "sprintf-js": "^1.1.1" }, From 01603eed2f6daa24c4e48b0317092ab022c4178a Mon Sep 17 00:00:00 2001 From: Thanh Nguyen Date: Mon, 28 Jan 2019 18:21:57 +0100 Subject: [PATCH 4/5] lint fixed --- lib/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils.js b/lib/utils.js index 694b12bf2..f00ed3fcc 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -283,7 +283,7 @@ module.exports.deleteDir = function (dir_path) { module.exports.screenshotOutputFolder = function (fileName) { const fileSep = path.sep; - const relative = require("relative"); + const relative = require('relative'); if (!fileName.includes(fileSep) || fileName.includes('record_')) { return path.join(global.output_dir, fileName); } From e65021141abd85ddfa7667487b46672046279c52 Mon Sep 17 00:00:00 2001 From: Thanh Nguyen Date: Thu, 31 Jan 2019 11:44:03 +0100 Subject: [PATCH 5/5] removed the lib --- lib/utils.js | 4 ++-- package.json | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/utils.js b/lib/utils.js index f00ed3fcc..56f03dcf9 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -283,11 +283,11 @@ module.exports.deleteDir = function (dir_path) { module.exports.screenshotOutputFolder = function (fileName) { const fileSep = path.sep; - const relative = require('relative'); + if (!fileName.includes(fileSep) || fileName.includes('record_')) { return path.join(global.output_dir, fileName); } - return path.join(relative(process.cwd()), fileName); + return path.join(global.codecept_dir, fileName); }; module.exports.fileToBase64Zip = async function (localPath) { diff --git a/package.json b/package.json index 1e2dcb48d..218c01f2c 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,6 @@ "mocha": "^4.1.0", "parse-function": "^5.2.10", "promise-retry": "^1.1.1", - "relative": "^3.0.2", "requireg": "^0.1.8", "sprintf-js": "^1.1.1" },