Re-enable oscillating tests

This commit is contained in:
Sebastian Serth
2021-05-11 12:08:38 +02:00
parent 26151920c0
commit ebdfd4ab63
6 changed files with 32 additions and 9 deletions

View File

@ -56,3 +56,4 @@ test:
<<: *default <<: *default
host: tcp://127.0.0.1:2376 host: tcp://127.0.0.1:2376
workspace_root: <%= Rails.root.join('tmp', 'files', Rails.env) %> workspace_root: <%= Rails.root.join('tmp', 'files', Rails.env) %>
ws_client_protocol: 'ws:' #set the websocket protocol to be used by the client to connect to the rails server (ws on development, wss on production)

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rails_helper' require 'rails_helper'
describe SessionsController do describe SessionsController do
@ -132,14 +134,12 @@ describe SessionsController do
end end
it 'redirects to recommended exercise if requested token of proxy exercise' do it 'redirects to recommended exercise if requested token of proxy exercise' do
skip 'test is currently oscillating'
FactoryBot.create(:proxy_exercise, exercises: [exercise]) FactoryBot.create(:proxy_exercise, exercises: [exercise])
post :create_through_lti, params: { custom_locale: locale, custom_token: ProxyExercise.first.token, oauth_consumer_key: consumer.oauth_key, oauth_nonce: nonce, oauth_signature: SecureRandom.hex, user_id: user.external_id } post :create_through_lti, params: { custom_locale: locale, custom_token: ProxyExercise.first.token, oauth_consumer_key: consumer.oauth_key, oauth_nonce: nonce, oauth_signature: SecureRandom.hex, user_id: user.external_id }
expect(controller).to redirect_to(implement_exercise_path(exercise.id)) expect(controller).to redirect_to(implement_exercise_path(exercise.id))
end end
it 'recommends only exercises who are 1 degree more complicated than what user has seen' do it 'recommends only exercises who are 1 degree more complicated than what user has seen' do
skip 'test is currently oscillating'
# dummy user has no exercises finished, therefore his highest difficulty is 0 # dummy user has no exercises finished, therefore his highest difficulty is 0
FactoryBot.create(:proxy_exercise, exercises: [exercise, exercise2]) FactoryBot.create(:proxy_exercise, exercises: [exercise, exercise2])
exercise.expected_difficulty = 3 exercise.expected_difficulty = 3

View File

@ -1,7 +1,8 @@
# frozen_string_literal: true
require 'rails_helper' require 'rails_helper'
describe 'Authentication' do describe 'Authentication' do
before { skip 'feature specs fail randomly as of Nov 2019 on Travis' }
let(:user) { FactoryBot.create(:admin) } let(:user) { FactoryBot.create(:admin) }
let(:password) { FactoryBot.attributes_for(:admin)[:password] } let(:password) { FactoryBot.attributes_for(:admin)[:password] }

View File

@ -1,7 +1,8 @@
# frozen_string_literal: true
require 'rails_helper' require 'rails_helper'
describe 'Authorization' do describe 'Authorization' do
before { skip 'feature specs fail randomly as of Nov 2019 on Travis' }
context 'as an admin' do context 'as an admin' do
let(:user) { FactoryBot.create(:admin) } let(:user) { FactoryBot.create(:admin) }
before(:each) { allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user) } before(:each) { allow_any_instance_of(ApplicationController).to receive(:current_user).and_return(user) }

View File

@ -1,11 +1,30 @@
# frozen_string_literal: true
require 'rails_helper' require 'rails_helper'
describe 'Editor', js: true do describe 'Editor', js: true do
before { skip 'feature specs fail randomly as of Nov 2019 on Travis' }
let(:exercise) { FactoryBot.create(:audio_video, description: Forgery(:lorem_ipsum).sentence) } let(:exercise) { FactoryBot.create(:audio_video, description: Forgery(:lorem_ipsum).sentence) }
let(:scoring_response) do
[{
status: 'ok',
stdout: '',
stderr: '',
waiting_for_container_time: 0,
container_execution_time: 0,
file_role: 'teacher_defined_test',
count: 1,
failed: 0,
error_messages: [],
passed: 1,
score: 1.0,
filename: 'index.html_spec.rb',
message: 'Well done.',
weight: 2.0
}]
end
let(:user) { FactoryBot.create(:teacher) } let(:user) { FactoryBot.create(:teacher) }
before(:each) do before do
visit(sign_in_path) visit(sign_in_path)
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])
@ -35,7 +54,7 @@ describe 'Editor', js: true do
end end
context 'when selecting a file' do context 'when selecting a file' do
before(:each) do before do
within('#files') { click_link(file.name_with_extension) } within('#files') { click_link(file.name_with_extension) }
end end
@ -74,9 +93,9 @@ describe 'Editor', js: true do
end end
end end
it 'does not contains a button for submitting the exercise' do it 'contains a button for submitting the exercise' do
allow_any_instance_of(SubmissionsController).to receive(:score_submission).and_return(scoring_response)
click_button(I18n.t('exercises.editor.score')) click_button(I18n.t('exercises.editor.score'))
click_button('toggle-sidebar-output-collapsed')
expect(page).not_to have_css('#submit_outdated') expect(page).not_to have_css('#submit_outdated')
expect(page).to have_css('#submit') expect(page).to have_css('#submit')
end end

View File

@ -13,6 +13,7 @@ Capybara.register_driver :selenium do |app|
profile['intl.accept_languages'] = 'en' profile['intl.accept_languages'] = 'en'
capabilities = Selenium::WebDriver::Remote::Capabilities.firefox(elementScrollBehavior: 1) capabilities = Selenium::WebDriver::Remote::Capabilities.firefox(elementScrollBehavior: 1)
options = Selenium::WebDriver::Firefox::Options.new options = Selenium::WebDriver::Firefox::Options.new
options.headless! if ENV['CI'] == 'true'
options.profile = profile options.profile = profile
driver = Capybara::Selenium::Driver.new(app, browser: :firefox, desired_capabilities: capabilities, options: options) driver = Capybara::Selenium::Driver.new(app, browser: :firefox, desired_capabilities: capabilities, options: options)
driver.browser.manage.window.resize_to(1280, 960) driver.browser.manage.window.resize_to(1280, 960)