Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves HELIO-2264: Integration test on heliotrope-testing
- Loading branch information
1 parent
1816df1
commit f14f090
Showing
15 changed files
with
177 additions
and
127 deletions.
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
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
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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'capybara/rspec' | ||
|
||
Capybara.register_driver :selenium do |app| | ||
Capybara::Selenium::Driver.new(app, browser: :chrome) | ||
end | ||
|
||
Capybara.configure do |config| | ||
config.default_max_wait_time = 10 | ||
config.default_driver = :selenium | ||
end | ||
|
||
RSpec.configure do |config| | ||
config.include Capybara::DSL | ||
end | ||
|
||
module CapybaraSpecHelper | ||
end |
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,21 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'testing_helper' | ||
|
||
RSpec.describe "Presses Index", type: :capybara do | ||
before do | ||
Capybara.run_server = false | ||
Capybara.default_max_wait_time = 15 | ||
Capybara.server_host = 'web' | ||
Capybara.app_host = Testing::Target.url | ||
end | ||
|
||
it "index" do | ||
visit "presses" | ||
click_link "Testing Press" | ||
expect(page).to have_content("Testing Press dedicated to automated systems tests.") | ||
click_link "Log In" | ||
expect(page).to have_content("Enter your Login ID and Password") | ||
# Huston we have a problem ... Shibboleth. | ||
end | ||
end |
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,11 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'testing_helper' | ||
|
||
RSpec.describe 'Testing Press Cleaner' do | ||
before { Testing::Target.testing_press_cleaner } | ||
|
||
it 'Press Cleaner is working' do | ||
expect(Testing::Target.testing_press_monographs).to be_empty | ||
end | ||
end |
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,10 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
require_relative '../testing' | ||
require_relative './support/capybara_spec_helper' | ||
|
||
RSpec.configure do |config| | ||
config.include CapybaraSpecHelper, type: :capybara | ||
end |
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,41 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'testing/source' | ||
require_relative 'testing/target' | ||
|
||
require 'yaml' | ||
|
||
module Testing | ||
def self.config | ||
@config ||= Config.load_from_yaml | ||
end | ||
# private_class_method :config | ||
|
||
class Config | ||
def self.load_from_yaml | ||
filename = 'testing.yml' | ||
yaml = YAML.safe_load(File.read(filename)) if File.exist?(filename) | ||
return new({}) unless yaml | ||
new yaml.fetch('testing') | ||
end | ||
|
||
REQUIRED_KEYS = %w[source_url source_token target_url target_token].freeze | ||
|
||
def initialize(config) | ||
@config = config | ||
end | ||
|
||
def valid? | ||
config_keys = @config.keys | ||
REQUIRED_KEYS.all? { |required| config_keys.include?(required) } | ||
end | ||
|
||
REQUIRED_KEYS.each do |key| | ||
class_eval <<-DEFINE, __FILE__, __LINE__ + 1 | ||
def #{key} | ||
@config.fetch('#{key}') | ||
end | ||
DEFINE | ||
end | ||
end | ||
end |
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,5 @@ | ||
testing: | ||
source_url: 'https://www.fulcrum.org/' | ||
source_token: '' | ||
target_url: 'https://heliotrope-testing.hydra.lib.umich.edu/' | ||
target_token: '' |
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,19 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative '../../app/services/turnsole/service' | ||
|
||
module Testing | ||
module Source | ||
class << self | ||
def url | ||
Testing.config.source_url | ||
end | ||
|
||
private | ||
|
||
def turnsole | ||
@turnsole ||= Turnsole::Service.new(Testing.config.source_token, Testing.config.source_url + 'api/') | ||
end | ||
end | ||
end | ||
end |
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,31 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative '../../app/services/turnsole/service' | ||
|
||
module Testing | ||
module Target | ||
class << self | ||
def url | ||
Testing.config.target_url | ||
end | ||
|
||
def testing_press_cleaner | ||
monographs = testing_press_monographs | ||
monographs.each do |monograph| | ||
turnsole.delete_monograph(monograph['id']) | ||
end | ||
end | ||
|
||
def testing_press_monographs | ||
testing_press_id = turnsole.find_press('testing') | ||
turnsole.press_monographs(testing_press_id) | ||
end | ||
|
||
private | ||
|
||
def turnsole | ||
@turnsole ||= Turnsole::Service.new(Testing.config.target_token, Testing.config.target_url + 'api/') | ||
end | ||
end | ||
end | ||
end |