--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/4042ad52-757e-41b9-be2a-9bee2639623e%40googlegroups.com.
Hi François,Thank you very much for your email. It's great to learn that Geb is being used to test the frontend of Gradle Enterprise. It's also cool to see that a fairly new addition to Geb in the form of NavigatorEventListener is being used out there in the wild.
I think what you're doing makes a lot of sense. I think most folks writing browser tests for modern, single page apps deal with flakiness caused by async events in one form or another. For example, on my current project, we recently had a push to quash flakiness in our tests and introduced a number of custom reporters which turned out to be very effective:
- one which writes browser console logs- one which remote controls (https://github.com/ldaley/remote-control) into the server and writes a thread dump to see if any long running operations are currently in flight
Both of them could probably be pulled into Geb core in one form or another, with the biggest stumbling block probably being making the first one cross browser.
I find big parts of what you've done useful and generic enough to be pulled into core. Let me comment one by one:
1. I don't see much value in adding the window size onto the screenshot. I personally tend to make my tests reliable with regards to browser size by always setting the browser size to a predefined value when constructing a driver instance, e.g.:
driver.manage().window().size = new Dimension(1024, 768)
2. For reporting browser url I would probably introduce a new geb.report.Reporter implementation that writes the url into a text file, I don't think that there is a valid reason for why that information should be written onto the screenshot
3. Writing out current active element and mouse position looks great. We could enhance geb.report.ScreenshotReporter with configuration properties like reportCurrentElement and reportMousePosition and write that info into the screenshot if these properties are set - that way it would be a backwards compatible change and we could change the default values of these props to true in the next major version. Unfortunately I don't have the capacity at the moment to see if one can get mouse position in a cleaner or more efficient way than you have done.
4. For dealing with rendering the position of what will be clicked I think we should extend the reporting mechanism to be able to pass additional information via some kind of a context and then react in the reporter to that data being set and perform additional actions.If you’re up for contributing back what you have then I’d suggest attacking points 2 and 3 and when we get that merged I will tackle 4 cause that will be a bit more involved with regards to introducing a reporting context.
Cheers,Marcin
To unsubscribe from this group and stop receiving emails from it, send an email to geb-...@googlegroups.com.
With Luke on the team, what would you expect ;) ? We've been using it right from the start.
We do have such setting, but with large width/height.
It seems that when executed locally, if the window dimension is larger than your machine screen, then the dimension is capped to the screen. Therefore we sometimes have different behaviors locally on and CI (e.g. tooltip hiding an element that is then not clickable, due to the positioning of the tooltip being somewhat influenced by the window dimension).
2. For reporting browser url I would probably introduce a new geb.report.Reporter implementation that writes the url into a text file, I don't think that there is a valid reason for why that information should be written onto the screenshotAgreed. This was a quick hack (yet valuable) to pinpoint some missing waitFor's.That being said, having to look at a text file _and_ a screenshot is less ideal to get the global 'context' of a browser test failure.
I'll try to prepare something on my time off. It's therefore going to take a bit of time, but I'll do it.
While we're discussing improvements, it would be great than the 'context' you're referring to was shared between the beforeClick / afterClick callbacks., and if we could somehow inject an arbitrary object into it.The use case is that we have some clicks that trigger an animation (using velocity.js). The targeted element has a 'velocity-animating' CSS class when being animated. We currently use the presence (or the lack thereof) of this CSS class to ensure the animation is fully done. But the logic is not perfect, because if we're entering the 'afterClick' callback before the animation has even started (which could happen when the browser is under stress, like in CI), we don't find the 'velocity-animating- CSS class, and think the animation is over. To overcome this, I still need to have a little waitFor with a timeout, to ensure sufficient time is waited (for the likeliness of this scenario to happen to be near zero)If we share an object between the beforeClick/afterClick context, I can then register something that somehow is notified when the animation will start (and we know it will start), and then the afterClick can query this same object to know if the animation has started (and potentially is already over) reliably.
Hi François,Apologies for the delay in my response, I was on holidays.
On Sat, Feb 8, 2020 at 1:34 PM François Guillot <fran...@gradle.com> wrote:With Luke on the team, what would you expect ;) ? We've been using it right from the start.You never know, people move on and find new toys to play with. :)We do have such setting, but with large width/height.
It seems that when executed locally, if the window dimension is larger than your machine screen, then the dimension is capped to the screen. Therefore we sometimes have different behaviors locally on and CI (e.g. tooltip hiding an element that is then not clickable, due to the positioning of the tooltip being somewhat influenced by the window dimension).Right, I see.
2. For reporting browser url I would probably introduce a new geb.report.Reporter implementation that writes the url into a text file, I don't think that there is a valid reason for why that information should be written onto the screenshotAgreed. This was a quick hack (yet valuable) to pinpoint some missing waitFor's.That being said, having to look at a text file _and_ a screenshot is less ideal to get the global 'context' of a browser test failure.I agree with you that it's more convenient to have that info all in one file, but we have to be careful when considering pulling stuff into core not to make the screenshots a dumping ground for information that might be useful to some users. As I said, I'd be more than happy to accept a PR with a custom reporter which reports on the url and dimensions of the browser in a text form but I'm afraid I will have to say no to including that information in the screenshot as I personally believe it is not the right place for that information.
I'll try to prepare something on my time off. It's therefore going to take a bit of time, but I'll do it.Looking forward to it. Fingers crossed that you will get round to it at some point, however long that might take.While we're discussing improvements, it would be great than the 'context' you're referring to was shared between the beforeClick / afterClick callbacks., and if we could somehow inject an arbitrary object into it.The use case is that we have some clicks that trigger an animation (using velocity.js). The targeted element has a 'velocity-animating' CSS class when being animated. We currently use the presence (or the lack thereof) of this CSS class to ensure the animation is fully done. But the logic is not perfect, because if we're entering the 'afterClick' callback before the animation has even started (which could happen when the browser is under stress, like in CI), we don't find the 'velocity-animating- CSS class, and think the animation is over. To overcome this, I still need to have a little waitFor with a timeout, to ensure sufficient time is waited (for the likeliness of this scenario to happen to be near zero)If we share an object between the beforeClick/afterClick context, I can then register something that somehow is notified when the animation will start (and we know it will start), and then the afterClick can query this same object to know if the animation has started (and potentially is already over) reliably.The context I talked about in my previous email was meant to be used to communicate between a caller to report() and various reporters. What you are talking about seems to be a completely different concern which has to do with communicating between respective before/after methods on NavigatorEventListener and possibly also between beforeAtCheck and onAtCheckSuccess/onAtCheckFailure methods on PageEventListener. This sounds like it might be something useful - please feel free to create an issue for implementing this in the tracker at https://github.com/geb/issues/issues.
On the other hand I'm not sure I understand how this helps you to work around the fact that there is a period of time between something being clicked and the animation marker class being added to the animated element but maybe I don't fully grok what you're trying to explain or do not have the full context to be able to do so. In my opinion one cannot reliably wait for an asynchronously initiated (the fact that it's asynchronous being the key here), temporary state to complete because you either run into the issue that you will consider the state to be completed because you check for it before it even started or you run into the possibility of not detecting the state (animation) to occur at all if it is very short and it manages to start and stop between your polling checks.
Marcin
--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/CA%2B52dQRCK%3DodyUhS-oqpy-5sBdf9kDiQBOakmPg8eo5a8oW7tw%40mail.gmail.com.
I agree with you that it's more convenient to have that info all in one file, but we have to be careful when considering pulling stuff into core not to make the screenshots a dumping ground for information that might be useful to some users. As I said, I'd be more than happy to accept a PR with a custom reporter which reports on the url and dimensions of the browser in a text form but I'm afraid I will have to say no to including that information in the screenshot as I personally believe it is not the right place for that information.Totally agree with you here. If it ends up in core, it will be on a separate report.
The context I talked about in my previous email was meant to be used to communicate between a caller to report() and various reporters. What you are talking about seems to be a completely different concern which has to do with communicating between respective before/after methods on NavigatorEventListener and possibly also between beforeAtCheck and onAtCheckSuccess/onAtCheckFailure methods on PageEventListener. This sounds like it might be something useful - please feel free to create an issue for implementing this in the tracker at https://github.com/geb/issues/issues.Yes that is exactly that.On the other hand I'm not sure I understand how this helps you to work around the fact that there is a period of time between something being clicked and the animation marker class being added to the animated element but maybe I don't fully grok what you're trying to explain or do not have the full context to be able to do so. In my opinion one cannot reliably wait for an asynchronously initiated (the fact that it's asynchronous being the key here), temporary state to complete because you either run into the issue that you will consider the state to be completed because you check for it before it even started or you run into the possibility of not detecting the state (animation) to occur at all if it is very short and it manages to start and stop between your polling checks.It's just that if you share some state between the before and after click, you're sure to not miss the start of the animation, and then poll for its end.You're right that this cannot work based on polling only, the state holder would have to be notified when the animation start, but I'm sure there must be some ways to achieve that, no?