From f74ac10367570b2d129a6c52178141f02b0cb6cd Mon Sep 17 00:00:00 2001 From: Tom Tuddenham Date: Mon, 22 Apr 2024 20:43:05 +0930 Subject: [PATCH] 9 update feature specs --- Gemfile.lock | 18 ++++++++-------- app/views/home/landing_page.html.erb | 2 +- app/views/layouts/landing_page.html.erb | 1 + features/onboarding/orientation.feature | 2 ++ features/onboarding/sign_up.feature | 6 ------ features/step_definitions/onboarding_steps.rb | 4 ++++ features/step_definitions/workspace_steps.rb | 21 ++++++++++++++----- .../checklists/admin_user_specific.feature | 11 +++++++++- 8 files changed, 43 insertions(+), 22 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ee672d7..15cc9a9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -196,7 +196,7 @@ GEM loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) - lookbook (2.2.2) + lookbook (2.3.0) activemodel css_parser htmlbeautifier (~> 1.3) @@ -215,7 +215,7 @@ GEM net-smtp marcel (1.0.4) matrix (0.4.2) - method_source (1.0.0) + method_source (1.1.0) mini_mime (1.1.5) minitest (5.22.3) msgpack (1.7.2) @@ -298,17 +298,17 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) - rb_sys (0.9.94) + rb_sys (0.9.97) rdoc (6.6.3.1) psych (>= 4.0.0) recaptcha (5.16.0) redcarpet (3.6.0) - redis (5.1.0) - redis-client (>= 0.17.0) - redis-client (0.22.0) + redis (5.2.0) + redis-client (>= 0.22.0) + redis-client (0.22.1) connection_pool regexp_parser (2.9.0) - reline (0.5.1) + reline (0.5.2) io-console (~> 0.5) responders (3.1.1) actionpack (>= 5.2) @@ -332,7 +332,7 @@ GEM rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.1) - rubocop (1.63.1) + rubocop (1.63.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) @@ -410,7 +410,7 @@ GEM tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) - view_component (3.12.0) + view_component (3.12.1) activesupport (>= 5.2.0, < 8.0) concurrent-ruby (~> 1.0) method_source (~> 1.0) diff --git a/app/views/home/landing_page.html.erb b/app/views/home/landing_page.html.erb index 868ae6a..4972ccb 100644 --- a/app/views/home/landing_page.html.erb +++ b/app/views/home/landing_page.html.erb @@ -33,7 +33,7 @@

Deploy to the cloud with confidence

Anim aute id magna aliqua ad ad non deserunt sunt. Qui irure qui lorem cupidatat commodo. Elit sunt amet fugiat veniam occaecat fugiat aliqua.

- Get started + <%= link_to 'Get started', new_user_registration_path, class: "rounded-md bg-indigo-500 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-400 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-400" %> <%= link_to new_user_session_path, class: 'text-sm font-semibold leading-6 text-white' do %> Already have an account? Sign in <% end %> diff --git a/app/views/layouts/landing_page.html.erb b/app/views/layouts/landing_page.html.erb index 49032f2..94b661f 100644 --- a/app/views/layouts/landing_page.html.erb +++ b/app/views/layouts/landing_page.html.erb @@ -12,6 +12,7 @@ + <%= render 'layouts/shared/flash_messages' %> <%= yield %> diff --git a/features/onboarding/orientation.feature b/features/onboarding/orientation.feature index c0e95b0..0e84493 100644 --- a/features/onboarding/orientation.feature +++ b/features/onboarding/orientation.feature @@ -9,6 +9,7 @@ When I log in for the first time And I visit my workspace page Then a checklist named "Introduction to Obsekio" will be present in my workspace +@javascript Scenario: Opening up the "Introduction to Obsekio" checklist Given I am logged in And a checklist named "Introduction to Obsekio" exists in my workspace @@ -16,6 +17,7 @@ When I open the checklist named "Introduction to Obsekio" And I click on the "Account Settings" link in the checklist Then will be redirected to the account settings page +@javascript Scenario: Checking off the "Introduction to Obsekio" checklist Given I am logged in And a checklist named "Introduction to Obsekio" exists in my workspace diff --git a/features/onboarding/sign_up.feature b/features/onboarding/sign_up.feature index 30d769d..582146a 100644 --- a/features/onboarding/sign_up.feature +++ b/features/onboarding/sign_up.feature @@ -25,9 +25,3 @@ Scenario: User signs up with invalid information And I click the sign up button Then I should see an error message And I should still be on the sign up page - - - - - - diff --git a/features/step_definitions/onboarding_steps.rb b/features/step_definitions/onboarding_steps.rb index 44029cb..4295a9b 100644 --- a/features/step_definitions/onboarding_steps.rb +++ b/features/step_definitions/onboarding_steps.rb @@ -35,6 +35,10 @@ end When('I click the link in the confirmation email') do + Timeout.timeout(10) do + sleep(1) until ActionMailer::Base.deliveries.present? + end + deliveries = ActionMailer::Base.deliveries confirmation_instructions = deliveries.detect { |mail| mail['subject'].value == 'Confirmation instructions' } expect(confirmation_instructions).to be_present diff --git a/features/step_definitions/workspace_steps.rb b/features/step_definitions/workspace_steps.rb index 32193bd..53c1d9b 100644 --- a/features/step_definitions/workspace_steps.rb +++ b/features/step_definitions/workspace_steps.rb @@ -9,13 +9,20 @@ end When('I open the checklist named {string}') do |string| - click_on(string) + Capybara.page.current_window.resize_to(1980, 1000) # SMELL: move this to a step definition + find('a', text: string).click end When('I click on the {string} checklist item') do |string| - find('input[type="checkbox"]') do |checkbox| - checkbox.sibling('p').text == string + element = find('input[type="checkbox"]') do |checkbox| + parent_element = checkbox.find(:xpath, '..') + text_nodes = parent_element.text.split("\n") + text_nodes.include?(string) end + + expect(element).to be_present + element.click + sleep(1) # TODO: Remove this and wait for the page to load properly end When('I click on the {string} link in the checklist') do |string| @@ -27,7 +34,11 @@ end Then('the {string} checklist item will be marked as checked') do |string| - find('input[type="checkbox"]') do |checkbox| - checkbox.sibling('p').text == string + element = find('input[type="checkbox"]') do |checkbox| + parent_element = checkbox.find(:xpath, '..') + text_nodes = parent_element.text.split("\n") + text_nodes.include?(string) end + + expect(element.checked?).to be_truthy end diff --git a/features/templates/checklists/admin_user_specific.feature b/features/templates/checklists/admin_user_specific.feature index 3a1d32c..95f523f 100644 --- a/features/templates/checklists/admin_user_specific.feature +++ b/features/templates/checklists/admin_user_specific.feature @@ -15,8 +15,17 @@ Then the template called "New Template" should be saved in the library Then I should be taken to the template checklist view page Scenario: Admin user edits a template checklist +Given I am a logged in as an admin user +And a draft template checklist called "New Template" exists +When I click on "Edit" for the "New Template" template checklist +And I fill in the form with the following information: +| templates_checklist_title | Updated Template | +And I click on "Save" +Then the template called "Updated Template" should be saved in the library +Then I should be taken to the template checklist view page + -Scenario: Admin user deletes a template checklist +Scenario: Admin user archives a template checklist Scenario: Admin user publishes a template checklist Given I am a logged in as an admin user