Skip to content

Conversation

rpetersen27
Copy link

Motivation/Description of the PR

Applicable helpers:

  • Webdriver
  • Puppeteer
  • Nightmare
  • REST
  • Appium
  • Protractor
  • TestCafe

I just stumbled upon the issue, that the return values from certain grab*-functions are different in webdriver and puppeteer, when just a single element has been found. This PR affects the functions grabValueFrom, grabCssPropertyFrom and grabAttributeFrom for webdriver. As Puppeteer always returns just the element when the selector just found one. grabTextFrom and grabHTMLFrom webdriver does the same thing. Therefore, I applied this functionality also to the above mentioned functions.

Type of change

  • Breaking changes
  • New functionality
  • Bug fix
  • Documentation changes/updates
  • Hot fix
  • Markdown files fix - not related to source code

Checklist:

  • Tests have been added
  • Documentation has been added (Run npm run docs)
  • Lint checking (Run npm run lint)
  • Local tests are passed (Run npm test)

@rpetersen27 rpetersen27 force-pushed the fix-webdriver-return-values branch from b3ea0bf to 2532164 Compare November 28, 2019 10:44
@DavertMik
Copy link
Contributor

I understand this incompatibility but it seems like a breaking change for current users.
If I am correct we should wait for 3.0 release to merge this PR.

@DavertMik
Copy link
Contributor

Anyway, this looks like a simplified version for the current code so I think it won't break anything

