Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function != function in Cypress #16

Open
Falke-Design opened this issue May 21, 2020 · 0 comments
Open

Function != function in Cypress #16

Falke-Design opened this issue May 21, 2020 · 0 comments

Comments

@Falke-Design
Copy link
Member

Falke-Design commented May 21, 2020

Hi,
I don't know if this is a bug of this library or of cypress. I didn't found an explanation why this is like them.

My onStart function never called in the fingerIsBusy() function because it checks if it is an instance of Function.

if (this._onStart && this._onStart instanceof Function) {
	this._onStart(this);
}

My code:

var hand = new Hand({
        timing: 'frame',
        onStart: function () {
          console.log('TEST')
        }
      });
      var toucher = hand.growFinger('mouse');
      toucher.moveTo(300, 280, 0)
        .down().moveBy(5, 0, 20).moveBy(256, 32, 1000).wait(100).up().wait(100);

I debugged the code:
_onStart is a function because I can call this._onStart() but this._onStart instanceof Function returns false.

Because of this bug the onStart and onStop function is never called.

Maybe it would be better if it changed to typeof this._onStart === "function"

Versions:
"prosthetic-hand": "^1.3.1"
"cypress": "^3.8.3"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant