Skip to content

Commit 79fbe84

Browse files
authored
Merge pull request #940 from EFForg/system-test-edits
System tests user signin improvements
2 parents c456378 + 880fd65 commit 79fbe84

16 files changed

+68
-155
lines changed

spec/features/congress_message.rb

Lines changed: 0 additions & 79 deletions
This file was deleted.

spec/rails_helper.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,18 @@
4646
Capybara.disable_animation = true
4747

4848
RSpec.configure do |config|
49+
config.include ServiceHelpers
50+
4951
config.include Devise::Test::ControllerHelpers, type: :controller
50-
config.include Devise::Test::IntegrationHelpers, type: :system
52+
5153
config.include Devise::Test::IntegrationHelpers, type: :request
5254
config.include Warden::Test::Helpers, type: :request
55+
56+
config.include Devise::Test::IntegrationHelpers, type: :system
5357
config.include Warden::Test::Helpers, type: :system
5458

59+
config.include JavascriptHelpers, type: :system, js: true
60+
5561
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
5662
config.fixture_path = Rails.root.join("spec/fixtures")
5763

@@ -84,10 +90,12 @@
8490
end
8591

8692
config.before(:each, type: :system) do
93+
stub_civicrm
8794
driven_by :rack_test
8895
end
8996

9097
config.before(:each, type: :system, js: true) do
98+
stub_civicrm
9199
driven_by :selenium_chrome_headless
92100
end
93101

spec/spec_helper.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
end
3434

3535
config.include Capybara::DSL
36-
config.include FeatureHelpers, type: :system
3736

3837
WebMock.disable_net_connect!(allow_localhost: true, allow: "chromedriver.storage.googleapis.com")
3938
end

spec/support/feature_helpers.rb

Lines changed: 0 additions & 36 deletions
This file was deleted.

spec/support/javascript_helpers.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module JavascriptHelpers
2+
def warden_sign_in(user)
3+
# this calls a helper from Warden::Test::Helpers
4+
login_as(user, scope: :user)
5+
end
6+
7+
def fill_in_editor(locator, with:)
8+
within_frame find(locator, visible: :all).sibling("div").find("iframe") do
9+
within_frame find("#epiceditor-editor-frame") do
10+
find("body").set(with)
11+
end
12+
end
13+
end
14+
15+
def fill_in_select2(locator, with:)
16+
find(locator).sibling(".select2-container").click
17+
find("li.select2-results__option[role=treeitem]", text: with).click
18+
end
19+
end

spec/support/service_helpers.rb

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,3 @@ def stub_civicrm
99
.and_return(status: 200, body: { checksum: "xyz" }.to_json, headers: {})
1010
end
1111
end
12-
13-
RSpec.configure do |c|
14-
c.include ServiceHelpers
15-
end
16-
17-
World(ServiceHelpers) if respond_to?(:World) # cucumber
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)