@DavertMik DavertMik merged commit 4a769f1 into codeceptjs:master Dec 6, 2019
DavertMik added a commit that referenced this pull request Dec 6, 2019
@@ -944,8 +936,9 @@ class WebDriver extends Helper {
async grabValueFrom(locator) {
const res = await this._locate(locator, true);
assertElementExists(res, locator);

return forEachAsync(res, async el => el.getValue());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

method returned array, now it returns array or string.

Others helpers have both variants.
@DavertMik , We should review helpers signature

Copy link
Contributor

@DavertMik DavertMik Dec 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think we need to do that for 3.0 release.
Maybe a better way would be to revert merged pull request and introduce a new policy for 3.0

@rpetersen27
Copy link
Author

A later fix would be fine for me as I have workarounds for that in my code anyways such that I can easily switch between puppeteer and webdriver configuration. I just stumbled upon that thing and I thought that it is a quick fix so I just did it.

Anyways, is there a roadmap for a 3.0 release?

DavertMik added a commit that referenced this pull request Jan 8, 2020
Vorobeyko added a commit that referenced this pull request Jan 17, 2020
* Streamlined return values from grab* (#2054)

* fix: replace console.print with console.log

Since `console.print()` does not exists 😄

* File system extended (#2034)

* check file exists with given substring

* tests are added

* deleted trailing-space

* removed spaces

* compatibility for node 8

* assertion message fixed

* check file exists with given substring

* tests are added

* deleted trailing-space

* removed spaces

* compatibility for node 8

* assertion message fixed

* get changed into grab

* Examples added

* trailing spaces

* fix: cannot grab for css attributes with hyphen (#2059)

* Docs/remove jsdoc extra line (#2068)

* docs: remove prepending line in JSDoc generator

* definitions: update generated types

* fix: TestCafe grabAttributeFrom method not works (#2064)

* fix: testcafe grabAttributeFrom

* test: make skippable tests use mocha's skip

* fix: TestCafe.grabValueFrom

* build: add eslintignore for test output

* test: unskip working TestCafe tests

* test: remove skip form Nightmare tests

* tests: skip testcafe webapi tests

* tests: fix skips

* #1911 - Regex for step Def file (#2043)

* #1911 - Regex for step Def file

* #1911 : Regex for step Def file,Fixed hound reviews

* #1911 : Regex for step Def file,Fixed hound reviews - 1

* #1911 : Regex for step Def file,Fixed hound reviews - 1

* #1911 - Removing commented lines of code

* #1911 - Modifying so that decision is based on Array or not

* #1911 - Fixing Hound reviews

* #1911 - Amending for code review

* #1911 - Amending for code review - 3

* Allows overriding default Polly config in MockRequest (#2060)

* Add Interoperable Code for supporting both CJS & ESM environments (#2075)

* Added Interoperable Code

Add Interoperable Code to support both CJS and ESM environments.

* Linter Fixes

* fix(docs): add info about _after hook in helper

* try to shorten the test execution time

* Update package.json

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

Co-authored-by: Richard Petersen <Holorium@users.noreply.github.com>
Co-authored-by: Sébastien Chopin <seb@nuxtjs.com>
Co-authored-by: Ahmed Yılmaz <ahmet6yilmaz@gmail.com>
Co-authored-by: Evgeniy Lukoyanov <11647141+elukoyanov@users.noreply.github.com>
Co-authored-by: Srivatsan <vatsan34@gmail.com>
Co-authored-by: Daniel Eckermann <danieleckermann@gmail.com>
Co-authored-by: K.C.Ashish Kumar <kcak11@gmail.com>
Co-authored-by: Alexandr Vorobey <sashavorobey95@gmail.com>
DavertMik added a commit that referenced this pull request Jan 22, 2020
* Streamlined return values from grab* (#2054)

* fix: replace console.print with console.log

Since `console.print()` does not exists 😄

* File system extended (#2034)

* check file exists with given substring

* tests are added

* deleted trailing-space

* removed spaces

* compatibility for node 8

* assertion message fixed

* check file exists with given substring

* tests are added

* deleted trailing-space

* removed spaces

* compatibility for node 8

* assertion message fixed

* get changed into grab

* Examples added

* trailing spaces

* fix: cannot grab for css attributes with hyphen (#2059)

* Docs/remove jsdoc extra line (#2068)

* docs: remove prepending line in JSDoc generator

* definitions: update generated types

* fix: TestCafe grabAttributeFrom method not works (#2064)

* fix: testcafe grabAttributeFrom

* test: make skippable tests use mocha's skip

* fix: TestCafe.grabValueFrom

* build: add eslintignore for test output

* test: unskip working TestCafe tests

* test: remove skip form Nightmare tests

* tests: skip testcafe webapi tests

* tests: fix skips

* #1911 - Regex for step Def file (#2043)

* #1911 - Regex for step Def file

* #1911 : Regex for step Def file,Fixed hound reviews

* #1911 : Regex for step Def file,Fixed hound reviews - 1

* #1911 : Regex for step Def file,Fixed hound reviews - 1

* #1911 - Removing commented lines of code

* #1911 - Modifying so that decision is based on Array or not

* #1911 - Fixing Hound reviews

* #1911 - Amending for code review

* #1911 - Amending for code review - 3

* Allows overriding default Polly config in MockRequest (#2060)

* Add Interoperable Code for supporting both CJS & ESM environments (#2075)

* Added Interoperable Code

Add Interoperable Code to support both CJS and ESM environments.

* Linter Fixes

* fix(docs): add info about _after hook in helper

* add I.say() to allure

* Remove I say

Co-Authored-By: Michael Bodnarchuk <DavertMik@users.noreply.github.com>

Co-authored-by: Richard Petersen <Holorium@users.noreply.github.com>
Co-authored-by: Sébastien Chopin <seb@nuxtjs.com>
Co-authored-by: Ahmed Yılmaz <ahmet6yilmaz@gmail.com>
Co-authored-by: Evgeniy Lukoyanov <11647141+elukoyanov@users.noreply.github.com>
Co-authored-by: Srivatsan <vatsan34@gmail.com>
Co-authored-by: Daniel Eckermann <danieleckermann@gmail.com>
Co-authored-by: K.C.Ashish Kumar <kcak11@gmail.com>
Co-authored-by: Alexandr Vorobey <sashavorobey95@gmail.com>
Co-authored-by: Michael Bodnarchuk <DavertMik@users.noreply.github.com>
DavertMik pushed a commit that referenced this pull request Jan 22, 2020
* Streamlined return values from grab* (#2054)

* fix: replace console.print with console.log

Since `console.print()` does not exists 😄

* File system extended (#2034)

* check file exists with given substring

* tests are added

* deleted trailing-space

* removed spaces

* compatibility for node 8

* assertion message fixed

* check file exists with given substring

* tests are added

* deleted trailing-space

* removed spaces

* compatibility for node 8

* assertion message fixed

* get changed into grab

* Examples added

* trailing spaces

* fix: cannot grab for css attributes with hyphen (#2059)

* Docs/remove jsdoc extra line (#2068)

* docs: remove prepending line in JSDoc generator

* definitions: update generated types

* fix: TestCafe grabAttributeFrom method not works (#2064)

* fix: testcafe grabAttributeFrom

* test: make skippable tests use mocha's skip

* fix: TestCafe.grabValueFrom

* build: add eslintignore for test output

* test: unskip working TestCafe tests

* test: remove skip form Nightmare tests

* tests: skip testcafe webapi tests

* tests: fix skips

* #1911 - Regex for step Def file (#2043)

* #1911 - Regex for step Def file

* #1911 : Regex for step Def file,Fixed hound reviews

* #1911 : Regex for step Def file,Fixed hound reviews - 1

* #1911 : Regex for step Def file,Fixed hound reviews - 1

* #1911 - Removing commented lines of code

* #1911 - Modifying so that decision is based on Array or not

* #1911 - Fixing Hound reviews

* #1911 - Amending for code review

* #1911 - Amending for code review - 3

* Allows overriding default Polly config in MockRequest (#2060)

* Add Interoperable Code for supporting both CJS & ESM environments (#2075)

* Added Interoperable Code

Add Interoperable Code to support both CJS and ESM environments.

* Linter Fixes

* fix(docs): add info about _after hook in helper

* fix the ambiguous description

* CR fix

Co-authored-by: Richard Petersen <Holorium@users.noreply.github.com>
Co-authored-by: Sébastien Chopin <seb@nuxtjs.com>
Co-authored-by: Ahmed Yılmaz <ahmet6yilmaz@gmail.com>
Co-authored-by: Evgeniy Lukoyanov <11647141+elukoyanov@users.noreply.github.com>
Co-authored-by: Srivatsan <vatsan34@gmail.com>
Co-authored-by: Daniel Eckermann <danieleckermann@gmail.com>
Co-authored-by: K.C.Ashish Kumar <kcak11@gmail.com>
Co-authored-by: Alexandr Vorobey <sashavorobey95@gmail.com>
DavertMik pushed a commit that referenced this pull request Jan 23, 2020
…#2140)

* Streamlined return values from grab* (#2054)

* fix: replace console.print with console.log

Since `console.print()` does not exists 😄

* File system extended (#2034)

* check file exists with given substring

* tests are added

* deleted trailing-space

* removed spaces

* compatibility for node 8

* assertion message fixed

* check file exists with given substring

* tests are added

* deleted trailing-space

* removed spaces

* compatibility for node 8

* assertion message fixed

* get changed into grab

* Examples added

* trailing spaces

* fix: cannot grab for css attributes with hyphen (#2059)

* Docs/remove jsdoc extra line (#2068)

* docs: remove prepending line in JSDoc generator

* definitions: update generated types

* fix: TestCafe grabAttributeFrom method not works (#2064)

* fix: testcafe grabAttributeFrom

* test: make skippable tests use mocha's skip

* fix: TestCafe.grabValueFrom

* build: add eslintignore for test output

* test: unskip working TestCafe tests

* test: remove skip form Nightmare tests

* tests: skip testcafe webapi tests

* tests: fix skips

* #1911 - Regex for step Def file (#2043)

* #1911 - Regex for step Def file

* #1911 : Regex for step Def file,Fixed hound reviews

* #1911 : Regex for step Def file,Fixed hound reviews - 1

* #1911 : Regex for step Def file,Fixed hound reviews - 1

* #1911 - Removing commented lines of code

* #1911 - Modifying so that decision is based on Array or not

* #1911 - Fixing Hound reviews

* #1911 - Amending for code review

* #1911 - Amending for code review - 3

* Allows overriding default Polly config in MockRequest (#2060)

* Add Interoperable Code for supporting both CJS & ESM environments (#2075)

* Added Interoperable Code

Add Interoperable Code to support both CJS and ESM environments.

* Linter Fixes

* fix(docs): add info about _after hook in helper

* some improvements

* improve the way to get uuid

* move private func to the end

* mocha update is not here

Co-authored-by: Richard Petersen <Holorium@users.noreply.github.com>
Co-authored-by: Sébastien Chopin <seb@nuxtjs.com>
Co-authored-by: Ahmed Yılmaz <ahmet6yilmaz@gmail.com>
Co-authored-by: Evgeniy Lukoyanov <11647141+elukoyanov@users.noreply.github.com>
Co-authored-by: Srivatsan <vatsan34@gmail.com>
Co-authored-by: Daniel Eckermann <danieleckermann@gmail.com>
Co-authored-by: K.C.Ashish Kumar <kcak11@gmail.com>
Co-authored-by: Alexandr Vorobey <sashavorobey95@gmail.com>
DavertMik pushed a commit that referenced this pull request Jan 23, 2020
* Streamlined return values from grab* (#2054)

* fix: replace console.print with console.log

Since `console.print()` does not exists 😄

* File system extended (#2034)

* check file exists with given substring

* tests are added

* deleted trailing-space

* removed spaces

* compatibility for node 8

* assertion message fixed

* check file exists with given substring

* tests are added

* deleted trailing-space

* removed spaces

* compatibility for node 8

* assertion message fixed

* get changed into grab

* Examples added

* trailing spaces

* fix: cannot grab for css attributes with hyphen (#2059)

* Docs/remove jsdoc extra line (#2068)

* docs: remove prepending line in JSDoc generator

* definitions: update generated types

* fix: TestCafe grabAttributeFrom method not works (#2064)

* fix: testcafe grabAttributeFrom

* test: make skippable tests use mocha's skip

* fix: TestCafe.grabValueFrom

* build: add eslintignore for test output

* test: unskip working TestCafe tests

* test: remove skip form Nightmare tests

* tests: skip testcafe webapi tests

* tests: fix skips

* #1911 - Regex for step Def file (#2043)

* #1911 - Regex for step Def file

* #1911 : Regex for step Def file,Fixed hound reviews

* #1911 : Regex for step Def file,Fixed hound reviews - 1

* #1911 : Regex for step Def file,Fixed hound reviews - 1

* #1911 - Removing commented lines of code

* #1911 - Modifying so that decision is based on Array or not

* #1911 - Fixing Hound reviews

* #1911 - Amending for code review

* #1911 - Amending for code review - 3

* Allows overriding default Polly config in MockRequest (#2060)

* Add Interoperable Code for supporting both CJS & ESM environments (#2075)

* Added Interoperable Code

Add Interoperable Code to support both CJS and ESM environments.

* Linter Fixes

* fix(docs): add info about _after hook in helper

* (fix): no custom output folder is created with run-worker

* CR fix

* verify the output folder is created

Co-authored-by: Richard Petersen <Holorium@users.noreply.github.com>
Co-authored-by: Sébastien Chopin <seb@nuxtjs.com>
Co-authored-by: Ahmed Yılmaz <ahmet6yilmaz@gmail.com>
Co-authored-by: Evgeniy Lukoyanov <11647141+elukoyanov@users.noreply.github.com>
Co-authored-by: Srivatsan <vatsan34@gmail.com>
Co-authored-by: Daniel Eckermann <danieleckermann@gmail.com>
Co-authored-by: K.C.Ashish Kumar <kcak11@gmail.com>
Co-authored-by: Alexandr Vorobey <sashavorobey95@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants