-
Notifications
You must be signed in to change notification settings - Fork 494
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
Resolve inability to schedule events #3244
Open
AndrewKvalheim
wants to merge
2
commits into
openSUSE:master
Choose a base branch
from
AndrewKvalheim:test-schedule-editor
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+98
−1
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
def expect_scheduled(event, time) | ||
visit admin_conference_program_event_path(event.conference.short_title, event) | ||
if time | ||
date = event.conference.start_date.strftime('%F') | ||
expect(page).to have_text("Scheduled time #{date} #{time} #{event.conference.timezone}") | ||
else | ||
expect(page).to have_no_text('Scheduled') | ||
end | ||
end | ||
|
||
def move(event, to:) | ||
draggable = find("#event-#{event.id}.ui-draggable") | ||
droppable = find("#schedule-room-#{to[0].guid}-#{to[1]}-#{to[2]}.ui-droppable") | ||
wait_for_ajax { draggable.drag_to droppable } | ||
end | ||
|
||
def remove(event) | ||
button = find("#event-#{event.id} .schedule-event-delete-button") | ||
wait_for_ajax { button.click } | ||
end | ||
|
||
feature Schedule do | ||
let(:venue) { create(:venue) } | ||
let(:conference) { create(:conference, venue: venue) } | ||
let!(:room) { create(:room, venue: venue) } | ||
let!(:event) { create(:event, program: conference.program, state: 'confirmed') } | ||
|
||
context 'as an organizer' do | ||
let(:organizer) { create(:organizer, resource: conference) } | ||
|
||
before :each do | ||
sign_in organizer | ||
end | ||
|
||
scenario 'create a schedule', js: true do | ||
expect_scheduled event, nil | ||
|
||
visit admin_conference_schedules_path(conference) | ||
click_on 'Add Schedule' | ||
move event, to: [room, 9, 30] | ||
wait_for_ajax { switch conference.short_title, to: true } | ||
|
||
expect_scheduled event, '09:30' | ||
end | ||
|
||
scenario 'reschedule an event', js: true do | ||
create(:event_schedule, event: event, room: room) | ||
expect_scheduled event, '09:00' | ||
|
||
visit admin_conference_schedule_path(conference, conference.program.selected_schedule) | ||
move event, to: [room, 12, 15] | ||
|
||
expect_scheduled event, '12:15' | ||
end | ||
|
||
scenario 'unschedule an event', js: true do | ||
create(:event_schedule, event: event, room: room) | ||
expect_scheduled event, '09:00' | ||
|
||
visit admin_conference_schedule_path(conference, conference.program.selected_schedule) | ||
remove event | ||
|
||
expect_scheduled event, nil | ||
end | ||
end | ||
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
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,11 @@ | ||
# frozen_string_literal: true | ||
|
||
module BootstrapMacros | ||
# Interact with Bootstrap Switch | ||
def switch(locator, to:, **options) | ||
checkbox = find(:checkbox, locator, **options, visible: :hidden) | ||
|
||
checkbox.ancestor('.bootstrap-switch').click unless checkbox.checked? == to | ||
expect(page).to have_selector(:checkbox, locator, **options, visible: :hidden, checked: to) | ||
end | ||
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,14 @@ | ||
# frozen_string_literal: true | ||
|
||
module JQueryMacros | ||
# Wait for one jQuery Ajax request during the block | ||
def wait_for_ajax | ||
flag = "window.ajax_#{SecureRandom.alphanumeric(16)}" | ||
page.execute_script "#{flag} = false; $(document).one('ajaxComplete', () => #{flag} = true);" | ||
|
||
yield | ||
|
||
Timeout.timeout(Capybara.default_max_wait_time) { loop until page.evaluate_script(flag) } | ||
page.execute_script "delete #{flag};" | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds like a shared example to me...
https://rspec.info/features/3-12/rspec-core/example-groups/shared-examples/