Code Monkey home page Code Monkey logo

protractor-helper's Issues

Fix outdated example

BDE5CC19-7592-4B94-A0F8-B86CD0937D15

This example is passing a deprecated last argument and it needs to be removed.

Note: find out if there are other cases like this and fix in the same PR.

Refactor 7 lines occurring 3 times in 2 files: inputFieldInteractions.js, misc.js

I've selected for refactoring 7 lines of code which are duplicated in 2 file(s) (1, 2, 3). Addressing this will make our codebase more maintainable and improve Better Code Hub's Write Code Once guideline rating! πŸ‘

Here's the gist of this guideline:

  • Definition πŸ“–
    Do not copy code.
  • Why❓
    When code is copied, bugs need to be fixed in multiple places. This is both inefficient and a source of regression bugs.
  • How πŸ”§
    Avoid duplication by never copy/pasting blocks of code and reduce duplication by extracting shared code, either to a new unit or introduce a superclass if the language permits.

You can find more info about this guideline in Building Maintainable Software. πŸ“–


ℹ️ To know how many other refactoring candidates need addressing to get a guideline compliant, select some by clicking on the πŸ”² next to them. The risk profile below the candidates signals (βœ…) when it's enough! 🏁


Good luck and happy coding! :shipit: ✨ πŸ’―

FYI, @PauloGoncalvesBH.

setTimeout work only to some methods

Describe the bug
The setTimeout method work only to the following methods:

  • getBodyElementFromCurrentBrowserOrBrowserInstance
  • openNewBrowserInTheSamePage
  • isCurrentUrlDifferentFromBaseUrl
  • scrollToElementWhenVisible
  • scrollToElement

Expected behavior
Expected to work to any method.

Element has class

Is your feature request related to a problem? Please describe.
I couldn't find in existing functions like to check if the element has class

Describe the solution you'd like
It would be good if something to check for the class present in an element like waitForClassToBePresentInElement

Update CHANGELOG.md to make it more useful

Description

The CHANGELOG.md file needs to be updated with more useful information, and less useless info.

Other comments

Here are some ideas:

We could also update the README.md file with a link to the CHANGELOG.md file, and then have a call-to-action like: "Interested in the latest version of protractor-helper? Take a look at our changelog."

Move functions responsible for creating default messages to its own file

Description

To better organize code responsibilities, we could have a file called messageBuilder.js, for instance, which could live together with utils.js (I mean, in the same directory of it). Actually, we would migrate some of the functions from util.js to this new file, and leave there other utility functionalities, such as requiredParam and waitForElementToBeClickable.

Document type's definitions

Now that we have an index.d.ts file, it would be nice to have some documentation around it so that users without a notion of types could benefit from it while reading the docs.

Implement deprecation warnings

Description

The functions getBodyElementFromCurrentBrowserOrBrowserInstance and openNewBrowserInTheSamePage will soon be deprecated, so we need to implement a mechanism to warn users about it.

Other comments

This will require research on how to do it.
Such an implementation can be useful for future changes as well.

Create TypeScript definition file

Create an index.d.ts file so that users of the library can have IntelliSense functionality while writing their code.

Here's an example of the protractorHelper.setTimeout function signature.

Captura de Tela 2020-04-23 Γ s 01 09 15

waitForElementVisibility not giving appropriate validation message

Describe the bug
I'm using protractorHelper for non angular website with cucumber js. I have set the value of waitForAngularEnabled to false, now I've observed that sometimes it gives error Error: function timed out, ensure the promise resolves within 5000 milliseconds for wait condition

Actual Error
Then I add new clinical item with name "test new clinical item" # src\clinical-items-builder\step-definitions\clinical-items-builder.steps.js:38
Error: function timed out, ensure the promise resolves within 5000 milliseconds

