selenium capybara, hover menu skip animate show - ruby

I have a website need test e2e, in each case, I must hover the main menu for sub-menu showing, then click goto next step.
Because only click sub-menu success after menu is hovered in 1.5 seconds, So every time I want to goto next page, I must pay 2 seconds for waiting sub-menu showing and click it.
Is there others ways to work around it? My test case running really slow now
Thanks :)

You have a couple of options: If it's your sites code set the activation time for your sub-menus to be much shorter when run in the test environment. If not - what exactly are you testing? If you're testing that the menu works then you'll just have to live with the delay. If however you just want to test that the links in the menu go to valid places you could find the hidden menu entries, get the destinations, and visit them directly
visit(find_link('Sub-Menu entry text', visible: :all)['href'])
It really does depend on what your testing environment is and what exactly you're trying to test.

Related

Protractor screenshot of open select box not working

Next in my list of protractor woes:
I have a case where I click on a select element and hover over the empty choice at the top, and grab a screenshot of that. Or at least I try. It grabs the screenshot, no errors, and moves on. However, not with the select box open. Just a closed select box.
What am I missing? Here's the snippet:
createPage.userid.click();
// Take screenshot of page
browser.takeScreenshot().then(function (jpg) {
writeScreenShot(jpg, 'screenshots/deleteUser.jpg');
});
I've tried a few other things I've found on here like trying to click it open, and then hovering the option, etc. but nothing works.
EDIT:
Something I've noticed that may have to do with this. When I let the browser run behind an open other window, when the dropdown opens, it shows up in front of said window, totally detached from the browser. Which reminded me of one of those key concepts I learned when I was a wee web developer that dropdown menus are given a z-index pretty much above everything else when they open. Could it simply be that protractor can't see the open dropdown because it's so "high up"?

Firefox context menu: different render method

So this is a rather specific question I feel. I want to be able to pre-load the Firefox context menu. I'd like this to happen each time a new tab and/or window is opened. I want the menu and all its associated items to be rendered upon such a request, but I don't want the menu to open as well.
And just to preface, I have e-mailed the developers of OneTab about this, no reply.
(This next section's a bit rambly, but it does explain how I came to the above question).
To contextualise why I'd like to do this: I use an addon called OneTab. It's an awesome addon (and this isn't a plug, just what I think). It can transfer some/all of your current tabs in Firefox into a singular tab for reviewing etc later. So each time you send a bunch of tabs into OneTab, it creates a new group for them. You can name these groups too which I like to do. Helps stay organised. I habitually create a lot of tabs when I'm browsing. So I've also got a lot of tab groups. Now another feature is OneTab's context menu. This is pretty much the method by which you send tabs to OneTab. Now once you've created tab groups, you can then send future tabs to those groups, via the context menu.
Rendering all those options each time the menu is opened on a new tab, takes about 3 seconds for me at the moment. It also stops me interacting with any part of Firefox for that time. Here's an example of the (current) menu structure. Example of OneTab menu structure. At the top right of the menu structure, where it says "Surge protection", there are 4 sub-menu headings. This is the case for all the other tab groups. So that's a lot of entries to render at once. I'm not surprised it takes a while.
One other thing: after I've loaded the context menu once (on the particular tab I'm on), it's just there. The next time I right-click it loads instantly, which is what I want to happen in the first place!!
So this is why I'm asking if it's possible to change the behaviour of the context menu from the Firefox source code. So that all the items are pre-rendered each time a new tab/window is created, but the menu is still opened normally via a right-click. And I think I'd like to utilise Workers for this. Because I know that Workers are background. They don't prevent user interaction. And that's exactly what happens currently, for 3 seconds. And if there's a way of doing this via an addon then so much the better. Whatever works!
Does this all make sense somewhat? I'm sorry if I've broken any formatting rules or something by posting such a long and wordy question! Just thought I might as well be detailed.

Firefox Web Developer Tools - how to see the code associated with a button

I'm not really sure how to best word this, but let's say I'm on a web page and when I click a certain button, something undesirable happens. Like a whole bunch of content disappears. Is there a way in the Firefox debugging tools where I can insert a watch on that button so when I click it, the debugger will pause the JS execution and show me exactly where in the code it's executing the stuff I don't want?
(note: obviously this is code I did not write, otherwise I'd know where to look to fix the problem)
Yes, in the debugger there is an events pane, and you can break when a specific event is triggered. The documentation is here:
https://developer.mozilla.org/en-US/docs/Tools/Debugger#events-pane
Firefox has a good built-in profiler - you can click the start profile, and click it again to end, and see what parts of the code are running the most.
This is really helpful in finding performance problems too.

Start Firebug when radio button is clicked

I have a complicated mess of code (built by a team of 7 over the course of several years) that incorporates multiple libraries - jQuery and angularjs, specifically.
I know that the value of a variable changes when I click a certain radio button, but I have no idea what is running when that happens to cause the variable to change. I've tried console.log in every place I can think of, but am somehow still missing the action that's changing the variable.
I know how to debug with Firebug if I know where to place my breakpoint, but in this case, I don't. Is there any way to tell Firebug to start debugging at the line that executes immediately after the radio button is clicked? In other words, when I click the radio button, open Firebug's Script panel to the first line in order of execution, wherever that line may be.
If you have chrome you can right click on the checkbox -> inspect element -> event listeners
Is there any way to tell Firebug to start debugging at the line that
executes immediately after the radio button is clicked?
Yes, this feature is called Break On Next.
Note that Firebug has much more features to debug your scripts besides setting breakpoints within the Script panel. These features are described in the 'Script Debugging' page inside the Firebug wiki.
Furthermore the Watch side panel allows you to inspect the variable to see, at which step it is changed.

VB6 - View Code will not display code

This is probably a really dumb question but i'll ask anyway.
I was wondering if there was any reason as to why a form wouldn't display its code when i click "view code" from the right click context menu in vb6?
It was working awhile ago so i'm kind of stumped.
Thanks
If forms are still not visible, try Window -> Cascade - This was the way I goit my forms visible again.
Maybe it is being displayed under something else. Check under the Window menu. Do you see it there?
Does the form display if you right click and select 'View Object'? If so, try double clicking on the form - that should display the source. You might also check the permissions to the file.
This is an old question, but since it's the first link retuned by a Google search, answering here may help many people.
Like someone else said, Window/Cascade does the trick, but with time it becomes annoying.
I have the same problem on my laptop with an external display. Closing the laptop cover (thus going back to only one display) fixes the issue.
An alternate way is to display the VB6 IDE on the main display (your main display is the one with icons on the bottom right corner). You can set your main display under System Preferences/Displays. There's a checkbox called "make this one the main display", it does not need to be your monitor #1.
Problem does not seem to occur if you have 2 displays side-by-side. Also, the fact that my laptop's resolution is not the same as the external display's resolution may cause the issue.
After taking these steps, you may have to restart the VB6 IDE to fix the issue.

Resources