Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Capybara infra to match Caseflow #1150

Merged
merged 29 commits into from
Dec 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f4a26c6
sync spec infra with caseflow
pkarman Dec 12, 2019
c065c4d
sniffybara fixes
pkarman Dec 12, 2019
a5f3149
capybara config for new version
pkarman Dec 12, 2019
94f2816
sniffybara says iframe needs title
pkarman Dec 12, 2019
c238aef
both browsers
pkarman Dec 12, 2019
6a5b7da
disable TZ for now (some tests are not aware)
pkarman Dec 12, 2019
279c19e
update redis client
pkarman Dec 12, 2019
d7c299f
clear old semaphores (as in failed tests)
pkarman Dec 12, 2019
f03d0a8
Revert "update redis client"
pkarman Dec 12, 2019
a27b4d7
fix cast
pkarman Dec 12, 2019
9042f76
remove old sniffybara config
pkarman Dec 12, 2019
07e8e89
more make fun
pkarman Dec 12, 2019
3a3cf5e
mkdir tmp
pkarman Dec 12, 2019
11749b4
simplify downloads tmp dir
pkarman Dec 13, 2019
26c7200
rewrite download helper to avoid use of Timeout
pkarman Dec 16, 2019
9ff18fe
try headed browser at CI
pkarman Dec 16, 2019
c500703
download debug
pkarman Dec 16, 2019
7ea7ba1
store CI artifacts for debugging
pkarman Dec 16, 2019
f42208b
quiet warning
pkarman Dec 16, 2019
229b7c1
store test summary
pkarman Dec 16, 2019
cb4e095
more nudges to get CI downloads working
pkarman Dec 16, 2019
e08036d
ENSURE_STABLE from caseflow
pkarman Dec 16, 2019
94bab44
skip download tests unless rspec --tag download
pkarman Dec 16, 2019
c949fe5
add one more download test
pkarman Dec 16, 2019
588cf86
localstack for circlci
pkarman Dec 16, 2019
3819a75
turn on sqs
pkarman Dec 16, 2019
4411c25
skip another download (probably perform_enqueued_jobs is culprit)
pkarman Dec 16, 2019
2207021
we have coverage but not at CI
pkarman Dec 16, 2019
e81f277
Merge branch 'master' into pek-headless-tests
pkarman Dec 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ jobs:

# This is the circleci provided Redis container.
- image: circleci/redis:4.0.10

# localstack image
- image: localstack/localstack:latest
environment:
- SERVICES=sqs

parallelism: 1
resource_class: large
steps:
Expand Down Expand Up @@ -73,6 +79,18 @@ jobs:
command: |
~/project/ci-bin/capture-log "make -f Makefile.example test"

- store_test_results:
name: Store test results as summary
path: ~/test-results

- store_artifacts:
name: Store test results as artifact
path: ~/test-results

- store_artifacts:
name: Store capybara screenshots
path: ~/project/tmp/capybara

- run:
name: Lint
command: |
Expand Down
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,16 @@ group :development, :test do
end

group :test do
gem "capybara", "2.6.2"
gem "capybara"
gem "capybara-screenshot"
gem "database_cleaner"
gem "launchy"
gem "rspec"
gem "rspec-rails"
gem "simplecov"
gem "sniffybara", git: "https://github.com/department-of-veterans-affairs/sniffybara.git"
gem "timecop"
gem "webdrivers"
gem "webmock"
end

Expand Down
56 changes: 33 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ GIT

GIT
remote: https://github.com/department-of-veterans-affairs/sniffybara.git
revision: d5f94213dcef08756f8d1622355015739e96ff4f
revision: 351560b5789ca638ba7c9b093c2bb1a9a6fda4b3
specs:
sniffybara (0.0.1)
sniffybara (1.1.0)
rainbow
selenium-webdriver

