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

Cucumber scenario for question explanation feature #50

Merged
merged 10 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion rails_root/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ gem 'jbuilder'
# gem "bcrypt", "~> 3.1.7"

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data'#, platforms: %i[windows jruby]
gem 'tzinfo-data' # , platforms: %i[windows jruby]

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', require: false
Expand All @@ -51,6 +51,7 @@ group :development, :test do
gem 'rspec-rails'
gem 'rubocop'
gem 'rubocop-rails'
gem 'rubycritic', require: false
gem 'selenium-webdriver'
gem 'simplecov', require: false
gem 'sqlite3', '~> 1.4'
Expand Down
78 changes: 78 additions & 0 deletions rails_root/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ GEM
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
base64 (0.2.0)
bigdecimal (3.1.6)
bindex (0.8.1)
Expand All @@ -93,6 +97,9 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
childprocess (5.0.0)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
crass (1.0.6)
Expand Down Expand Up @@ -135,16 +142,55 @@ GEM
debug (1.9.1)
irb (~> 1.10)
reline (>= 0.3.8)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
diff-lcs (1.5.1)
docile (1.4.0)
drb (2.2.1)
dry-configurable (1.1.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-core (1.0.1)
concurrent-ruby (~> 1.0)
zeitwerk (~> 2.6)
dry-inflector (1.0.0)
dry-initializer (3.1.1)
dry-logic (1.5.0)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-schema (1.13.3)
concurrent-ruby (~> 1.0)
dry-configurable (~> 1.0, >= 1.0.1)
dry-core (~> 1.0, < 2)
dry-initializer (~> 3.0)
dry-logic (>= 1.4, < 2)
dry-types (>= 1.7, < 2)
zeitwerk (~> 2.6)
dry-types (1.7.2)
bigdecimal (~> 3.0)
concurrent-ruby (~> 1.0)
dry-core (~> 1.0)
dry-inflector (~> 1.0)
dry-logic (~> 1.4)
zeitwerk (~> 2.6)
erubi (1.12.0)
ffi (1.16.3)
flay (2.13.2)
erubi (~> 1.10)
path_expander (~> 1.0)
ruby_parser (~> 3.0)
sexp_processor (~> 4.0)
flog (4.8.0)
path_expander (~> 1.0)
ruby_parser (~> 3.1, > 3.1.0)
sexp_processor (~> 4.8)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.3)
concurrent-ruby (~> 1.0)
racc (~> 1.7)
ice_nine (0.11.2)
importmap-rails (2.0.1)
actionpack (>= 6.0.0)
activesupport (>= 6.0.0)
Expand All @@ -158,6 +204,9 @@ GEM
activesupport (>= 5.0.0)
json (2.7.1)
language_server-protocol (3.17.0.3)
launchy (3.0.0)
addressable (~> 2.8)
childprocess (~> 5.0)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand Down Expand Up @@ -190,6 +239,7 @@ GEM
parser (3.3.0.5)
ast (~> 2.4.1)
racc
path_expander (1.1.1)
pg (1.5.6)
prettier_print (1.2.1)
prism (0.24.0)
Expand Down Expand Up @@ -243,6 +293,11 @@ GEM
sorbet-runtime (>= 0.5.9204)
rdoc (6.6.2)
psych (>= 4.0.0)
reek (6.3.0)
dry-schema (~> 1.13.0)
parser (~> 3.3.0)
rainbow (>= 2.0, < 4.0)
rexml (~> 3.1)
regexp_parser (2.9.0)
reline (0.4.3)
io-console (~> 0.5)
Expand Down Expand Up @@ -283,12 +338,28 @@ GEM
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (1.13.0)
ruby_parser (3.21.0)
racc (~> 1.5)
sexp_processor (~> 4.16)
rubycritic (4.9.0)
flay (~> 2.13)
flog (~> 4.7)
launchy (>= 2.5.2)
parser (>= 3.2.2.1)
rainbow (~> 3.1.1)
reek (~> 6.0, < 7.0)
rexml
ruby_parser (~> 3.20)
simplecov (>= 0.22.0)
tty-which (~> 0.5.0)
virtus (~> 2.0)
rubyzip (2.3.2)
selenium-webdriver (4.18.1)
base64 (~> 0.2)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
sexp_processor (4.17.1)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand Down Expand Up @@ -332,7 +403,9 @@ GEM
thor (>= 1.2.0)
yard-sorbet
thor (1.3.1)
thread_safe (0.3.6)
timeout (0.4.1)
tty-which (0.5.0)
turbo-rails (2.0.4)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
Expand All @@ -342,6 +415,10 @@ GEM
tzinfo-data (1.2024.1)
tzinfo (>= 1.0.0)
unicode-display_width (2.5.0)
virtus (2.0.0)
axiom-types (~> 0.1)
coercible (~> 1.0)
descendants_tracker (~> 0.0, >= 0.0.3)
web-console (4.2.1)
actionview (>= 6.0.0)
activemodel (>= 6.0.0)
Expand Down Expand Up @@ -377,6 +454,7 @@ DEPENDENCIES
rspec-rails
rubocop
rubocop-rails
rubycritic
selenium-webdriver
simplecov
sorbet
Expand Down
28 changes: 20 additions & 8 deletions rails_root/features/initial_ui_design.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
Feature: Initial UI Design
Verify ui design

