Friends, I have a big problem. If I register a record and the amount is greater than the one shown in the list, it is saved in another pagination. Capybara is only finding if the record is visible and on the first pagination. How do I search for this record if there are multiple paginations?
**I'm using this:**
def cad_diametro_material_active
input_cod.send_keys('aut_Server_AL')
input_order.send_keys('1')
@ger_material_active = 'automation_Server_ALUMINIO_ACTIVE' rand(1..99).to_s
input_description.send_keys(@ger_material_active)
btn_insert.click
find("td", text: @ger_material_active).click
**#The query was finding the record, but as the record moved to the other pagination it can't find it anymore. It seems that capybara only finds it when it is visible on the screen**
CodePudding user response:
Capybara tests what the user would see - if the item isn't visible on the screen then Capybara won't "see" it because a user wouldn't. Therefore you need to do what a user would do, click whatever on the screen moves them to the next page of records. As a tester you should control the test data and know that the record will be showing on the first or second (or third) page of results being shown, and write your test accordingly. You don't show the HTML of your page so it's not possible to tell you exactly what you should be clicking on.
Also, stop using send_keys
for everything -- when you have normal HTML input type elements use fill_in
or set
before opting for send_keys