On Sun, Feb 16, 2020 at 2:32 PM François Guillot <[email protected]> wrote:
> 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. > Awesome. > 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? > I'm sorry but I don't see a way to achieve that... How would you register anything to be triggered when the animation starts? Does velocity.js have a callback for that? Even if it does, then it will be executed in the browser and as far as I know there is no way to call back from javascript to Selenium. It feels to me that what you're after is adding a class that signifies that an element is being animated in an on click handler in js which will be synchronous and then removing that class when an animation completes (looks like velocity.js allows to register a function which is executed when an animation completes). The below trait shows what I propose applied to css transitions and based on transitionend event ( https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/transitionend_event ): trait CssTransitionWaitingSupport implements Navigator, WaitingSupport { abstract JavascriptInterface getJs() void waitForCssTransitionToFinish(Closure trigger) { js.exec(singleElement(), ''' var o = jQuery(arguments[0]); window.setTransitionFinishedClass = function() { $(this).addClass('transitionFinished'); } o.bind('transitionend', window.setTransitionFinishedClass); ''') try { trigger.call() waitFor { hasClass('transitionFinished') } } finally { js.exec(singleElement(), ''' var o = jQuery(arguments[0]); o.unbind('transitionend', window.setTransitionFinishedClass); o.removeClass('transitionFinished') window.setTransitionFinishedClass = undefined; ''') } } } -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/CA%2B52dQR%2BThtBNA8qV5%3D%2B9n_oFtq8GAOCo9MqatjqXioQd-g%2BJQ%40mail.gmail.com.
