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

Stabilize the SelenideAddonsTest #143

Closed
occupant23 opened this issue Sep 25, 2020 · 13 comments
Closed

Stabilize the SelenideAddonsTest #143

occupant23 opened this issue Sep 25, 2020 · 13 comments
Assignees
Labels
bug codeDone The issue is rechecked for development branch codeReadyForRecheck The issue is fixed/implemented AND merged into development, but needs to be rechecked there High Priority
Milestone

Comments

@occupant23
Copy link
Contributor

The problem of issue #125 occurred again.
Find a way to work in both situations GDPR overlay visible or not.

@occupant23 occupant23 added the bug label Sep 25, 2020
@occupant23 occupant23 added this to the v4.1.0 milestone Sep 25, 2020
@occupant23 occupant23 self-assigned this Sep 25, 2020
occupant23 pushed a commit that referenced this issue Sep 25, 2020
@occupant23 occupant23 added codeReadyForRecheck The issue is fixed/implemented AND merged into development, but needs to be rechecked there High Priority labels Sep 25, 2020
@oomelianchuk
Copy link
Contributor

The test is still unstable on my machine. The tests testDownwardDragAndDrop, testUpwardDragAndDrop, testDownwardDragAndDropUntilCondition and testUpwardDragAndDropUntilCondition failed while the test run. As I added the slider.scrollIntoView(true); line for downward tests and the slider.scrollIntoView(true); slider.scrollIntoView(false); lines for the upward tests, the test seemed to stabilize. Please check, if these lines provoke any failures on your machine and if they don't, add them to the tests.

@oomelianchuk
Copy link
Contributor

Wouldn't it be helpful for the future debugging of the test, to add some asserts about the slider state before interactions, like this?

    @Test()
    public void testLeftwardDragAndDrop()
    {
        openSliderPage();
        SelenideElement slider = $(".balSlider a[role=slider]");
        Assert.assertEquals("-10", slider.getAttribute("aria-valuenow"));
        SelenideAddons.dragAndDrop(slider, -32, 0);
        Assert.assertEquals("-2", slider.getAttribute("aria-valuenow"));
    }

@oomelianchuk
Copy link
Contributor

Should we prefer the JUnit assertions or Selenide assertions for the slider value check? On the one hand, the JUnit assertion has a clearer error message and doesn't contain any (useless?) information about the slider element. On the other hand, Selenide provides implicit wait e.g. for the case of slow internet connection. What do you think?

@oomelianchuk
Copy link
Contributor

Why do you use waitUntil with the Neodymium.configuration().selenideTimeout() value, isn't this the same as simply shouldBe(hidden) ?

@oomelianchuk
Copy link
Contributor

I noticed, that the code like this

        try
        {
            $("#onetrust-accept-btn-handler").shouldBe(visible);
        }
        catch (ElementNotFound e)
        {
            overlayIsVisible = false;
        }

is/can be used in multiple projects, e.g. I built a custom method like this for the cardfactory project. Wouldn't it be a good idea to extend SelenideAddons with methods to wait until or while some condition, without any exception throwing but just returning a boolean value as information whether the condition was fulfilled?

@occupant23
Copy link
Contributor Author

The test is still unstable on my machine. The tests testDownwardDragAndDrop, testUpwardDragAndDrop, testDownwardDragAndDropUntilCondition and testUpwardDragAndDropUntilCondition failed while the test run. As I added the slider.scrollIntoView(true); line for downward tests and the slider.scrollIntoView(true); slider.scrollIntoView(false); lines for the upward tests, the test seemed to stabilize. Please check, if these lines provoke any failures on your machine and if they don't, add them to the tests.

Can't be reproduced. Seems to be associated with changing test to not headless and the used display.

@occupant23
Copy link
Contributor Author

Wouldn't it be helpful for the future debugging of the test, to add some asserts about the slider state before interactions, like this?

    @Test()
    public void testLeftwardDragAndDrop()
    {
        openSliderPage();
        SelenideElement slider = $(".balSlider a[role=slider]");
        Assert.assertEquals("-10", slider.getAttribute("aria-valuenow"));
        SelenideAddons.dragAndDrop(slider, -32, 0);
        Assert.assertEquals("-2", slider.getAttribute("aria-valuenow"));
    }

Good point, will be done.

@occupant23
Copy link
Contributor Author

Should we prefer the JUnit assertions or Selenide assertions for the slider value check? On the one hand, the JUnit assertion has a clearer error message and doesn't contain any (useless?) information about the slider element. On the other hand, Selenide provides implicit wait e.g. for the case of slow internet connection. What do you think?

Will be changed to Selenide assertions since this is the preferred way. Good catch.

@occupant23
Copy link
Contributor Author

Why do you use waitUntil with the Neodymium.configuration().selenideTimeout() value, isn't this the same as simply shouldBe(hidden) ?

I checked it. The functions are the same. I will adjust this.

@occupant23
Copy link
Contributor Author

I noticed, that the code like this

        try
        {
            $("#onetrust-accept-btn-handler").shouldBe(visible);
        }
        catch (ElementNotFound e)
        {
            overlayIsVisible = false;
        }

is/can be used in multiple projects, e.g. I built a custom method like this for the cardfactory project. Wouldn't it be a good idea to extend SelenideAddons with methods to wait until or while some condition, without any exception throwing but just returning a boolean value as information whether the condition was fulfilled?

Created issue #148 for this.

occupant23 pushed a commit that referenced this issue Oct 9, 2020
@occupant23
Copy link
Contributor Author

done can be rechecked again

@occupant23
Copy link
Contributor Author

@oomelianchuk: Can be rechecked again.

occupant23 pushed a commit that referenced this issue Oct 27, 2020
added a method for opening the blog page
@oomelianchuk
Copy link
Contributor

In my opinion, the test is now good and clear. I have no more complaints :)

@occupant23 occupant23 added the codeDone The issue is rechecked for development branch label Oct 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug codeDone The issue is rechecked for development branch codeReadyForRecheck The issue is fixed/implemented AND merged into development, but needs to be rechecked there High Priority
Projects
None yet
Development

No branches or pull requests

2 participants