Background: Questions and responses exist
Given the following questions exist:
| text | explanation | section |
| Are you ok? | No I am not | 0 |
| question 2 | explanation 2 | 1 |
| question 3 | explanation 3 | 2 |
| question 4 | explanation 4 | 3 |
| question 5 | I am fine | 4 |

Given the survey profiles exist:
|user_id| first_name| last_name| campus_name| district_name|
| 1 | John |Doe|Campus 1|District 1|
| 2 | Jane |Doe|Campus 2|District 2|


Scenario: Verify survey profile page
Given I am on the site
When I visit survey profile page
Expand All @@ -12,15 +27,12 @@ Feature: Initial UI Design
Then I can see survey sections

Scenario: Verify survey qustions
Given the following questions exist:
| text | explanation | section |
| Are you ok? | explanation 1 | 0 |
| question 2 | explanation 2 | 1 |
| question 3 | explanation 3 | 2 |
| question 4 | explanation 4 | 3 |
| question 5 | I am fine | 4 |
When I visit survey form page
Then I can see "Are you ok?"


Scenario: Verify explanation on survey_responses page
Given user 1 responses to question "Are you ok?"
When I am on the survey responses page of user 1
Then I can see "Are you ok?"
And I can see "No I am not"

23 changes: 21 additions & 2 deletions rails_root/features/step_definitions/initial_ui_design_steps.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# frozen_string_literal: true
# frozen_string_literal: true

Given(/the following questions exist/) do |survey_questions_table|
survey_questions_table.hashes.each do |question|
Expand All @@ -20,11 +19,31 @@
end

Then('I can see survey sections') do
['Part 1','Part 2','Part 3','Part 4'].each do |string|
['Part 1', 'Part 2', 'Part 3', 'Part 4'].each do |string|
expect(page).to have_content(string)
end
end

Then('I can see {string}') do |string|
expect(page).to have_content(string)
end

Given('the survey profiles exist:') do |table|
table.hashes.each do |profile|
SurveyProfile.create profile
end
end

Given('user {int} responses to question {string}') do |int, string|
question = SurveyQuestion.find_by(text: string)
profile = SurveyProfile.find_by(user_id: int)
response = SurveyResponse.find_or_create_by!(profile:, share_code: "debug#{profile.user_id}")
SurveyAnswer.create!(choice: 0, question:, response:)
end

When('I am on the survey responses page of user {int}') do |int|
profile = SurveyProfile.find_by(user_id: int)
response = SurveyResponse.find_or_create_by!(profile:, share_code: "debug#{profile.user_id}")
puts survey_response_path(response)
visit survey_response_path(response)
end
Loading