Expand the Measured Dashboard to All Schools and Districts. [Finishes #179727798]

This commit is contained in:
rebuilt 2021-09-29 21:25:09 +02:00
parent 87f268dd7a
commit cc2f3f9352
6 changed files with 115 additions and 6 deletions

View file

@ -3,6 +3,7 @@ require 'rails_helper'
feature 'School dashboard', type: feature do
let(:district) { District.find_by_slug 'winchester' }
let(:school) { School.find_by_slug 'winchester-high-school' }
let(:school_in_same_district) { School.find_by_slug 'muraco-elementary-school' }
let(:measure_1A_i) { Measure.find_by_measure_id('1A-i') }
let(:measure_2A_i) { Measure.find_by_measure_id('2A-i') }
@ -19,6 +20,9 @@ feature 'School dashboard', type: feature do
let(:ay_2020_21) { AcademicYear.find_by_range '2020-21' }
let(:username) { 'winchester' }
let(:password) { 'winchester!' }
before :each do
SurveyItemResponse.create response_id: rand.to_s, academic_year: ay_2020_21, school: school,
survey_item: survey_item_1_for_measure_1A_i, likert_score: 4
@ -76,6 +80,43 @@ feature 'School dashboard', type: feature do
expect(professional_qualifications_row_index).to be < problem_solving_emphasis_row_index
end
let(:username) { 'winchester' }
let(:password) { 'winchester!' }
# visit photos_path
# assert_selector 'h1', text: 'Photos'
# assert_equal 1, all('.photo-deletable').count
# click_on 'Delete'
# page.driver.browser.switch_to.alert.accept
scenario 'user sees schools in the same district' do
page.driver.browser.basic_authorize(username, password)
visit "/districts/#{district.slug}/schools/#{school.slug}/dashboard?year=#{ay_2020_21.range}"
assert_selector "h1", text: school.name
expected_num_of_schools = district.schools.count
expect(page.all('.school-options').count).to eq expected_num_of_schools
expect(page.all('.school-options[selected]').count).to eq 1
expect(page.all('.school-options[selected]')[0].text).to eq 'Winchester High School'
school_options = page.all('.school-options')
school_options.each_with_index do |school , index|
break if index == school_options.length-1
expect(school.text).to be < school_options[index+1].text
end
end
scenario 'user sees all districts in dropdown menu' do
page.driver.browser.basic_authorize(username, password)
visit "/districts/#{district.slug}/schools/#{school.slug}/dashboard?year=#{ay_2020_21.range}"
expected_num_of_districts = District.count
expect(page.all('.district-options').count).to eq expected_num_of_districts
expect(page.all('.district-options[selected]').count).to eq 1
expect(page.all('.district-options[selected]')[0].text).to eq 'Winchester'
district_options = page.all('.district-options')
district_options.each_with_index do |district , index|
break if index == district_options.length-1
expect(district.text).to be < district_options[index+1].text
end
end
end