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

Add tests to cover bottom button functionality. #4222

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

demiankatz
Copy link
Member

This contains tests originally included in #4211 but split off due to problems with Mink behavior.

I finally figured out a way to get the tests to consistently pass, but it's a very ugly hack: detect when the native Mink click has failed, and then try again using a jQuery click manually performed with Javascript.

I have absolutely no idea why this is necessary. Why are clicks failing to register only on bottom buttons? Why is it only 10% of the time (for the print test -- even less frequent for the bulk test)?

Do we want to merge this with the ugly hack included, or is there a better way?

$page->find('css', '#addFormCheckboxSelectAll')->check();
$button->click();
$page->find('css', '#' . $idPrefix . 'addFormCheckboxSelectAll')->check();
$this->waitStatement('$("input.checkbox-select-item:checked").length === 2');
Copy link
Member Author

Choose a reason for hiding this comment

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

I added this waitStatement to both of the tests so that they match other earlier tests with the same behavior. It was an early attempt to fix the click-non-registration problem. It didn't help. I'm not sure if we should leave this in or take it out.

@ThoWagen
Copy link
Contributor

I also did some more testing and think got closer to the reason.

I tried to include the bottom buttons in the form and also replaced them with the top buttons. This did not fix the problem. When I also moved the buttons above the results the problem did not occur anymore.

So I believe this has to do with the position on the page and if you have to scroll down.

I tried to resize headless browser with --window-size="1366,2000" without an influence.

After resizing the window with $session->resizeWindow(1280, 2000, 'current');, the test now failed even without headless mode.

For some reason I could completely fix the problem by setting the height of the window to either $session->resizeWindow(1280, 200, 'current'); or $session->resizeWindow(1280, 10000, 'current');.

Can you reproduce this behavior?

@demiankatz
Copy link
Member Author

Thanks, @ThoWagen, I'm seeing exactly the same behavior. I have revised the test to use the window resize workaround instead of the Javascript workaround, and this feels slightly less awful than that (though it's still not at all a good thing, obviously!).

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

Successfully merging this pull request may close these issues.

2 participants