Modify specs to work with new features
Add specs to check that the translations are being deleted correctly and the current locale tab is highlighted when the admin visits the edit milestone page.
This commit is contained in:
@@ -39,7 +39,7 @@ feature 'Admin budget investment milestones' do
|
||||
|
||||
click_link 'Create new milestone'
|
||||
|
||||
fill_in 'budget_investment_milestone_description', with: 'New description milestone'
|
||||
fill_in 'budget_investment_milestone_description_en', with: 'New description milestone'
|
||||
fill_in 'budget_investment_milestone_publication_date', with: Date.current
|
||||
|
||||
click_button 'Create milestone'
|
||||
@@ -53,7 +53,7 @@ feature 'Admin budget investment milestones' do
|
||||
|
||||
click_link 'Create new milestone'
|
||||
|
||||
fill_in 'budget_investment_milestone_description', with: 'New description milestone'
|
||||
fill_in 'budget_investment_milestone_description_en', with: 'New description milestone'
|
||||
|
||||
click_button 'Create milestone'
|
||||
|
||||
@@ -77,7 +77,7 @@ feature 'Admin budget investment milestones' do
|
||||
|
||||
expect(page).to have_css("img[alt='#{milestone.image.title}']")
|
||||
|
||||
fill_in 'budget_investment_milestone_description', with: 'Changed description'
|
||||
fill_in 'budget_investment_milestone_description_en', with: 'Changed description'
|
||||
fill_in 'budget_investment_milestone_publication_date', with: Date.current
|
||||
fill_in 'budget_investment_milestone_documents_attributes_0_title', with: 'New document title'
|
||||
|
||||
|
||||
@@ -995,7 +995,8 @@ feature 'Budget Investments' do
|
||||
user = create(:user)
|
||||
investment = create(:budget_investment)
|
||||
create(:budget_investment_milestone, investment: investment,
|
||||
description: "Last milestone with a link to https://consul.dev",
|
||||
description_en: "Last milestone with a link to https://consul.dev",
|
||||
description_es: "Último hito con el link https://consul.dev",
|
||||
publication_date: Date.tomorrow)
|
||||
first_milestone = create(:budget_investment_milestone, investment: investment,
|
||||
description: "First milestone",
|
||||
@@ -1017,6 +1018,15 @@ feature 'Budget Investments' do
|
||||
expect(page).to have_link(document.title)
|
||||
expect(page).to have_link("https://consul.dev")
|
||||
end
|
||||
|
||||
select('Español', from: 'locale-switcher')
|
||||
|
||||
find("#tab-milestones-label").click
|
||||
|
||||
within("#tab-milestones") do
|
||||
expect(page).to have_content('Último hito con el link https://consul.dev')
|
||||
expect(page).to have_link("https://consul.dev")
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Show no_milestones text", :js do
|
||||
|
||||
@@ -5,41 +5,43 @@ feature "Translations" do
|
||||
context "Milestones" do
|
||||
|
||||
let(:investment) { create(:budget_investment) }
|
||||
let(:milestone) { create(:budget_investment_milestone,
|
||||
investment: investment,
|
||||
description_en: "Description in English",
|
||||
description_es: "Descripción en Español") }
|
||||
|
||||
background do
|
||||
admin = create(:administrator)
|
||||
login_as(admin.user)
|
||||
end
|
||||
|
||||
scenario "Add a translation", :js, :focus do
|
||||
milestone = create(:budget_investment_milestone, description: "Description in English")
|
||||
before do
|
||||
@edit_milestone_url = edit_admin_budget_budget_investment_budget_investment_milestone_path(investment.budget, investment, milestone)
|
||||
end
|
||||
|
||||
edit_milestone_url = edit_admin_budget_budget_investment_budget_investment_milestone_path(investment.budget, investment, milestone)
|
||||
visit edit_milestone_url
|
||||
scenario "Add a translation", :js do
|
||||
visit @edit_milestone_url
|
||||
|
||||
select "Español", from: "translation_locale"
|
||||
fill_in 'budget_investment_milestone_description_es', with: 'Descripción en Español'
|
||||
select "Français", from: "translation_locale"
|
||||
fill_in 'budget_investment_milestone_description_fr', with: 'Description en Français'
|
||||
|
||||
click_button 'Update milestone'
|
||||
expect(page).to have_content "Milestone updated successfully"
|
||||
|
||||
visit edit_milestone_url
|
||||
visit @edit_milestone_url
|
||||
expect(page).to have_field('budget_investment_milestone_description_en', with: 'Description in English')
|
||||
|
||||
click_link "Español"
|
||||
expect(page).to have_field('budget_investment_milestone_description_es', with: 'Descripción en Español')
|
||||
|
||||
click_link "Français"
|
||||
expect(page).to have_field('budget_investment_milestone_description_fr', with: 'Description en Français')
|
||||
end
|
||||
|
||||
scenario "Update a translation", :js, :focus do
|
||||
milestone = create(:budget_investment_milestone,
|
||||
investment: investment,
|
||||
description_en: "Description in English",
|
||||
description_es: "Descripción en Español")
|
||||
scenario "Update a translation", :js do
|
||||
visit @edit_milestone_url
|
||||
|
||||
edit_milestone_url = edit_admin_budget_budget_investment_budget_investment_milestone_path(investment.budget, investment, milestone)
|
||||
visit edit_milestone_url
|
||||
|
||||
select "Español", from: "translation_locale"
|
||||
click_link "Español"
|
||||
fill_in 'budget_investment_milestone_description_es', with: 'Descripción correcta en Español'
|
||||
|
||||
click_button 'Update milestone'
|
||||
@@ -56,6 +58,64 @@ feature "Translations" do
|
||||
expect(page).to have_content("Descripción correcta en Español")
|
||||
end
|
||||
|
||||
scenario "Remove a translation", :js do
|
||||
visit @edit_milestone_url
|
||||
|
||||
click_link "Español"
|
||||
click_link "Remove language"
|
||||
|
||||
expect(page).not_to have_link "Español"
|
||||
|
||||
click_button "Update milestone"
|
||||
visit @edit_milestone_url
|
||||
expect(page).not_to have_link "Español"
|
||||
end
|
||||
|
||||
context "Globalize javascript interface" do
|
||||
|
||||
scenario "Highlight current locale", :js do
|
||||
visit @edit_milestone_url
|
||||
|
||||
expect(find("span .js-globalize-locale-link.highlight")).to have_content "English"
|
||||
|
||||
select('Español', from: 'locale-switcher')
|
||||
|
||||
expect(find("span .js-globalize-locale-link.highlight")).to have_content "Español"
|
||||
end
|
||||
|
||||
scenario "Highlight selected locale", :js do
|
||||
visit @edit_milestone_url
|
||||
|
||||
expect(find("span .js-globalize-locale-link.highlight")).to have_content "English"
|
||||
|
||||
click_link "Español"
|
||||
|
||||
expect(find("span .js-globalize-locale-link.highlight")).to have_content "Español"
|
||||
end
|
||||
|
||||
scenario "Show selected locale form", :js do
|
||||
visit @edit_milestone_url
|
||||
|
||||
expect(page).to have_field('budget_investment_milestone_description_en', with: 'Description in English')
|
||||
|
||||
click_link "Español"
|
||||
|
||||
expect(page).to have_field('budget_investment_milestone_description_es', with: 'Descripción en Español')
|
||||
end
|
||||
|
||||
scenario "Select a locale and add it to the milestone form", :js do
|
||||
visit @edit_milestone_url
|
||||
|
||||
select "Français", from: "translation_locale"
|
||||
|
||||
expect(page).to have_link "Français"
|
||||
|
||||
click_link "Français"
|
||||
|
||||
expect(page).to have_field('budget_investment_milestone_description_fr')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user