-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
116 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
require_relative './helpers/assignment_creation_helper' | ||
|
||
describe 'Assignment creation topics tab' do | ||
include AssignmentCreationHelper | ||
# This block runs before each test to set up the environment | ||
before(:each) do | ||
create_deadline_types | ||
(1..3).each { |i| create(:course, name: "Course #{i}") } | ||
@assignment = create(:assignment, name: 'assignment for late policy test') | ||
login_as('instructor6') | ||
visit "/assignments/#{@assignment.id}/edit" | ||
check('assignment_form_assignment_calculate_penalty', allow_label_click: true) | ||
click_link 'Due dates' | ||
end | ||
|
||
# Test to ensure no flash error message is displayed on the New Late Policy Page | ||
it 'does not displays flash error message on New Late Policy Page' do | ||
create(:topic, assignment_id: @assignment.id) | ||
visit "/assignments/#{@assignment.id}/edit" | ||
click_link 'Due dates' | ||
click_link 'New late policy' | ||
expected_error_message = "Failed to save the assignment: #{@assignment.id}" | ||
expect(page).not_to have_content(expected_error_message) | ||
end | ||
|
||
# Test to check navigation back to the assignment edit page via the "Back" button | ||
it 'navigates back to assignment edit page on Back button click' do | ||
create(:topic, assignment_id: @assignment.id) | ||
visit "/assignments/#{@assignment.id}/edit" | ||
click_link 'Due dates' | ||
click_link 'New late policy' | ||
click_link 'Back' | ||
expect(page).to have_current_path("/assignments/#{@assignment.id}/edit") | ||
end | ||
|
||
# Test to check navigation back to the assignment edit page while creating a late policy | ||
it 'navigates back to assignment edit page while creating on Back button click' do | ||
create(:topic, assignment_id: @assignment.id) | ||
visit "/assignments/#{@assignment.id}/edit" | ||
click_link 'Due dates' | ||
click_link 'New late policy' | ||
fill_in 'late_policy_policy_name', with: 'Test Late Policy' | ||
fill_in 'late_policy_penalty_per_unit', with: '15' | ||
fill_in 'late_policy_max_penalty', with: '20' | ||
click_button 'Create' | ||
visit '/late_policies' | ||
click_link 'Back' | ||
expect(page).to have_current_path("/assignments/#{@assignment.id}/edit") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require_relative './helpers/assignment_creation_helper' | ||
|
||
describe 'Navigation scenarios for Late Policies' do | ||
include AssignmentCreationHelper | ||
|
||
# This block runs before each test to set up the necessary context | ||
before(:each) do | ||
@course = create(:course, name: 'Test Course') | ||
login_as('instructor6') | ||
end | ||
|
||
# Test case for navigating back from "New Late Policy" to the Assignments tab when accessed directly | ||
it 'navigates to Assignments tab on the home screen from New Late Policy' do | ||
visit '/late_policies/new' | ||
click_link 'Back' | ||
expect(page).to have_current_path('/student_task/list') | ||
end | ||
|
||
# Test case for navigating back from "All Late Policies" to the Assignments tab when accessed directly | ||
it 'navigates to Assignments tab on the home screen from All Late Policies' do | ||
visit '/late_policies' | ||
click_link 'Back' | ||
expect(page).to have_current_path('/student_task/list') | ||
end | ||
end |