-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1476 from sparc-request/kg-accordion_specs
KG - Accordion Specs
- Loading branch information
Showing
7 changed files
with
423 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
spec/features/catalog_manager/accordion/user_loads_core_accordion_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Copyright © 2011-2018 MUSC Foundation for Research Development | ||
# All rights reserved. | ||
|
||
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following | ||
# disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products | ||
# derived from this software without specific prior written permission. | ||
|
||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | ||
# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT | ||
# SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe 'User loads a core accordion', js: true do | ||
let_there_be_lane | ||
fake_login_for_each_test | ||
|
||
before :each do | ||
@institution = create(:institution) | ||
@provider = create(:provider, parent: @institution) | ||
@program = create(:program, parent: @provider) | ||
@core = create(:core, parent: @program) | ||
@service = create(:service, organization: @core) | ||
create(:catalog_manager, organization: @institution, identity: jug2) | ||
|
||
visit catalog_manager_catalog_index_path | ||
wait_for_javascript_to_finish | ||
|
||
find("#institution-#{@institution.id} .glyphicon").click | ||
find("#provider-#{@provider.id} .glyphicon").click | ||
find("#program-#{@program.id} .glyphicon").click | ||
wait_for_javascript_to_finish | ||
find("#core-#{@core.id} .glyphicon").click | ||
wait_for_javascript_to_finish | ||
end | ||
|
||
it 'should load the core\'s services' do | ||
expect(page).to have_selector('.text-service', text: @service.name) | ||
end | ||
end |
48 changes: 48 additions & 0 deletions
48
spec/features/catalog_manager/accordion/user_loads_program_accordion_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright © 2011-2018 MUSC Foundation for Research Development | ||
# All rights reserved. | ||
|
||
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following | ||
# disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products | ||
# derived from this software without specific prior written permission. | ||
|
||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | ||
# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT | ||
# SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe 'User loads a program accordion', js: true do | ||
let_there_be_lane | ||
fake_login_for_each_test | ||
|
||
before :each do | ||
@institution = create(:institution) | ||
@provider = create(:provider, parent: @institution) | ||
@program = create(:program, parent: @provider) | ||
@core = create(:core, parent: @program) | ||
@service = create(:service, organization: @program) | ||
create(:catalog_manager, organization: @institution, identity: jug2) | ||
|
||
visit catalog_manager_catalog_index_path | ||
wait_for_javascript_to_finish | ||
|
||
find("#institution-#{@institution.id} .glyphicon").click | ||
find("#provider-#{@provider.id} .glyphicon").click | ||
find("#program-#{@program.id} .glyphicon").click | ||
wait_for_javascript_to_finish | ||
end | ||
|
||
it 'should load the program\'s cores and services' do | ||
expect(page).to have_selector('.text-core', text: @core.name) | ||
expect(page).to have_selector('.text-service', text: @service.name) | ||
end | ||
end |
113 changes: 113 additions & 0 deletions
113
spec/features/catalog_manager/accordion/user_searches_accordion_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# Copyright © 2011-2018 MUSC Foundation for Research Development | ||
# All rights reserved. | ||
|
||
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following | ||
# disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products | ||
# derived from this software without specific prior written permission. | ||
|
||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | ||
# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT | ||
# SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe 'User searches for services and organizations', js: true do | ||
let_there_be_lane | ||
fake_login_for_each_test | ||
|
||
before :each do | ||
@institution = create(:institution) | ||
@provider = create(:provider, parent: @institution) | ||
@program = create(:program, parent: @provider) | ||
@core = create(:core, parent: @program) | ||
@service = create(:service, organization: @core) | ||
create(:catalog_manager, organization: @available, identity: jug2) | ||
|
||
visit catalog_manager_catalog_index_path | ||
wait_for_javascript_to_finish | ||
end | ||
|
||
context 'Institution' do | ||
before :each do | ||
fill_in 'organization-query', with: @institution.name | ||
page.execute_script %Q{ $('organization-query').trigger("keydown") } | ||
wait_for_javascript_to_finish | ||
|
||
find('.tt-suggestion').click | ||
wait_for_javascript_to_finish | ||
end | ||
|
||
it 'should show the institution form' do | ||
expect(page).to have_selector("h3", text: @institution.name) | ||
end | ||
end | ||
|
||
context 'Provider' do | ||
before :each do | ||
fill_in 'organization-query', with: @provider.name | ||
page.execute_script %Q{ $('organization-query').trigger("keydown") } | ||
wait_for_javascript_to_finish | ||
|
||
find('.tt-suggestion').click | ||
wait_for_javascript_to_finish | ||
end | ||
|
||
it 'should show the provider form' do | ||
expect(page).to have_selector("h3", text: @provider.name) | ||
end | ||
end | ||
|
||
context 'Program' do | ||
before :each do | ||
fill_in 'organization-query', with: @program.name | ||
page.execute_script %Q{ $('organization-query').trigger("keydown") } | ||
wait_for_javascript_to_finish | ||
|
||
find('.tt-suggestion').click | ||
wait_for_javascript_to_finish | ||
end | ||
|
||
it 'should show the program form' do | ||
expect(page).to have_selector("h3", text: @program.name) | ||
end | ||
end | ||
|
||
context 'Core' do | ||
before :each do | ||
fill_in 'organization-query', with: @core.name | ||
page.execute_script %Q{ $('organization-query').trigger("keydown") } | ||
wait_for_javascript_to_finish | ||
|
||
find('.tt-suggestion').click | ||
wait_for_javascript_to_finish | ||
end | ||
|
||
it 'should show the core form' do | ||
expect(page).to have_selector("h3", text: @core.name) | ||
end | ||
end | ||
|
||
context 'Service' do | ||
before :each do | ||
fill_in 'organization-query', with: @service.name | ||
page.execute_script %Q{ $('organization-query').trigger("keydown") } | ||
wait_for_javascript_to_finish | ||
|
||
find('.tt-suggestion').click | ||
wait_for_javascript_to_finish | ||
end | ||
|
||
it 'should show the service form' do | ||
expect(page).to have_selector("h3", text: @service.name) | ||
end | ||
end | ||
end |
52 changes: 52 additions & 0 deletions
52
spec/features/catalog_manager/accordion/user_toggles_show_available_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright © 2011-2018 MUSC Foundation for Research Development | ||
# All rights reserved. | ||
|
||
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following | ||
# disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products | ||
# derived from this software without specific prior written permission. | ||
|
||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | ||
# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT | ||
# SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe 'User toggles the "Show Available" button', js: true do | ||
let_there_be_lane | ||
fake_login_for_each_test | ||
|
||
before :each do | ||
@available = create(:institution) | ||
@unavailable = create(:institution, is_available: false) | ||
create(:catalog_manager, organization: @available, identity: jug2) | ||
|
||
visit catalog_manager_catalog_index_path | ||
wait_for_javascript_to_finish | ||
end | ||
|
||
it 'should show organizations and services corresponding to the button' do | ||
expect(page).to have_content(@available.name) | ||
expect(page).to_not have_content(@unavailable.name) | ||
|
||
find('.toggle-on').click | ||
wait_for_javascript_to_finish | ||
|
||
expect(page).to have_content(@available.name) | ||
expect(page).to have_content(@unavailable.name) | ||
|
||
find('.toggle-off').click | ||
wait_for_javascript_to_finish | ||
|
||
expect(page).to have_content(@available.name) | ||
expect(page).to_not have_content(@unavailable.name) | ||
end | ||
end |
88 changes: 88 additions & 0 deletions
88
spec/features/catalog_manager/accordion/user_views_organization_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Copyright © 2011-2018 MUSC Foundation for Research Development | ||
# All rights reserved. | ||
|
||
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following | ||
# disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products | ||
# derived from this software without specific prior written permission. | ||
|
||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, | ||
# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT | ||
# SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
require 'rails_helper' | ||
|
||
RSpec.describe 'User views an organization', js: true do | ||
let_there_be_lane | ||
fake_login_for_each_test | ||
|
||
before :each do | ||
@institution = create(:institution) | ||
@provider = create(:provider, parent: @institution) | ||
@program = create(:program, parent: @provider) | ||
@core = create(:core, parent: @program) | ||
create(:catalog_manager, organization: @institution, identity: jug2) | ||
|
||
visit catalog_manager_catalog_index_path | ||
wait_for_javascript_to_finish | ||
end | ||
|
||
context 'Institution' do | ||
before :each do | ||
click_link @institution.name | ||
wait_for_javascript_to_finish | ||
end | ||
|
||
it 'should show the institution form' do | ||
expect(page).to have_selector("h3", text: @institution.name) | ||
end | ||
end | ||
|
||
context 'Provider' do | ||
before :each do | ||
find("#institution-#{@institution.id} .glyphicon").click | ||
click_link @provider.name | ||
wait_for_javascript_to_finish | ||
end | ||
|
||
it 'should show the provider form' do | ||
expect(page).to have_selector("h3", text: @provider.name) | ||
end | ||
end | ||
|
||
context 'Program' do | ||
before :each do | ||
find("#institution-#{@institution.id} .glyphicon").click | ||
find("#provider-#{@provider.id} .glyphicon").click | ||
click_link @program.name | ||
wait_for_javascript_to_finish | ||
end | ||
|
||
it 'should show the program form' do | ||
expect(page).to have_selector("h3", text: @program.name) | ||
end | ||
end | ||
|
||
context 'Core' do | ||
before :each do | ||
find("#institution-#{@institution.id} .glyphicon").click | ||
find("#provider-#{@provider.id} .glyphicon").click | ||
find("#program-#{@program.id} .glyphicon").click | ||
wait_for_javascript_to_finish | ||
click_link @core.name | ||
wait_for_javascript_to_finish | ||
end | ||
|
||
it 'should show the core form' do | ||
expect(page).to have_selector("h3", text: @core.name) | ||
end | ||
end | ||
end |
Oops, something went wrong.