目的
普段はvisibility: hidden;
になり表示されないけど何かのボタンを押した瞬間表示される
よね?というテストを書きたい。
結論
have_selectorにvisibleオプションをつけてテストすればOK
アプローチ
失敗
expect(page).to have_no_css(識別子名)
では意味がない。
隠れているだけで要素そのものはブラウザに読み込まれているから。
こうした
expect(page).to have_selector(識別子名, visible: false)
$(なんかのボタン).click
expect(page).to have_selector(識別子名, visible: true)
これで動く