Wait condition
protractorHelper.waitForElementVisibility(element(by.css('.someclass');

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser chrome
  • Version 86.0.4240.183

Add MIT license badge

Is your feature request related to a problem? Please describe.
No.

Describe the solution you'd like
Just to add MIT license on the top of README.md
image

Describe alternatives you've considered
n/a

Additional context
n/a

Peer Dependency

Hi!

I have the problem, that I use protractor AND protractor-helper as dependencies. npm 3+ is not installing protractor, because it's peer dependency from protractor-helper.

Only working solutions:

  • installing protractor globally or particular (no way for me)
  • copy your index file after each module update and paste it to my own module (works but it's just a 'hack')

Can it be removed as peer dependency? Everbody knows that it's needed.

Refactor 6 lines occurring 2 times in clickersAndTappers.js

I've selected for refactoring 6 lines of code which are duplicated in 1 file(s) (1, 2). Addressing this will make our codebase more maintainable and improve Better Code Hub's Write Code Once guideline rating! πŸ‘

Here's the gist of this guideline:

  • Definition πŸ“–
    Do not copy code.
  • Why❓
    When code is copied, bugs need to be fixed in multiple places. This is both inefficient and a source of regression bugs.
  • How πŸ”§
    Avoid duplication by never copy/pasting blocks of code and reduce duplication by extracting shared code, either to a new unit or introduce a superclass if the language permits.

You can find more info about this guideline in Building Maintainable Software. πŸ“–


ℹ️ To know how many other refactoring candidates need addressing to get a guideline compliant, select some by clicking on the πŸ”² next to them. The risk profile below the candidates signals (βœ…) when it's enough! 🏁


Good luck and happy coding! :shipit: ✨ πŸ’―

Add method waitForAlertToBePresent

It'd be nice if protractor-helper had a method to wait for an alert to be present, so that I wouldn't need to write something like:

browser.wait(protractor.ExpectedConditions.alertIsPresent(), 5000);

Instead, I'd write something like:

protractorHelper.waitForAlertPresence() or protractorHelper.waitForAlertToBePresent().

How to list in the summary the new methods?

How we can list all new methods on the summary in README.md?

Comments:

  • That new methods are only the old without the errorMessage parameter and with a more clear name.
  • On the methods that will be deprecated have a warning advising to use the new method.

Example:
click is a new method of clickWhenClickable without errorMessage parameter.
The clickWhenClickable will be deprecated on a future version.

  1. We list all methods? Old and new?
  2. We list only the new?
  3. We list only the old?
  4. We list the new with the old on a subtopic?

It's important to be clear to the user.

I think that the better option is the 1.

Preparation for async/await due to Control flow being removed from Selenium Webdriver

Description

Due to the Control Flow being removed from the newer version of the Selenium Webdriver (v.4), and the new beta version of Protractor (v.6.0.0-beta) being in accordance with such a change, protractor-helper needs to be adapted to work this way as well. Without it, at some point, it will break.

Other comments

I have already started working on this (https://github.com/wlsf82/protractor-helper/tree/prepare-protractor-helper-to-work-with-async-await).
For reference read the following: https://github.com/angular/protractor/blob/selenium4/CHANGELOG.md
We will need to update the documentation (notification of deprecations, instructions regarding migration to async/await, retro-compatibility), implement deprecation warnings, and test retro-compatibility with other projects using the lib (we could use some of our own projects for this).

Separate functions from `index.js` into smaller and less coupled modules

Description

This intends to address "writing shorter units of code" (code quality practice from BetterCodeHub).

Other comments

Regarding the separation of concerns, we could work with files for:

  • all functions related to waiting for elements' states;
  • all functions related to typing texts into fields, and clearing fields in forms;
  • functions related to clicking and tapping;
  • other functions (e.g, isCurrentUrlDifferentFromBaseUrl, setTimeout).

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Create tests for failure messages

Description

The idea is to increase the code coverage to ease the maintainers' job. The point is that when changing existing functionalities, to check that failures still work as expected, the existing "happy path" tests need to be manually updated and tested, to confirm that failures still work as expected. This is a waste of time when we know that such a process can be automated.

Other comments

We need to investigate how to test it. Maybe we should have unit tests for it.

Refactor inputFieldInteractions.js:src/inputFieldInteractions.js

I've selected inputFieldInteractions.js:src/inputFieldInteractions.js for refactoring, which is a unit of 20 lines of code. Addressing this will make our codebase more maintainable and improve Better Code Hub's Write Short Units of Code guideline rating! πŸ‘

Here's the gist of this guideline:

  • Definition πŸ“–
    Limit the length of code units to 15 lines of code.
  • Why❓
    Small units are easier to analyse, test and reuse.
  • How πŸ”§
    When writing new units, don't let them grow above 15 lines of code. When a unit grows beyond this, split it in smaller units of no longer than 15 lines.

You can find more info about this guideline in Building Maintainable Software. πŸ“–


ℹ️ To know how many other refactoring candidates need addressing to get a guideline compliant, select some by clicking on the πŸ”² next to them. The risk profile below the candidates signals (βœ…) when it's enough! 🏁


Good luck and happy coding! :shipit: ✨ πŸ’―

Refactor 6 lines occurring 2 times in clickersAndTappers.js

I've selected for refactoring 6 lines of code which are duplicated in 1 file(s) (1, 2). Addressing this will make our codebase more maintainable and improve Better Code Hub's Write Code Once guideline rating! πŸ‘

Here's the gist of this guideline:

  • Definition πŸ“–
    Do not copy code.
  • Why❓
    When code is copied, bugs need to be fixed in multiple places. This is both inefficient and a source of regression bugs.
  • How πŸ”§
    Avoid duplication by never copy/pasting blocks of code and reduce duplication by extracting shared code, either to a new unit or introduce a superclass if the language permits.

You can find more info about this guideline in Building Maintainable Software. πŸ“–


ℹ️ To know how many other refactoring candidates need addressing to get a guideline compliant, select some by clicking on the πŸ”² next to them. The risk profile below the candidates signals (βœ…) when it's enough! 🏁


Good luck and happy coding! :shipit: ✨ πŸ’―

FYI, @PauloGoncalvesBH.

Implement Continuous Delivery

Implement Continuous Delivery

Objective:

  • Automate all repetitive task and use best practices from the open source community.
    • Generate tag, changelog, release, commit and publish after approving pull request.
  • Standardize commit message.

Steps:

Needed validation:

Validate locally if the commit message respect the conventional commit specification. Using git hooks commit-msg.

IGNORE - The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

Refactor 7 lines occurring 2 times in 2 files: inputFieldInteractions.js, misc.js

I've selected for refactoring 7 lines of code which are duplicated in 2 file(s) (1, 2). Addressing this will make our codebase more maintainable and improve Better Code Hub's Write Code Once guideline rating! πŸ‘

Here's the gist of this guideline:

  • Definition πŸ“–
    Do not copy code.
  • Why❓
    When code is copied, bugs need to be fixed in multiple places. This is both inefficient and a source of regression bugs.
  • How πŸ”§
    Avoid duplication by never copy/pasting blocks of code and reduce duplication by extracting shared code, either to a new unit or introduce a superclass if the language permits.

You can find more info about this guideline in Building Maintainable Software. πŸ“–


ℹ️ To know how many other refactoring candidates need addressing to get a guideline compliant, select some by clicking on the πŸ”² next to them. The risk profile below the candidates signals (βœ…) when it's enough! 🏁


Good luck and happy coding! :shipit: ✨ πŸ’―

Remove 'errorMessage' argument

Description

To stop a bad practice that is occurring with the helper, we must remove the errorMessage argument from the methods.
The existing error message in the methods is already clear, pointing out the error line and suggesting what may have occurred. The user choosing which error message should appear is ultimately detrimental to it.

A deprecation warning must be implemented and we must have a transitional period.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.