很奇怪的问题,测试页面是否有 head,竟然测不通!
expect(page).to have_selector(:xpath, "/html/head")
报错:
Failure/Error: expect(page).to have_selector(:xpath, "/html/head") expected to find visible xpath "/html/head" but there were no matches. Also found "", which matched the selector but not all filters.
难道我的页面没有 head? 可是我检查过,响应很正常,head 和 body 都是有的。
body 和 title 是可以测通的。
expect(page).to have_selector(:xpath, "/html/body")
expect(page).to have_title(@home.title + ' - ' + I18n.t('app_name'))