Expand Down Expand Up @@ -115,8 +115,8 @@ GEM
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
akami (1.3.1)
gyoku (>= 0.4.0)
nokogiri
Expand Down Expand Up @@ -150,17 +150,20 @@ GEM
bundler (~> 1.2)
thor (~> 0.18)
byebug (10.0.0)
capybara (2.6.2)
capybara (3.29.0)
addressable
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.5)
xpath (~> 3.2)
capybara-screenshot (1.0.23)
capybara (>= 1.0, < 4)
launchy
case_transform (0.2)
activesupport
childprocess (0.9.0)
ffi (~> 1.0, >= 1.0.11)
childprocess (3.0.0)
coderay (1.1.2)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
Expand Down Expand Up @@ -193,7 +196,7 @@ GEM
faraday (0.14.0)
multipart-post (>= 1.2, < 3)
fastercsv (1.5.5)
ffi (1.9.25)
ffi (1.11.3)
globalid (0.4.2)
activesupport (>= 4.2.0)
gyoku (1.3.1)
Expand Down Expand Up @@ -235,9 +238,9 @@ GEM
makara (0.4.1)
activerecord (>= 3.0.0)
method_source (0.9.2)
mime-types (3.1)
mime-types (3.3)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mime-types-data (3.2019.1009)
mini_magick (4.9.4)
mini_mime (1.0.1)
mini_portile2 (2.4.0)
Expand All @@ -251,7 +254,7 @@ GEM
thor (~> 0.19)
newrelic_rpm (4.8.0.341)
nio4r (2.3.1)
nokogiri (1.10.5)
nokogiri (1.10.7)
mini_portile2 (~> 2.4.0)
nori (2.6.0)
omniauth (1.9.0)
Expand All @@ -271,7 +274,7 @@ GEM
byebug (~> 10.0)
pry (~> 0.10)
psych (3.1.0)
public_suffix (3.0.2)
public_suffix (4.0.1)
puma (3.12.2)
rack (2.0.7)
rack-cors (1.1.0)
Expand Down Expand Up @@ -331,6 +334,7 @@ GEM
redis-store (1.4.1)
redis (>= 2.2, < 5)
ref (2.0.0)
regexp_parser (1.6.0)
request_store (1.4.0)
rack (>= 1.4)
rspec (3.7.0)
Expand Down Expand Up @@ -398,9 +402,9 @@ GEM
sdoc (0.4.2)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
selenium-webdriver (3.11.0)
childprocess (~> 0.5)
rubyzip (~> 1.2)
selenium-webdriver (3.142.6)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
sentry-raven (2.7.2)
faraday (>= 0.7.6, < 1.0)
sexp_processor (4.10.1)
Expand Down Expand Up @@ -448,6 +452,10 @@ GEM
wasabi (3.5.0)
httpi (~> 2.0)
nokogiri (>= 1.4.2)
webdrivers (4.1.2)
nokogiri (~> 1.6)
rubyzip (~> 1.0)
selenium-webdriver (>= 3.0, < 4.0)
webmock (3.6.2)
addressable (>= 2.3.6)
crack (>= 0.3.2)
Expand All @@ -464,8 +472,8 @@ GEM
xmlmapper (>= 0.7.3)
xmlmapper (0.7.3)
nokogiri (~> 1.5)
xpath (2.1.0)
nokogiri (~> 1.3)
xpath (3.2.0)
nokogiri (~> 1.8)
zaru (0.2.0)
zero_downtime_migrations (0.0.7)
activerecord
Expand All @@ -482,7 +490,8 @@ DEPENDENCIES
brakeman (= 3.1.5)
bundler-audit
byebug
capybara (= 2.6.2)
capybara
capybara-screenshot
caseflow!
coffee-rails (> 4.1.0)
connect_vbms!
Expand Down Expand Up @@ -533,6 +542,7 @@ DEPENDENCIES
uglifier (>= 1.3.0)
uswds-rails!
wannabe_bool
webdrivers
webmock
zaru
zero_downtime_migrations
Expand Down
2 changes: 1 addition & 1 deletion Makefile.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ run: up ## Start Rails
foreman start

test: clean ## Run the rspec suite
bundle exec rspec
CI=true bundle exec rspec

clean: ## Remove old files
rm -f log/test.log
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/downloads_controller.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class DownloadsController < ApplicationController
# :nocov:
before_action :authorize

rescue_from ActiveRecord::RecordNotFound, with: :record_not_found
Expand Down Expand Up @@ -152,4 +153,5 @@ def current_document_status
{ "progress": 0, "completed": 1, "errored": 2 }[current_tab.to_sym]
end
helper_method :current_document_status
# :nocov:
end
2 changes: 1 addition & 1 deletion app/models/fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def content(save_document_metadata: true)
private

