Skip to content

Commit

Permalink
システムスペックのドライバをseleniumに変更してJSに対応。テストを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
YukiWatanabe824 committed Jun 9, 2024
1 parent 4a6e1ca commit 220d29b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
6 changes: 6 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
require 'factory_bot_rails'
require 'selenium-webdriver'

ENV['RAILS_ENV'] = 'test'
require_relative '../config/environment'
Expand Down Expand Up @@ -69,4 +70,9 @@

# using devise (auth) helper
config.include Devise::Test::IntegrationHelpers, type: :request

# setup using selenium-webdriver
config.before(:each, type: :system, js: true) do
driven_by :selenium_chrome_headless
end
end
18 changes: 15 additions & 3 deletions spec/system/homes_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
# frozen_string_literal: true

require 'rails_helper'

RSpec.describe "Homes", type: :system do
RSpec.describe 'Homes', type: :system do
before do
driven_by(:rack_test)
driven_by(:selenium_chrome_headless)
end

scenario 'visiting the top page' do
visit root_path
expect(page).to have_title 'メインページ | MAAKS'
end

pending "add some scenarios (or delete) #{__FILE__}"
scenario 'showing how to modal when first access in day and no show how to modal when after the second access that day' do
visit root_path
expect(page).to have_selector '#how_to_maaks_modal', visible: :visible
visit root_path
expect(page).to have_no_selector '#how_to_maaks_modal', visible: :visible
end
end

0 comments on commit 220d29b

Please sign in to comment.