Fix editor_spec and adopt to current design of implementation page

Signed-off-by: Sebastian Serth <Sebastian.Serth@student.hpi.de>
This commit is contained in:
Sebastian Serth
2018-02-26 09:22:28 +01:00
parent fdd5fa59f5
commit d503b3c0f6

View File

@ -1,7 +1,7 @@
require 'rails_helper' require 'rails_helper'
describe 'Editor', js: true do describe 'Editor', js: true do
let(:exercise) { FactoryBot.create(:audio_video, instructions: Forgery(:lorem_ipsum).sentence) } let(:exercise) { FactoryBot.create(:audio_video, description: Forgery(:lorem_ipsum).sentence) }
let(:user) { FactoryBot.create(:teacher) } let(:user) { FactoryBot.create(:teacher) }
before(:each) do before(:each) do
@ -9,32 +9,18 @@ describe 'Editor', js: true do
fill_in('email', with: user.email) fill_in('email', with: user.email)
fill_in('password', with: FactoryBot.attributes_for(:teacher)[:password]) fill_in('password', with: FactoryBot.attributes_for(:teacher)[:password])
click_button(I18n.t('sessions.new.link')) click_button(I18n.t('sessions.new.link'))
expect_any_instance_of(LtiHelper).to receive(:lti_outcome_service?).and_return(true)
visit(implement_exercise_path(exercise)) visit(implement_exercise_path(exercise))
end end
skip "is skipped" do
# selenium tests are currently not working locally.
it 'displays the exercise title' do it 'displays the exercise title' do
expect(page).to have_content(exercise.title) expect(page).to have_content(exercise.title)
end end
it 'displays the exercise description' do
expect(page).to have_content(exercise.description)
end end
describe 'Instructions Tab' do
skip "is skipped" do
before(:each) { click_link(I18n.t('activerecord.attributes.exercise.instructions')) }
it 'displays the exercise instructions' do
expect(page).to have_content(exercise.instructions)
end
end
end
describe 'Workspace Tab' do
skip "is skipped" do
before(:each) { click_link(I18n.t('exercises.implement.workspace')) }
it 'displays all visible files in a file tree' do it 'displays all visible files in a file tree' do
within('#files') do within('#files') do
exercise.files.select(&:visible).each do |file| exercise.files.select(&:visible).each do |file|
@ -79,24 +65,18 @@ describe 'Editor', js: true do
end end
context 'when selecting a non-binary file' do context 'when selecting a non-binary file' do
let(:file) { exercise.files.detect { |file| !file.file_type.binary? } } let(:file) { exercise.files.detect { |file| !file.file_type.binary? && !file.hidden? } }
it "displays the file's code" do it "displays the file's code" do
expect(page).to have_css(".frame[data-filename='#{file.name_with_extension}']") expect(page).to have_css(".frame[data-filename='#{file.name_with_extension}']")
end end
end end
end end
end
end
describe 'Progress Tab' do
skip "is skipped" do
before(:each) { click_link(I18n.t('exercises.implement.progress')) }
it 'does not contains a button for submitting the exercise' do it 'does not contains a button for submitting the exercise' do
# pending("the button is only displayed when an correct LTI handshake to a running course happened. This is not the case in the test") click_button(I18n.t('exercises.editor.score'))
expect(page).not_to have_css('#submit') click_button('toggle-sidebar-output-collapsed')
end expect(page).not_to have_css('#submit_outdated')
end expect(page).to have_css('#submit')
end end
end end