def cached_content
@cached_content ||= MetricsService.record("S3: fetch content for: #{document.s3_filename}",
@cached_content ||= MetricsService.record("S3: Fetcher fetch content for: #{document.s3_filename}",
service: :s3,
name: "fetch_content") do
S3Service.fetch_content(document.s3_filename)
Expand Down
3 changes: 2 additions & 1 deletion app/services/record_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class RecordFetcher
def process
s = Redis::Semaphore.new("record_#{record.id}".to_s,
url: Rails.application.secrets.redis_url_cache,
stale_client_timeout: 5,
expiration: SECONDS_TO_AUTO_UNLOCK)
s.lock(SECONDS_TO_AUTO_UNLOCK)
content_from_s3 || content_from_vbms
Expand All @@ -28,7 +29,7 @@ def content_from_vbms
end

def content_from_s3
@content_from_s3 ||= MetricsService.record("S3: fetch content for: #{record.s3_filename}",
@content_from_s3 ||= MetricsService.record("S3: RecordFetcher fetch content for: #{record.s3_filename}",
service: :s3,
name: "content_from_s3") do
S3Service.fetch_content(record.s3_filename)
Expand Down
2 changes: 1 addition & 1 deletion app/views/gui/single_page_app.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<html>
<html lang="en">
<head>
<title>eFolder Express</title>
<meta http-equiv='X-UA-Compatible' content='IE=edge' />
Expand Down
12 changes: 6 additions & 6 deletions app/views/help/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@

<div class ="usa-grid-full">
<div class ="usa-width-one-third">
<iframe width="270" height="178.567" src="//www.youtube.com/embed/Tg13RotOJCg" frameborder="0" allowfullscreen></iframe>
<iframe title="Access and Login" width="270" height="178.567" src="//www.youtube.com/embed/Tg13RotOJCg" frameborder="0" allowfullscreen></iframe>
<b>Access and Login</b></br>
<small>Duration: 1:52</small>
<p>Learn how to gain access and login to eFolder Express</p>
</div>

<div class ="usa-width-one-third">
<iframe width="270" height="178.567" src="https://www.youtube.com/embed/rXhfMk1Edc4" frameborder="0" allowfullscreen></iframe>
<iframe title="Navigating the Interface" width="270" height="178.567" src="https://www.youtube.com/embed/rXhfMk1Edc4" frameborder="0" allowfullscreen></iframe>
<b>Navigating the Interface</b></br>
<small>Duration: 1:59</small>
<p>Learn how to use eFolder Express and improve your workflow.</p>
</div>

<div class ="usa-width-one-third">
<iframe width="270" height="178.567" src="https://www.youtube.com/embed/zi35PN98hoE" frameborder="0" allowfullscreen></iframe>
<iframe title="Find an eFolder" width="270" height="178.567" src="https://www.youtube.com/embed/zi35PN98hoE" frameborder="0" allowfullscreen></iframe>
<b>Find an eFolder</b></br>
<small>Duration: 1:03</small>
<p>Learn how to search for the full contents of a veteran's eFolder</p>
Expand All @@ -34,21 +34,21 @@

<div class ="usa-grid-full">
<div class="usa-width-one-third">
<iframe width="270" height="178.567" src="https://www.youtube.com/embed/E6zAkrqoqX0" frameborder="0" allowfullscreen></iframe>
<iframe title="Downloading the eFolder" width="270" height="178.567" src="https://www.youtube.com/embed/E6zAkrqoqX0" frameborder="0" allowfullscreen></iframe>
<b>Downloading the eFolder</b></br>
<small>Duration: 2:16</small>
<p>Learn how to download the files contained in a Veteran's eFolder.</p>
</div>

<div class="usa-width-one-third">
<iframe width="270" height="178.567" src="https://www.youtube.com/embed/e4X8RT6MF6w" frameborder="0" allowfullscreen></iframe>
<iframe title="Managing Multiple Downloads" width="270" height="178.567" src="https://www.youtube.com/embed/e4X8RT6MF6w" frameborder="0" allowfullscreen></iframe>
<b>Managing Multiple Downloads</b></br>
<small>Duration: 0:59</small>
<p>Learn how to improve your workflow by downloading and managing multiple Veteran's eFolder at once.</p>
</div>

<div class="usa-width-one-third">
<iframe width="270" height="178.567" src="https://www.youtube.com/embed/R87KEbcwK08" frameborder="0" allowfullscreen></iframe>
<iframe title="Providing Feedback" width="270" height="178.567" src="https://www.youtube.com/embed/R87KEbcwK08" frameborder="0" allowfullscreen></iframe>
<b>Providing Feedback</b></br>
<small>Duration: 1:36</small>
<p>Learn how to give feedback and seek help directly from the Digital Service support team.</p>
Expand Down
21 changes: 20 additions & 1 deletion lib/fakes/test_auth_strategy.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,29 @@
require "omniauth/strategies/developer"
require "omniauth/form"

class EfolderAuthForm < OmniAuth::Form
def header(title, header_info)
@html << <<-HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>#{title}</title>
#{css}
#{header_info}
</head>
<body>
<h1>#{title}</h1>
<form method='post' #{"action='#{options[:url]}' " if options[:url]}noValidate='noValidate'>
HTML
self
end
end

class OmniAuth::Strategies::TestAuthStrategy < OmniAuth::Strategies::Developer
# custom form rendering
def request_phase
form = OmniAuth::Form.new(title: "Test VA Saml", url: callback_path)
form = EfolderAuthForm.new(title: "Test VA Saml", url: callback_path)
options.fields.each do |field|
form.text_field field.to_s.capitalize.tr("_", " "), field.to_s
end
Expand Down
16 changes: 0 additions & 16 deletions lib/tasks/spec_browsers.rake

This file was deleted.

4 changes: 2 additions & 2 deletions spec/features/download_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def assert_coachmark_does_not_exist
end

scenario "Download with no documents" do
download = @user_download.create(status: :no_documents)
download = @user_download.create(file_number: "666000", status: :no_documents)
visit download_path(download)

expect(page).to have_css ".cf-app-msg-screen", text: "No Documents in eFolder"
Expand Down Expand Up @@ -465,7 +465,7 @@ def assert_coachmark_does_not_exist
expect(page).to have_content("Something went wrong...")
end

scenario "Completed download" do
scenario "Completed download", download: true do
veteran_info = {
"12" => {
"veteran_first_name" => "Stan",
Expand Down
Loading