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

Fix for IE, to make it stable. #18

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open

Conversation

acierto
Copy link

@acierto acierto commented Mar 20, 2017

When the event is sent (ex. start dragging) slow browser (for example IE) is still didn't react on it and we send another event. So we need to wait a bit. No idea how to get the information that event is processed. So we wait for 0.5 s. For me it works all the time now.
I'm using Selenium Grid infrastructure with IE 11 slaves on Win 7 VMs.

@Kuniwak Kuniwak self-requested a review March 20, 2017 14:28
@Kuniwak
Copy link
Member

Kuniwak commented Mar 20, 2017

Could you unify indent to 2 width space, please?
Because it is hard to see what is changed.

(I know ?w=1 hack, but we cannot comment to changes on GitHub when use this hack)

@acierto
Copy link
Author

acierto commented Mar 21, 2017

Sure, have done it. Sorry IntelliJ IDEA has 4 spaces for tab by default.

@Kuniwak
Copy link
Member

Kuniwak commented Mar 21, 2017

@acierto Thanks! I have a question.

Did you try shorter wait durations?
I think the shortest one is the best because it makes test fast.

@acierto
Copy link
Author

acierto commented Aug 9, 2017

You can make those values configurable in html-dnd, but not waiting at all makes this lib very flaky for the usage.

package.json Outdated
"name": "html-dnd",
"version": "1.2.0",
"name": "xl-html-dnd",
"version": "0.0.5",
Copy link
Member

Choose a reason for hiding this comment

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

Sorry for my too late reply... 🙇

What purpose of the changes at line 2 and 3 is?

Copy link
Author

Choose a reason for hiding this comment

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

it should be reverted, it's not supposed to be for a PR.
I had to release a separate lib to make it work, as my PR wasn't accepted ;)

Copy link
Member

Choose a reason for hiding this comment

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

OK, we can take either of the 2 ways:

  1. Revert some commits on this PR
  2. Create new PR that include squashed commit

Which way do you like?

@acierto
Copy link
Author

acierto commented Jan 29, 2018

I reverted back package.json so it's ready for merge.

Copy link
Member

@Kuniwak Kuniwak left a comment

Choose a reason for hiding this comment

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

Thanks! But still have a problem about coding style as the following:

src/html_dnd.ts[22, 1]: trailing whitespace
src/html_dnd.ts[25, 1]: trailing whitespace
src/html_dnd.ts[29, 1]: trailing whitespace
src/html_dnd.ts[34, 1]: trailing whitespace

Would you remove the trailing whitespaces?

chin2km and others added 2 commits February 8, 2018 15:14
Allow sleep before expecting results
@acierto
Copy link
Author

acierto commented Feb 8, 2018

Hi man, do you have any comments regarding PR to merge it?

The tests are not failing anymore after the last change, hopefully you will accept the PR and we can use your library directly instead of own fork!

If you have any comments, please let me know

@chin2km
Copy link

chin2km commented Feb 9, 2018

+1. It works flawlessly.

@Kuniwak
Copy link
Member

Kuniwak commented Feb 9, 2018

We should make test pass to keep stable.

So, I'm thinking about how to make it be testable.
Please wait few days.

@Kuniwak Kuniwak self-assigned this Feb 9, 2018
@acierto
Copy link
Author

acierto commented Feb 9, 2018

Let me clarify what you mean, as the first sentence doesn't make any sense for me.
Tests are already stable and they pass.

Do you want extra tests to reveal the current issue with IE e2e tests and then verify with this PR that the problem will be resolved?

Hint from my side, you need to have tests which will not render immediately, it should happen slowly, as it happens in real life on a big project. And as IE driver for protractor by nature is very slow it is reproducible on master code in 100% of the cases.

@Kuniwak
Copy link
Member

Kuniwak commented Feb 9, 2018

Oops, I missed the CI status... I'm sorry.

Now, I'm reviewing the patch again.

}, dispatchTimeout);
}, dispatchTimeout);
// Sleep to allow for the 4 events to occur before expecting any results.
sleep(dispatchTimeout * 4);
Copy link
Member

Choose a reason for hiding this comment

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

I don't want to use the sleep if it is possible. Because it make very high CPU usage.

I'm searching other ways that use "Execute Async Script API" such as WebDriver#executeAsyncScript.

But I don't know that whether major WebDriver libraries support this API.
If major WebDriver libraries do not support them, I' gonna accept the Pull request.

Copy link
Member

Choose a reason for hiding this comment

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

Fairly, we can use "Execute Async Script" API on major libraries:

Library Status for "Execute Async Script" API Source
selenium-webdriver Supported https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_WebDriver.html#executeAsyncScript
WebdriverIO Supported http://webdriver.io/api/protocol/executeAsync.html
Nightwatch.js Supported http://nightwatchjs.org/api/executeAsync.html
Protractor Supported http://www.protractortest.org/#/api?view=webdriver.WebDriver.prototype.executeAsyncScript

@acierto
Copy link
Author

acierto commented Feb 9, 2018

Fair enough, what do you think about it?

https://github.com/zengfenfei/delay

@Kuniwak
Copy link
Member

Kuniwak commented Feb 9, 2018

Fair enough, what do you think about it?

I saw it, but this library can not fit in this case.

But I think that using "Execute Async Script" API is the better way:

var dragAndDrop = require('html-dnd').code;
var webdriver = require('selenium-webdriver');
var By = webdriver.By;

var driver = new webdriver.Builder()
  .forBrowser('firefox')
  .build();

driver.get('http://example.com');

var draggable = driver.findElement(By.id('draggable'));
var droppable = driver.findElement(By.id('droppable'));

// This is the only change: executeScript -> executeAsyncScript
driver.executeAsyncScript(dragAndDrop, draggable, droppable);

driver.quit();

How do you feel it?

@Kuniwak
Copy link
Member

Kuniwak commented Feb 9, 2018

I'm gonna send new Pull request to your branch about it.

@acierto
Copy link
Author

acierto commented Feb 9, 2018

If it would be the single change how will it resolve the issue? As still 4 events won't wait for each other.
Basically with

// This is the only change: executeScript -> executeAsyncScript
driver.executeAsyncScript(dragAndDrop, draggable, droppable);

you guarantee that the end result will be synchronised, but the problem is also happening if another event is triggered with not waiting till the first one finished.

We can fix it or with callback hell as it is now, or with Promises, what will look better and as an end accord we can use executeAsyncScript to get rid of sleep.

@acierto
Copy link
Author

acierto commented Feb 9, 2018

I sent you an invitation in GoogleChat, maybe we can faster discuss it there.

@Kuniwak
Copy link
Member

Kuniwak commented Feb 9, 2018

I sent you an invitation in GoogleChat, maybe we can faster discuss it there.

Hmm, I feel it is hard because I'm not good at speaking English.
I like text-based conversation because some translation tools can help me.

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

Successfully merging this pull request may close these issues.

None yet

3 participants