Skip to content

Commit

Permalink
fix flaky test block in instructor role spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Formasitchijoh committed Feb 25, 2025
1 parent 696b965 commit 0418f2c
Showing 1 changed file with 14 additions and 32 deletions.
46 changes: 14 additions & 32 deletions spec/features/instructor_role_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'rails_helper'

describe 'Instructor users', type: :feature, js: true do
describe 'Instructor users', :js, type: :feature do
before do
include type: :feature
include Devise::TestHelpers
Expand Down Expand Up @@ -70,7 +70,7 @@
it 'can see the passcode' do
visit "/courses/#{Course.first.slug}"
expect(page).to have_content('passcode')
expect(page).not_to have_content('****')
expect(page).to have_no_content('****')
end
end

Expand Down Expand Up @@ -128,52 +128,34 @@
sleep 1
visit "/courses/#{Course.first.slug}/students"
expect(page).to have_content 'Student A'
expect(page).not_to have_content 'Student B'
expect(page).to have_no_content 'Student B'
end

it 'is able to assign articles' do
# pending 'This sometimes fails on travis.'

visit "/courses/#{Course.first.slug}/students/articles"
first('.student-selection .student').click

# Assign an article
click_button 'Assign Articles'
find('button.border', text: 'Assign/remove an article', match: :first).click
within('#users') { find('input', match: :first).set('Article 1') }
within('#users') { find('textarea', match: :first).set('Article 1') }
click_button 'Assign'
click_button 'OK'
find('button.border.assign-button', match: :first).click
click_button 'Done'

# Assign a review
find('button.border', text: 'Assign/remove a peer review', match: :first).click
sleep 1
within('#users') { find('input', match: :first).set('Article 2') }
within('#users') { find('textarea', match: :first).set('Article 2') }
click_button 'Assign'
click_button 'OK'
find('button.border.assign-button', match: :first).click
click_button 'Done'

# Leave editing mode
within 'div.controls' do
click_button 'Done'
end
expect(page).to have_content 'Article 1'
expect(page).to have_content 'Article 2'

# Delete an assignments
visit "/courses/#{Course.first.slug}/students/articles"
sleep 1
click_button 'Assign Articles'
find('button.border.assign-button', match: :first).click
page.accept_confirm do
click_button '-'
end
sleep 1
within 'div.controls' do
click_button 'Done'
end
expect(page).not_to have_content 'Article 1'

# pass_pending_spec
first('.student-selection .student').click
find('button.border', text: 'Assign/remove an article', match: :first).click
first('button.border.assign-selection-button', text: 'Remove').click
click_button 'OK'
expect(page).to have_no_content 'Article 1'
end

it 'is able to add Available Articles' do
Expand All @@ -195,7 +177,7 @@
find('button.border.plus', text: '-', match: :first).click
click_button 'OK'
sleep 1
expect(page).not_to have_content 'Student A'
expect(page).to have_no_content 'Student A'

# pass_pending_spec
end
Expand Down

0 comments on commit 0418f2c

Please sign in to comment.