Add some tests on dossier filtering
This commit is contained in:
parent
0705efde30
commit
e9a52d769c
1 changed files with 51 additions and 3 deletions
|
@ -5,7 +5,8 @@ feature "procedure filters" do
|
||||||
let(:gestionnaire) { create(:gestionnaire, procedures: [procedure]) }
|
let(:gestionnaire) { create(:gestionnaire, procedures: [procedure]) }
|
||||||
let!(:type_de_champ) { procedure.types_de_champ.first }
|
let!(:type_de_champ) { procedure.types_de_champ.first }
|
||||||
let!(:new_unfollow_dossier) { create(:dossier, procedure: procedure, state: "received") }
|
let!(:new_unfollow_dossier) { create(:dossier, procedure: procedure, state: "received") }
|
||||||
let(:champ) { Champ.find_by(type_de_champ_id: type_de_champ.id) }
|
let!(:champ) { Champ.find_by(type_de_champ_id: type_de_champ.id, dossier_id: new_unfollow_dossier.id) }
|
||||||
|
let!(:new_unfollow_dossier_2) { create(:dossier, procedure: procedure, state: "received") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
champ.update_attributes(value: "Mon champ rempli")
|
champ.update_attributes(value: "Mon champ rempli")
|
||||||
|
@ -14,8 +15,20 @@ feature "procedure filters" do
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "should display demandeur by default" do
|
scenario "should display demandeur by default" do
|
||||||
expect(page).to have_content("Demandeur")
|
within ".dossiers-table" do
|
||||||
expect(page).to have_content(new_unfollow_dossier.user.email)
|
expect(page).to have_link("Demandeur")
|
||||||
|
expect(page).to have_link(new_unfollow_dossier.user.email)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "should list all dossiers" do
|
||||||
|
within ".dossiers-table" do
|
||||||
|
expect(page).to have_link(new_unfollow_dossier.id)
|
||||||
|
expect(page).to have_link(new_unfollow_dossier.user.email)
|
||||||
|
|
||||||
|
expect(page).to have_link(new_unfollow_dossier_2.id)
|
||||||
|
expect(page).to have_link(new_unfollow_dossier_2.user.email)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "should add be able to add created_at column", js: true do
|
scenario "should add be able to add created_at column", js: true do
|
||||||
|
@ -40,6 +53,41 @@ feature "procedure filters" do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "should be able to add and remove filter", js: true do
|
||||||
|
add_filter(type_de_champ.libelle, champ.value)
|
||||||
|
|
||||||
|
expect(page).to have_content("#{type_de_champ.libelle} : #{champ.value}")
|
||||||
|
|
||||||
|
within ".dossiers-table" do
|
||||||
|
expect(page).to have_link(new_unfollow_dossier.id)
|
||||||
|
expect(page).to have_link(new_unfollow_dossier.user.email)
|
||||||
|
|
||||||
|
expect(page).not_to have_link(new_unfollow_dossier_2.id)
|
||||||
|
expect(page).not_to have_link(new_unfollow_dossier_2.user.email)
|
||||||
|
end
|
||||||
|
|
||||||
|
remove_filter
|
||||||
|
|
||||||
|
within ".dossiers-table" do
|
||||||
|
expect(page).to have_link(new_unfollow_dossier.id)
|
||||||
|
expect(page).to have_link(new_unfollow_dossier.user.email)
|
||||||
|
|
||||||
|
expect(page).to have_link(new_unfollow_dossier_2.id)
|
||||||
|
expect(page).to have_link(new_unfollow_dossier_2.user.email)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def remove_filter
|
||||||
|
find(:xpath, "//span[contains(@class, 'filter')]/a").click
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_filter(column_name, filter_value)
|
||||||
|
find(:xpath, "//span[contains(text(), 'Filtrer')]").click
|
||||||
|
select column_name, from: "Colonne"
|
||||||
|
fill_in "Valeur", with: filter_value
|
||||||
|
click_button "Ajouter le filtre"
|
||||||
|
end
|
||||||
|
|
||||||
def add_column(column_name)
|
def add_column(column_name)
|
||||||
find(:xpath, "//span[contains(text(), 'Personnaliser')]").click
|
find(:xpath, "//span[contains(text(), 'Personnaliser')]").click
|
||||||
find("span.select2-container").click
|
find("span.select2-container").click
|
||||||
|
|
Loading…
Reference in a new issue