Skip to content

Commit

Permalink
refactor tree toolbar help link spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Hoffman committed Jan 26, 2022
1 parent b683e72 commit 7fd51eb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 78 deletions.
2 changes: 1 addition & 1 deletion build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@
<env key="APPCONFIG_DATA_DIRECTORY" value="${aspace.data_directory.test}" />
<env key="APPCONFIG_DB_URL" value="${env.ASPACE_TEST_DB_URL}" />
<env key="APPCONFIG_SOLR_URL" value="${env.ASPACE_TEST_SOLR_URL}" />
<arg line="../build/${jruby_build_bin_path}/rspec -b --format d ${pattern-arg} ${tag-arg} ${order-arg} ${example-arg} ${spec-arg} ${extra-spec-paths}" />
<arg line="../build/gems/bin/bundler exec rspec -b --format d ${pattern-arg} ${tag-arg} ${order-arg} ${example-arg} ${spec-arg} ${extra-spec-paths}" />
</java>
</target>

Expand Down
98 changes: 21 additions & 77 deletions frontend/spec/features/tree_toolbar_import_help_link_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,121 +4,65 @@
$help_link_id = '#load_via_spreadsheet_help_icon'

describe 'Tree toolbar import help link', js: true do
before(:all) do
@repo = create(:repo, repo_code: "tree_toolbar_test_#{Time.now.to_i}")
set_repo(@repo)
@resource = create(:resource)
parent = create(:json_archival_object,
:resource => {'ref' => @resource.uri},
:title => "Parent")
create(:json_archival_object,
:resource => {'ref' => @resource.uri},
:parent => {'ref' => parent.uri},
:title => "Child 1")

$index.run_index_round
end

before(:each) do
visit '/'
page.has_xpath? '//input[@id="login"]'
within "form.login" do
fill_in "username", with: "admin"
fill_in "password", with: "admin"
click_button "Sign In"
end
login_admin
select_repository(@repo)
edit_resource(@resource)
end

page.has_no_xpath? '//input[@id="login"]'
after(:each) do
#Capybara.current_session.instance_variable_set(:@touched, false)
end

it 'should be visible on edit resource page load' do
click_link 'Browse'
click_link 'Resources'
find("#tabledSearchResults .btn-primary", match: :first).click

expect(page).to have_css($help_link_id, visible: true)
end

it 'should display a tooltip above when hovered on edit resource page' do
click_link 'Browse'
click_link 'Resources'
find("#tabledSearchResults .btn-primary", match: :first).click

page.should have_no_css("#$help_link_id[aria-describedby*='tooltip']")
page.find($help_link_id).hover
page.should have_css("#$help_link_id[aria-describedby*='tooltip'][data-placement='top']")
end

it 'should be hidden when resource tree is in reorder mode' do
click_link 'Browse'
click_link 'Resources'
find("#tabledSearchResults .btn-primary", match: :first).click

click_on 'Enable Reorder Mode'
expect(page).to have_css($help_link_id, visible: :hidden)
end

it 'should be visible on edit archival object page load' do
@resource = create(:json_resource)
@parent = create(:json_archival_object,
:resource => {'ref' => @resource.uri},
:title => "Parent")
@child1 = create(:json_archival_object,
:resource => {'ref' => @resource.uri},
:parent => {'ref' => @parent.uri},
:title => "Child 1")

$index.run_index_round

click_link 'Browse'
click_link 'Resources'
within('table#tabledSearchResults > tbody > tr:nth-of-type(2)') do
find(".btn-primary").click
end

within("#tree-container .table-row-group") do
find("a.record-title").click
end

expect(page).to have_css($help_link_id, visible: true)
end

it 'should display a tooltip above when hovered on edit archival object page' do
@resource = create(:json_resource)
@parent = create(:json_archival_object,
:resource => {'ref' => @resource.uri},
:title => "Parent")
@child1 = create(:json_archival_object,
:resource => {'ref' => @resource.uri},
:parent => {'ref' => @parent.uri},
:title => "Child 1")

$index.run_index_round

click_link 'Browse'
click_link 'Resources'
within('table#tabledSearchResults > tbody > tr:nth-of-type(2)') do
find(".btn-primary").click
end

within("#tree-container .table-row-group") do
find("a.record-title").click
end

page.should have_no_css("#$help_link_id[aria-describedby*='tooltip']")
page.find($help_link_id).hover
page.should have_css("#$help_link_id[aria-describedby*='tooltip'][data-placement='top']")
end

it 'should be hidden when archival object tree is in reorder mode' do
@resource = create(:json_resource)
@parent = create(:json_archival_object,
:resource => {'ref' => @resource.uri},
:title => "Parent")
@child1 = create(:json_archival_object,
:resource => {'ref' => @resource.uri},
:parent => {'ref' => @parent.uri},
:title => "Child 1")

$index.run_index_round

click_link 'Browse'
click_link 'Resources'
within('table#tabledSearchResults > tbody > tr:nth-of-type(2)') do
find(".btn-primary").click
end

within("#tree-container .table-row-group") do
find("a.record-title").click
end

click_on 'Enable Reorder Mode'
expect(page).to have_css($help_link_id, visible: :hidden)
end

end

0 comments on commit 7fd51eb

Please sign in to comment.