spec: student pace plan selenium tests
Closes LS-2948 Test Plan: passes Jenkins Change-Id: Ic659dfa74bd16c61196528647d97643d59f71f10 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282691 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Ed Schiebel <eschiebel@instructure.com> QA-Review: Ed Schiebel <eschiebel@instructure.com> Product-Review: Robin Kuss <rkuss@instructure.com>
This commit is contained in:
parent
92e6b93b91
commit
ca71c18a08
|
@ -219,6 +219,13 @@ describe "pace plan page" do
|
|||
end
|
||||
|
||||
context "Pace Plan Menu" do
|
||||
let(:pace_module_title) { "Pace Module" }
|
||||
let(:module_assignment_title) { "Module Assignment 1" }
|
||||
|
||||
before :once do
|
||||
create_published_pace_plan(pace_module_title, module_assignment_title)
|
||||
end
|
||||
|
||||
it "initially shows the Course Pace Plan in pace plan menu" do
|
||||
visit_pace_plans_page
|
||||
|
||||
|
@ -226,17 +233,32 @@ describe "pace plan page" do
|
|||
end
|
||||
|
||||
it "opens the pace plan menu and selects the student view when clicked" do
|
||||
skip("LS-2857 this spec continues to flake out on the student click and will have to be looked at or removed")
|
||||
visit_pace_plans_page
|
||||
|
||||
click_main_pace_plan_menu
|
||||
click_students_menu_item
|
||||
|
||||
wait_for(method: nil, timeout: 5) { student_pace_plan(@student.name).displayed? }
|
||||
click_student_pace_plan(@student.name)
|
||||
|
||||
expect(pace_plan_menu_value).to eq(@student.name)
|
||||
end
|
||||
|
||||
it "shows actual student assignment day and due dates" do
|
||||
visit_pace_plans_page
|
||||
click_main_pace_plan_menu
|
||||
click_students_menu_item
|
||||
click_student_pace_plan(@student.name)
|
||||
|
||||
expect(duration_readonly.text).to eq("2")
|
||||
end
|
||||
|
||||
it "displays modal regarding unpublished changes when going to student view" do
|
||||
visit_pace_plans_page
|
||||
update_module_item_duration(3)
|
||||
click_main_pace_plan_menu
|
||||
click_students_menu_item
|
||||
click_student_pace_plan(@student.name)
|
||||
|
||||
expect(unpublished_warning_modal).to be_displayed
|
||||
end
|
||||
end
|
||||
|
||||
context "settings button" do
|
||||
|
|
|
@ -92,7 +92,7 @@ module PacePlansCommonPageObject
|
|||
# We want the module item autopublish to happen immediately in test
|
||||
Setting.set("pace_plan_publish_interval", "0")
|
||||
|
||||
pace_plan_model(course: @course)
|
||||
pace_plan_model(course: @course, end_date: Time.zone.now.advance(days: 30))
|
||||
pace_plan_module = create_course_module(module_title)
|
||||
pace_plan_assignment = create_assignment(@course, assignment_title, "Assignment 1", 10, "published")
|
||||
pace_plan_module.add_item(id: pace_plan_assignment.id, type: "assignment")
|
||||
|
|
|
@ -33,6 +33,10 @@ module PacePlansPageObject
|
|||
"[data-testid='duration-number-input']"
|
||||
end
|
||||
|
||||
def duration_readonly_selector
|
||||
"[data-testid='duration-input']"
|
||||
end
|
||||
|
||||
def edit_tray_close_button_selector
|
||||
"button:contains('Close')"
|
||||
end
|
||||
|
@ -61,6 +65,14 @@ module PacePlansPageObject
|
|||
"[data-position-target='pace-plan-menu']"
|
||||
end
|
||||
|
||||
def pace_plan_picker_selector
|
||||
"[data-testid='pace-plan-picker']"
|
||||
end
|
||||
|
||||
def pace_plan_student_option_selector
|
||||
"[data-position-target='pace-plan-student-menu']"
|
||||
end
|
||||
|
||||
def pace_plans_page_selector
|
||||
"#pace_plans"
|
||||
end
|
||||
|
@ -117,10 +129,18 @@ module PacePlansPageObject
|
|||
"[data-testid='skip-weekends-toggle']"
|
||||
end
|
||||
|
||||
def student_menu_selector
|
||||
"ul[aria-label='Students']"
|
||||
end
|
||||
|
||||
def student_pace_plan_selector(student_name)
|
||||
"span[role=menuitem]:contains(#{student_name})"
|
||||
end
|
||||
|
||||
def student_pp_xpath_selector(student_name)
|
||||
"//ul[@aria-label = 'Students']//span[text() = '#{student_name}']"
|
||||
end
|
||||
|
||||
def students_menu_item_selector
|
||||
"button:contains('Students')"
|
||||
end
|
||||
|
@ -133,6 +153,10 @@ module PacePlansPageObject
|
|||
"[aria-label='Unpublished Changes tray']"
|
||||
end
|
||||
|
||||
def unpublished_warning_modal_selector
|
||||
"[data-testid='unpublished-warning-modal']"
|
||||
end
|
||||
|
||||
#------------------------- Elements --------------------------------
|
||||
|
||||
def cancel_button
|
||||
|
@ -147,6 +171,10 @@ module PacePlansPageObject
|
|||
f(duration_field_selector)
|
||||
end
|
||||
|
||||
def duration_readonly
|
||||
f(duration_readonly_selector)
|
||||
end
|
||||
|
||||
def edit_tray_close_button
|
||||
fj(edit_tray_close_button_selector)
|
||||
end
|
||||
|
@ -179,6 +207,14 @@ module PacePlansPageObject
|
|||
ff(pace_plan_menu_selector)
|
||||
end
|
||||
|
||||
def pace_plan_picker
|
||||
f(pace_plan_picker_selector)
|
||||
end
|
||||
|
||||
def pace_plan_student_option
|
||||
f(pace_plan_student_option_selector)
|
||||
end
|
||||
|
||||
def pace_plans_page
|
||||
f(pace_plans_page_selector)
|
||||
end
|
||||
|
@ -243,6 +279,10 @@ module PacePlansPageObject
|
|||
f(unpublished_changes_tray_selector)
|
||||
end
|
||||
|
||||
def unpublished_warning_modal
|
||||
f(unpublished_warning_modal_selector)
|
||||
end
|
||||
|
||||
#----------------------- Actions & Methods -------------------------
|
||||
def visit_pace_plans_page
|
||||
get "/courses/#{@course.id}/pace_plans"
|
||||
|
@ -259,7 +299,7 @@ module PacePlansPageObject
|
|||
end
|
||||
|
||||
def click_main_pace_plan_menu
|
||||
pace_plan_menu[1].click
|
||||
pace_plan_picker.click
|
||||
end
|
||||
|
||||
def click_require_end_date_checkbox
|
||||
|
@ -279,13 +319,26 @@ module PacePlansPageObject
|
|||
end
|
||||
|
||||
def click_student_pace_plan(student_name)
|
||||
# This check reduces the flakiness of the clicking in this menu. Keeping
|
||||
# the puts line for verification in the logs
|
||||
unless element_exists?(student_pp_xpath_selector(student_name), true)
|
||||
puts "Student pace plan selector didn't exist so retrying click"
|
||||
click_students_menu_item
|
||||
end
|
||||
|
||||
student_pace_plan(student_name).click
|
||||
driver.action.send_keys(:escape).perform
|
||||
end
|
||||
|
||||
def click_students_menu_item
|
||||
students_menu_item.click # focus on it
|
||||
students_menu_item.click # click on it
|
||||
unless element_exists?(pace_plan_student_option_selector)
|
||||
puts "retrying the main menu click"
|
||||
click_main_pace_plan_menu
|
||||
end
|
||||
pace_plan_student_option.click
|
||||
# Reducing the flakiness of this menu
|
||||
unless element_exists?(student_menu_selector)
|
||||
pace_plan_student_option.click
|
||||
end
|
||||
end
|
||||
|
||||
def click_unpublished_changes_button
|
||||
|
@ -308,15 +361,6 @@ module PacePlansPageObject
|
|||
|
||||
delegate :text, to: :pace_plans_page, prefix: true
|
||||
|
||||
def select_student_pace_plan
|
||||
click_main_pace_plan_menu
|
||||
wait_for(method: nil, timeout: 5) { students_menu_item.displayed? }
|
||||
click_students_menu_item
|
||||
|
||||
wait_for(method: nil, timeout: 10) { student_pace_plan(@student.name).displayed? }
|
||||
click_student_pace_plan(@student.name)
|
||||
end
|
||||
|
||||
#----------------------------Element Management---------------------
|
||||
|
||||
def add_required_end_date(required_end_date)
|
||||
|
|
|
@ -122,6 +122,7 @@ export const PlanPicker: React.FC<ComponentProps> = ({
|
|||
open ? <IconArrowOpenUpSolid inline={false} /> : <IconArrowOpenDownSolid inline={false} />
|
||||
}
|
||||
value={selectedContextName}
|
||||
data-testid="pace-plan-picker"
|
||||
interaction="readonly"
|
||||
role="button"
|
||||
onKeyDown={handleKeyDown}
|
||||
|
@ -153,7 +154,7 @@ export const PlanPicker: React.FC<ComponentProps> = ({
|
|||
{/* renderOption(createContextKey('Section', s.id), s.name, `section-${s.id}`) */}
|
||||
{/* )} */}
|
||||
{/* </Menu> */}
|
||||
<Menu id="pace-plan-menu" label={I18n.t('Students')}>
|
||||
<Menu id="pace-plan-student-menu" label={I18n.t('Students')}>
|
||||
{enrollments.map(e =>
|
||||
renderOption(createContextKey('Enrollment', e.id), e.full_name, `student-${e.id}`)
|
||||
)}
|
||||
|
|
|
@ -32,7 +32,13 @@ export type UnpublishedWarningModalProps = {
|
|||
|
||||
const UnpublishedWarningModal = ({open, onCancel, onConfirm}) => {
|
||||
return (
|
||||
<Modal size="small" open={open} onDismiss={onCancel} label={I18n.t('Warning')}>
|
||||
<Modal
|
||||
data-testid="unpublished-warning-modal"
|
||||
size="small"
|
||||
open={open}
|
||||
onDismiss={onCancel}
|
||||
label={I18n.t('Warning')}
|
||||
>
|
||||
<Modal.Body>
|
||||
<View>
|
||||
<Text>
|
||||
|
|
Loading…
Reference in New Issue