2015-09-05 29 views
0

我在頁面上有兩個表格。第二張桌子是空白的。在第一個表格中的值旁邊單擊鏈接時,該值將填充到第二個表格中。它不會從第一個表中消失。如何使用Minitest和Capybara編寫斷言來檢查第二個表中是否存在值?

如何寫一個斷言來檢查它是否已經進入第二個表。

這兩個表都有ID。

我知道怎麼做find:xpath,我只是不知道如何用find的值。我可以find新的:xpath,但不是價值。

回答

0

如果使用RSpec的,你可以在不使用的RSpec它

assert_selector(:id, 'id of second table', text: 'text value you expect to appear in the table') 

如果您的問題是,你不知道如何從第一個表中提取值做

expect(page).to have_selector(:id, 'id of second table', text: 'text value you expect to appear in the table') 

,然後您需要提供該表格中的html示例。

0

我能巢含xpath一個within塊內的斷言:

within(:xpath, '//*[@id="1"]/td[2]') do 
    page.must_have_content("My Content") 
end 
+0

是什麼must_have_content做期待(頁)。爲了have_content(...)沒有做? –

相關問題