|
20 | 20 | end |
21 | 21 |
|
22 | 22 | it "shows a duplicate tag for assets with duplicates" do |
23 | | - page.execute_script(<<~JS) |
24 | | - (() => { |
25 | | - const start = Date.now(); |
26 | | - const tryExpand = () => { |
27 | | - const el = document.querySelector("[data-controller~='wunderbaum']"); |
28 | | - const controller = window.Stimulus?.getControllerForElementAndIdentifier(el, "wunderbaum"); |
29 | | - const node = controller?._findNodeByKey?.("#{root_folder.id}"); |
30 | | - if (node && !node.expanded) { |
31 | | - node.setExpanded(true); |
32 | | - return; |
33 | | - } |
34 | | - if (Date.now() - start < 2000) setTimeout(tryExpand, 50); |
35 | | - }; |
36 | | - tryExpand(); |
37 | | - })(); |
38 | | - JS |
| 23 | + within "#tree" do |
| 24 | + find("i.wb-expander", match: :first).click |
39 | 25 |
|
40 | | - expect(page).to have_selector(".wb-row .wb-title", text: duplicate_asset.isilon_name, wait: 10) |
41 | | - |
42 | | - title = find(".wb-row .wb-title", text: duplicate_asset.isilon_name, wait: 10) |
43 | | - row = title.find(:xpath, "./ancestor::div[contains(@class,'wb-row')]") |
44 | | - |
45 | | - within(row) do |
46 | | - expect(page).to have_selector(".duplicate-tag", text: "Duplicate", wait: 10, visible: :all) |
| 26 | + expect(page).to have_selector(".wb-row .wb-title", text: duplicate_asset.isilon_name, wait: 10) |
| 27 | + expect(page).to have_xpath( |
| 28 | + "//div[contains(@class,'wb-row')]" \ |
| 29 | + "[.//span[contains(@class,'wb-title')][normalize-space()='#{duplicate_asset.isilon_name}']]" \ |
| 30 | + "//span[contains(@class,'duplicate-tag')][normalize-space()='Duplicate']", |
| 31 | + wait: 10 |
| 32 | + ) |
47 | 33 | end |
48 | 34 | end |
49 | 35 | end |
0 commit comments