1
我正在使用水豚寫我的功能測試,在那裏我必須檢查每個按鈕的功能。其實,我正在測試以下功能: feature for testing image水豚測試:點擊按鈕無法正常工作
我試圖找到表格上的最後一個刪除圖標,然後單擊它,但是沒有出現對話欄。我的測試場景:
scenario 'delete button ' do
# click on delete icon does not work
(page.all('.table_amenities tr').last).find(".amenity_action>button", visible: false).click
expect(page).to have_content '削除してもよろしいですか?'
end
此功能的
Javascript代碼:
template#room-amenities-template
div[v-if="permissions[0]"]
#room-amenities-dialog
| {{ window.I18n.dialogs.delete_confirmation }}
.search_date
router-link[to="/buildings"]
span.but_choice.hvr-fade
i.fa.fa-home[aria-hidden="true"]
| {{ window.I18n.activerecord.models.building }}
a
span.but_choice_active
i.fa.fa-list[aria-hidden="true"]
| {{ window.I18n.activerecord.models.room_amenity }}
router-link[to="/room_types"]
span.but_choice.hvr-fade
i.fa.fa-bars[aria-hidden="true"]
| {{ window.I18n.activerecord.models.room_type }}
router-link[v-if="permissions[1]" to="/room_amenities/new"]
span#new-room-amenity.but_save.hvr-fade
i.fa.fa-plus[aria-hidden="true"]
| {{ window.I18n.buttons.new }}
.for_table_amenities
table.table_amenities[width="80%" border="1px solid #313131;"]
tr
th.amenity_number
| {{ window.I18n.support.tables.num }}
th.amenity_title
| {{ window.I18n.activerecord.models.room_amenity }}
th.amenity_action
| {{ window.I18n.support.tables.actions}}
tr[v-for="(roomAmenity, index) in roomAmenities"]
td
| {{ index + 1 }}
td.amenity_title
| {{ roomAmenity.title }}
td.amenity_action
template[v-if="permissions[2]"]
router-link[:to= "{ path: '/room_amenities/' + roomAmenity.id }"]
button.btn-link
i.fa.fa-pencil[aria-hidden="true"]
template[v-if="permissions[3] && roomAmenity.rooms.length === 0"]
| |
button.btn-link[@click= "promptRemove (index, roomAmenity.id)"]
i.fa.fa-trash.delete_from_table[aria-hidden="true"]
此表的
HTML代碼:
<td>4</td>
<td class="amenity_title">Refrigerator</td>
<td class="amenity_action">
<a href="/room_amenities/4" class="">
<button class="btn-link"><i aria-hidden="true" class="fa fa-pencil"> </i></button></a>
|
<button class="btn-link"><i aria-hidden="true" class="fa fa-trash delete_from_table"></i></button>
沒有任何人有一個想法,爲什麼對話欄可能沒有出現刪除圖標點擊?
它不起作用:( –
「不起作用」是什麼意思?你點擊錯誤,或者內容期望失敗?還是別的什麼? –
刪除按鈕點擊不會觸發對話欄的外觀 –