Make officing specs detect bugs in the menu links
In commit baaec3a29 we started using the JavaScript driver in tests
dealing with the user menu, and made all tests pass.
However, we didn't update some officing tests that were also passing
when there was a bug in the code. That's because now that these tests
use a JavaScript driver, the link to "Polling officers" is never present
before pressing the "Menu" item. So tests checking the link isn't
present when loading the page always pass.
This commit is contained in:
@@ -8,7 +8,9 @@ describe "Poll Officing" do
|
|||||||
login_as(user)
|
login_as(user)
|
||||||
visit root_path
|
visit root_path
|
||||||
|
|
||||||
expect(page).not_to have_link("Polling officers")
|
expect(page).not_to have_content "Menu"
|
||||||
|
expect(page).not_to have_link "Polling officers"
|
||||||
|
|
||||||
visit officing_root_path
|
visit officing_root_path
|
||||||
|
|
||||||
expect(page).not_to have_current_path(officing_root_path)
|
expect(page).not_to have_current_path(officing_root_path)
|
||||||
@@ -18,10 +20,14 @@ describe "Poll Officing" do
|
|||||||
|
|
||||||
scenario "Access as moderator is not authorized" do
|
scenario "Access as moderator is not authorized" do
|
||||||
create(:moderator, user: user)
|
create(:moderator, user: user)
|
||||||
|
|
||||||
login_as(user)
|
login_as(user)
|
||||||
visit root_path
|
visit root_path
|
||||||
|
click_link "Menu"
|
||||||
|
|
||||||
|
expect(page).to have_link "Moderation"
|
||||||
|
expect(page).not_to have_link "Polling officers"
|
||||||
|
|
||||||
expect(page).not_to have_link("Polling officers")
|
|
||||||
visit officing_root_path
|
visit officing_root_path
|
||||||
|
|
||||||
expect(page).not_to have_current_path(officing_root_path)
|
expect(page).not_to have_current_path(officing_root_path)
|
||||||
@@ -31,10 +37,14 @@ describe "Poll Officing" do
|
|||||||
|
|
||||||
scenario "Access as manager is not authorized" do
|
scenario "Access as manager is not authorized" do
|
||||||
create(:manager, user: user)
|
create(:manager, user: user)
|
||||||
|
|
||||||
login_as(user)
|
login_as(user)
|
||||||
visit root_path
|
visit root_path
|
||||||
|
click_link "Menu"
|
||||||
|
|
||||||
|
expect(page).to have_link "Management"
|
||||||
|
expect(page).not_to have_link "Polling officers"
|
||||||
|
|
||||||
expect(page).not_to have_link("Polling officers")
|
|
||||||
visit officing_root_path
|
visit officing_root_path
|
||||||
|
|
||||||
expect(page).not_to have_current_path(officing_root_path)
|
expect(page).not_to have_current_path(officing_root_path)
|
||||||
@@ -43,11 +53,15 @@ describe "Poll Officing" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Access as SDG manager is not authorized" do
|
scenario "Access as SDG manager is not authorized" do
|
||||||
|
Setting["feature.sdg"] = true
|
||||||
create(:sdg_manager, user: user)
|
create(:sdg_manager, user: user)
|
||||||
|
|
||||||
login_as(user)
|
login_as(user)
|
||||||
visit root_path
|
visit root_path
|
||||||
|
click_link "Menu"
|
||||||
|
|
||||||
expect(page).not_to have_link("Polling officers")
|
expect(page).to have_link "SDG content"
|
||||||
|
expect(page).not_to have_link "Polling officers"
|
||||||
|
|
||||||
visit officing_root_path
|
visit officing_root_path
|
||||||
|
|
||||||
@@ -58,10 +72,14 @@ describe "Poll Officing" do
|
|||||||
|
|
||||||
scenario "Access as a valuator is not authorized" do
|
scenario "Access as a valuator is not authorized" do
|
||||||
create(:valuator, user: user)
|
create(:valuator, user: user)
|
||||||
|
|
||||||
login_as(user)
|
login_as(user)
|
||||||
visit root_path
|
visit root_path
|
||||||
|
click_link "Menu"
|
||||||
|
|
||||||
|
expect(page).to have_link "Valuation"
|
||||||
|
expect(page).not_to have_link "Polling officers"
|
||||||
|
|
||||||
expect(page).not_to have_link("Polling officers")
|
|
||||||
visit officing_root_path
|
visit officing_root_path
|
||||||
|
|
||||||
expect(page).not_to have_current_path(officing_root_path)
|
expect(page).not_to have_current_path(officing_root_path)
|
||||||
@@ -72,10 +90,15 @@ describe "Poll Officing" do
|
|||||||
scenario "Access as an administrator is not authorized" do
|
scenario "Access as an administrator is not authorized" do
|
||||||
create(:administrator, user: user)
|
create(:administrator, user: user)
|
||||||
create(:poll)
|
create(:poll)
|
||||||
|
|
||||||
login_as(user)
|
login_as(user)
|
||||||
visit root_path
|
visit root_path
|
||||||
|
|
||||||
expect(page).not_to have_link("Polling officers")
|
click_link "Menu"
|
||||||
|
|
||||||
|
expect(page).to have_link "Administration"
|
||||||
|
expect(page).not_to have_link "Polling officers"
|
||||||
|
|
||||||
visit officing_root_path
|
visit officing_root_path
|
||||||
|
|
||||||
expect(page).not_to have_current_path(officing_root_path)
|
expect(page).not_to have_current_path(officing_root_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user