-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
110 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require "test_helper" | ||
|
||
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase | ||
driven_by :selenium, using: :chrome, screen_size: [1400, 1400] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
require "application_system_test_case" | ||
|
||
class SchedulesTest < ApplicationSystemTestCase | ||
test 'schedule has all days buttons' do | ||
visit event_schedules_path(event_name: events(:kaigi).name) | ||
assert_button('2024-03-18') | ||
assert_button('2024-03-19') | ||
end | ||
|
||
test 'schedule date button can switch table' do | ||
visit event_schedules_path(event_name: events(:kaigi).name) | ||
|
||
assert_selector('h3', text: 'keynote1') | ||
refute_selector('h3', text: 'keynote2') | ||
|
||
click_button('2024-03-19') | ||
|
||
refute_selector('h3', text: 'keynote1') | ||
assert_selector('h3', text: 'keynote2') | ||
end | ||
|
||
test 'schedule cards count expected' do | ||
visit event_schedules_path(event_name: events(:kaigi).name) | ||
|
||
table_rows = all('tr') | ||
|
||
assert_equal 1, table_rows[1].all('turbo-frame').count | ||
assert_equal 3, table_rows[2].all('turbo-frame').count | ||
assert_equal 2, table_rows[3].all('turbo-frame').count | ||
assert_equal 1, table_rows[4].all('turbo-frame').count | ||
|
||
click_button('2024-03-19') | ||
|
||
table_rows = all('tr') | ||
|
||
assert_equal 3, table_rows[1].all('turbo-frame').count | ||
assert_equal 2, table_rows[2].all('turbo-frame').count | ||
assert_equal 2, table_rows[3].all('turbo-frame').count | ||
assert_equal 1, table_rows[4].all('turbo-frame').count | ||
end | ||
|
||
test 'anker works' do | ||
visit "#{event_schedules_path(event_name: events(:kaigi).name)}#2024-03-19" | ||
find_button(class: 'tab-btn-active').has_text?('2024-03-19') | ||
end | ||
|
||
test 'dialog shown up' do | ||
visit event_schedules_path(event_name: events(:kaigi).name) | ||
|
||
refute_selector('dialog') | ||
|
||
all(class: ['show-detail-button'])[0].click | ||
|
||
assert_selector('dialog') | ||
end | ||
|
||
test 'when add a schedule to plan first time, shown up dialog' do | ||
visit event_schedules_path(event_name: events(:kaigi).name) | ||
|
||
all(class: ['add-plan-button'])[0].click | ||
|
||
assert_selector(class: ['confirm-terms-of-service-button']) | ||
end | ||
|
||
test 'when one schedule added to plan, disable same row schedule button' do | ||
visit event_schedules_path(event_name: events(:kaigi).name) | ||
|
||
all(class: ['add-plan-button'])[1].click | ||
find(class: ['confirm-terms-of-service-button']).click | ||
|
||
# wait for turbo frame | ||
if has_selector?('dialog', visible: true, wait: (0.25).seconds) | ||
has_no_selector?('dialog', visible: true, wait: 1.seconds) | ||
end | ||
|
||
table_rows = all('tr') | ||
assert table_rows[2].all(class: ['add-plan-button']).all? { _1.disabled? } | ||
end | ||
|
||
test 'when one schedule added to plan, that schedule button to be remove button' do | ||
visit event_schedules_path(event_name: events(:kaigi).name) | ||
|
||
all(class: ['add-plan-button'])[1].click | ||
find(class: ['confirm-terms-of-service-button']).click | ||
|
||
# wait for turbo frame | ||
if has_selector?('dialog', visible: true, wait: (0.25).seconds) | ||
has_no_selector?('dialog', visible: true, wait: 1.seconds) | ||
end | ||
|
||
table_rows = all('tr') | ||
assert table_rows[2].find_button(class: ['remove-plan-button']) | ||
end | ||
end |