Commit ec697bcc authored by Rémy Coutable's avatar Rémy Coutable

Fix a nasty transient failure happening is a subsequent spec

See https://gitlab.com/gitlab-org/gitlab-ce/issues/34698#note_34276286
for the thorough explanation.
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent acb748a6
require 'spec_helper' require 'spec_helper'
feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do feature 'Projects > Wiki > User creates wiki page', :js do
let(:user) { create(:user) } let(:user) { create(:user) }
background do background do
project.team << [user, :master] project.team << [user, :master]
gitlab_sign_in(user) sign_in(user)
visit project_path(project) visit project_path(project.namespace, project)
find('.shortcuts-wiki').trigger('click')
end end
context 'in the user namespace' do context 'in the user namespace' do
let(:project) { create(:project, namespace: user.namespace) } let(:project) { create(:project, namespace: user.namespace) }
context 'when wiki is empty' do context 'when wiki is empty' do
before do
find('.shortcuts-wiki').trigger('click')
end
scenario 'commit message field has value "Create home"' do scenario 'commit message field has value "Create home"' do
expect(page).to have_field('wiki[message]', with: 'Create home') expect(page).to have_field('wiki[message]', with: 'Create home')
end end
...@@ -67,10 +70,11 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do ...@@ -67,10 +70,11 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do
context 'when wiki is not empty' do context 'when wiki is not empty' do
before do before do
WikiPages::CreateService.new(project, user, title: 'home', content: 'Home page').execute WikiPages::CreateService.new(project, user, title: 'home', content: 'Home page').execute
find('.shortcuts-wiki').trigger('click')
end end
context 'via the "new wiki page" page' do context 'via the "new wiki page" page' do
scenario 'when the wiki page has a single word name', js: true do scenario 'when the wiki page has a single word name' do
click_link 'New page' click_link 'New page'
page.within '#modal-new-wiki' do page.within '#modal-new-wiki' do
...@@ -91,7 +95,7 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do ...@@ -91,7 +95,7 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do
expect(page).to have_content('My awesome wiki!') expect(page).to have_content('My awesome wiki!')
end end
scenario 'when the wiki page has spaces in the name', js: true do scenario 'when the wiki page has spaces in the name' do
click_link 'New page' click_link 'New page'
page.within '#modal-new-wiki' do page.within '#modal-new-wiki' do
...@@ -112,7 +116,7 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do ...@@ -112,7 +116,7 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do
expect(page).to have_content('My awesome wiki!') expect(page).to have_content('My awesome wiki!')
end end
scenario 'when the wiki page has hyphens in the name', js: true do scenario 'when the wiki page has hyphens in the name' do
click_link 'New page' click_link 'New page'
page.within '#modal-new-wiki' do page.within '#modal-new-wiki' do
...@@ -134,7 +138,7 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do ...@@ -134,7 +138,7 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do
end end
end end
scenario 'content has autocomplete', :js do scenario 'content has autocomplete' do
click_link 'New page' click_link 'New page'
page.within '#modal-new-wiki' do page.within '#modal-new-wiki' do
...@@ -156,6 +160,10 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do ...@@ -156,6 +160,10 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do
let(:project) { create(:project, namespace: create(:group, :public)) } let(:project) { create(:project, namespace: create(:group, :public)) }
context 'when wiki is empty' do context 'when wiki is empty' do
before do
find('.shortcuts-wiki').trigger('click')
end
scenario 'commit message field has value "Create home"' do scenario 'commit message field has value "Create home"' do
expect(page).to have_field('wiki[message]', with: 'Create home') expect(page).to have_field('wiki[message]', with: 'Create home')
end end
...@@ -175,9 +183,10 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do ...@@ -175,9 +183,10 @@ feature 'Projects > Wiki > User creates wiki page', js: true, feature: true do
context 'when wiki is not empty' do context 'when wiki is not empty' do
before do before do
WikiPages::CreateService.new(project, user, title: 'home', content: 'Home page').execute WikiPages::CreateService.new(project, user, title: 'home', content: 'Home page').execute
find('.shortcuts-wiki').trigger('click')
end end
scenario 'via the "new wiki page" page', js: true do scenario 'via the "new wiki page" page' do
click_link 'New page' click_link 'New page'
page.within '#modal-new-wiki' do page.within '#modal-new-wiki' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment