Hidden buttons Capybara - ruby-on-rails

I am trying to test a hidden button in capybara but so far have not been able to get it to work without the following error.
undefined method `click_on' for [#<Capybara::Element tag="button">]
Could someone possibly suggest the correct syntax to do so.
The call is below:
When(/^I tap on the play button$/) do
expect(page).to have_selector('.playback', visible: false)
page.all('.playback').click_link

Ok so going from the comments/answers. Here is what I would do:
Unhide the button.
Make the spec pass. #tridadc 's answer should work.
Mark the test as pending/TODO
Put the button back to hidden.
When the button is ready and visible, change the test from pending to active.

If your button is hidden, I think you need to do this:
find(".playback", visible: false).click
You can also try
Capybara.ignore_hidden_elements = false
find(".playback").click
Capybara.ignore_hidden_elements = true

Related

Extjs 6 Ext.grid.plugin.RowEditing Remove Update / Cancel buttons

I am trying to remove update cancel buttons.
but no any config's are available for this.
I have tried to override but i cant remove this.
please if you have done task like this or know how to do this help me.
You're absolutely right that there is no built-in way to hide the update and cancel buttons with the row editing plugin.
You could try to hide the button bar via CSS. The normal CSS class name is x-grid-row-editor-buttons. But this may cause other problems.
Or, you could try a different editor, such as the CellEditing plugin - this lets you edit one cell at a time, as opposed to showing the editors for the entire row, and doesn't use buttons.
You might be able to remove the button by overriding the Ext.grid.plugin.RowEditing. A quick look at the source shows me an array with in the initEditiorFunction() which looks like this.
btns = ['saveBtnText', 'cancelBtnText', 'errorsText', 'dirtyText'],
Try removing the cancelBtnText button, and perhaps it won't show on there? I haven't tested this but this might be something in the right direction.

Disable button once clicked Cheatengine Lua

So I've been struggling making a button that on pressed goes to a link and toggles Enabled to false so you cant click it anymore
function CEButton1Click(sender)
shellExecute("https://google.com/search")
CEButton1.Enabled=false
end
The above is what I have so far but it does not seem to be working.
The documentation for cheat engine is severely lacking, but sender in that function is actually the button itself. This means you can simple do
sender.Enabled = false
and that successfully disables the button.

JQuery Mobile Fixed Toolbar Hide

I was trying to simulate "tap to show/hide the fixed toolbar" when I found out that it's already the default function hahaha!
By default works charmly: it starts "show" and when it taps then "hide" and when taps again "shows" etc. PERFECT!
The problem is that I want it to start hidden and when the user taps shows and so on...
I used
$(".divBotoneraSimple").hide();
but then it doesn't show when tapped! I also tried:
$.mobile.fixedToolbars.hide(true);
$("[data-position='fixed']").fixedtoolbar('hide');
but both of them "stop my App" when triggered!
In order words I need to trigger those hides from javascript and still respond to tapping!
Use .toolbar() method with show, hide or toggle.
$(".ui-header, .ui-footer").toolbar("toggle");
Note that if you are at the top of the page, the header won't be hidden, only the footer, and vice versa.

Capybara + Poltergeist + Phantomjs. Unable to click a button

i have a button, upon clicking it will change the display of a div from none to block. I wanted to click on the button, have the div displayed as 'block', click "Done" and then the div's display become 'none'. Capybara was able to click on the 1st button but it couldn't seem to find the 2nd button "Done". I tried several ways:
click_on("Done")
find_button("Done").trigger('click')
find_button("Done").trigger('click')
find_link("Done").trigger('click')
I even tried to use javascript:
page.execute_script("document.getElementById('button_done').click()")
but nothing happens. I printed out the display property of the pop-up div prior to the clicking "Done" and after the clicking to check if the button was click but both statements gave me the div's property as 'block' (expected 'block' before clicking "Done" and changed to "none" after the clicking).
I allowed it to sleep(10) but doesn't seem to help.
I used the same javascript on the page console and it worked as it should be.
Any inputs?
Thanks
EDIT:
feature:
Given I click on "Create an item"
And I chose an option
Then I should be able to create an item
steps:
step "I chose an option" do
within ('#web') do
click_on "On"
end
sleep 3
#Here is where the div gets displayed with the 'Done' button
find('#button_done').click #(doesn't work though)
sleep 3
click('Create')
end
try find('selector', :visible=>false)

How to disable a button after click in limejs

How do I disable a button after click in limejs? I have tried using
this.disable()
but it does not work.
You can also use goog.events.listenOnce. Identical signature to goog.events.listen and will only fire once.
Try goog.events.listen and goog.events.unlisten:
goog.events.listen(my_button, ['mousedown','touchstart'],function_triggered_onClick);
goog.events.unlisten(my_button, ['mousedown','touchstart'],function_triggered_onClick);
goog.events.unlisten will disable the button untill code reaches goog.events.listen again

Resources