diff --git a/Gemfile b/Gemfile index c7642637b80..4c36384d86c 100644 --- a/Gemfile +++ b/Gemfile @@ -227,6 +227,7 @@ group :test do # Mock selenium requests through proxy (for feature tests) gem 'puffing-billy', '~> 2.3.1' + gem 'table_print', '~> 1.5.6' gem 'equivalent-xml', '~> 0.6' gem 'json_spec', '~> 1.1.4' diff --git a/Gemfile.lock b/Gemfile.lock index 9c2b056632e..4a805d3949c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -906,6 +906,7 @@ GEM httpclient (>= 2.4) sys-filesystem (1.3.3) ffi + table_print (1.5.6) temple (0.8.2) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) @@ -1122,6 +1123,7 @@ DEPENDENCIES stringex (~> 2.8.5) svg-graph (~> 2.1.0) sys-filesystem (~> 1.3.3) + table_print (~> 1.5.6) test-prof (~> 0.11.0) thin (~> 1.7.2) timecop (~> 0.9.0) diff --git a/frontend/src/app/components/enterprise/enterprise-trial-waiting/ee-trial-waiting.component.ts b/frontend/src/app/components/enterprise/enterprise-trial-waiting/ee-trial-waiting.component.ts index 92f1f754bc2..7ef6186ac15 100644 --- a/frontend/src/app/components/enterprise/enterprise-trial-waiting/ee-trial-waiting.component.ts +++ b/frontend/src/app/components/enterprise/enterprise-trial-waiting/ee-trial-waiting.component.ts @@ -29,7 +29,7 @@ import {Component, ElementRef} from "@angular/core"; import {I18nService} from "app/modules/common/i18n/i18n.service"; import {EnterpriseTrialService} from "app/components/enterprise/enterprise-trial.service"; -import {HttpClient, HttpErrorResponse} from "@angular/common/http"; +import {HttpClient} from "@angular/common/http"; import {NotificationsService} from "core-app/modules/common/notifications/notifications.service"; diff --git a/spec/features/admin/enterprise/enterprise_trial_spec.rb b/spec/features/admin/enterprise/enterprise_trial_spec.rb index 733be00d98d..83e23503f84 100644 --- a/spec/features/admin/enterprise/enterprise_trial_spec.rb +++ b/spec/features/admin/enterprise/enterprise_trial_spec.rb @@ -30,7 +30,6 @@ require 'spec_helper' describe 'Enterprise trial management', type: :feature, - skip: true, driver: :headless_firefox_billy do let(:admin) { FactoryBot.create(:admin) } @@ -176,6 +175,9 @@ describe 'Enterprise trial management', proxy.stub("https://augur.openproject-edge.com:443/public/v1/trials/#{trial_id}") .and_return(headers: {'Access-Control-Allow-Origin' => '*'}, code: 422, body: waiting_body.to_json) + proxy.stub("https://augur.openproject-edge.com:443/public/v1/trials/#{trial_id}/resend", method: 'post') + .and_return(headers: {'Access-Control-Allow-Origin' => '*'}, code: 200, body: waiting_body.to_json) + find('.button', text: 'Start free trial').click fill_out_modal find('.button:not(:disabled)', text: 'Submit').click @@ -209,13 +211,8 @@ describe 'Enterprise trial management', end it 'can confirm that trial regularly' do - # Stub resend method - proxy.stub("https://augur.openproject-edge.com:443/public/v1/trials/#{trial_id}/resend") - .and_return(headers: {'Access-Control-Allow-Origin' => '*'}, code: 200, body: waiting_body.to_json) - find('.op-modal--modal-body #resend-link', text: 'Resend').click - - expect(page).to have_text 'Email has been resent.' + expect(page).to have_selector('.notification-box.-success', text: 'Email has been resent.', wait: 20) expect(page).to have_text 'foo@foocorp.example' expect(page).to have_text 'email sent - waiting for confirmation' diff --git a/spec/support/pages/messages/show.rb b/spec/support/pages/messages/show.rb index e1718d5f07f..763ef3199ca 100644 --- a/spec/support/pages/messages/show.rb +++ b/spec/support/pages/messages/show.rb @@ -71,6 +71,9 @@ module Pages::Messages end end + sleep 1 + + scroll_to_element find('.ck-content') fill_in 'reply_subject', with: subject if subject editor = find('.ck-content') diff --git a/spec/support/puffing_billy_proxy.rb b/spec/support/puffing_billy_proxy.rb index 034fbab56c9..3fc3eb0febc 100644 --- a/spec/support/puffing_billy_proxy.rb +++ b/spec/support/puffing_billy_proxy.rb @@ -37,3 +37,28 @@ # # See https://github.com/oesmith/puffing-billy for more information require 'billy/capybara/rspec' + +require 'table_print' # Add this dependency to your gemfile + +## +# To debug stubbed and proxied connections +# uncomment this line +# +# Billy.configure do |c| +# c.record_requests = true +# end +# +# RSpec.configure do |config| +# config.prepend_after(:example, type: :feature) do +# puts "Requests received via Puffing Billy Proxy:" +# +# puts TablePrint::Printer.table_print(Billy.proxy.requests, [ +# :status, +# :handler, +# :method, +# { url: { width: 100 } }, +# :headers, +# :body +# ]) +# end +# end