Commit d26735cb authored by Anastasia McDonald's avatar Anastasia McDonald

Rewrite snippet tests verification flow

Wait for title to appear
instead of waiting for page to load
See https://gitlab.com/gitlab-org/gitlab/-/issues/326624
parent 6fb28081
...@@ -77,7 +77,10 @@ module QA ...@@ -77,7 +77,10 @@ module QA
def click_create_snippet_button def click_create_snippet_button
wait_until(reload: false) { !find_element(:submit_button).disabled? } wait_until(reload: false) { !find_element(:submit_button).disabled? }
click_element(:submit_button, Page::Dashboard::Snippet::Show) click_element(:submit_button)
wait_until(reload: false) do
has_no_element?(:snippet_title_field)
end
end end
private private
......
...@@ -10,7 +10,7 @@ module QA ...@@ -10,7 +10,7 @@ module QA
super super
base.view 'app/assets/javascripts/snippets/components/snippet_title.vue' do base.view 'app/assets/javascripts/snippets/components/snippet_title.vue' do
element :snippet_title_content, required: true element :snippet_title_content
end end
base.view 'app/assets/javascripts/snippets/components/snippet_description_view.vue' do base.view 'app/assets/javascripts/snippets/components/snippet_description_view.vue' do
...@@ -87,7 +87,7 @@ module QA ...@@ -87,7 +87,7 @@ module QA
end end
def has_snippet_title?(snippet_title) def has_snippet_title?(snippet_title)
has_element? :snippet_title_content, text: snippet_title has_element?(:snippet_title_content, text: snippet_title, wait: 10)
end end
def has_snippet_description?(snippet_description) def has_snippet_description?(snippet_description)
......
...@@ -64,7 +64,10 @@ module QA ...@@ -64,7 +64,10 @@ module QA
def save_changes def save_changes
wait_until(reload: false) { !find_element(:submit_button).disabled? } wait_until(reload: false) { !find_element(:submit_button).disabled? }
click_element(:submit_button, Page::Dashboard::Snippet::Show) click_element(:submit_button)
wait_until(reload: false) do
has_no_element?(:file_name_field)
end
end end
private private
......
...@@ -9,7 +9,7 @@ module QA ...@@ -9,7 +9,7 @@ module QA
include Page::Component::BlobContent include Page::Component::BlobContent
view 'app/assets/javascripts/snippets/components/snippet_title.vue' do view 'app/assets/javascripts/snippets/components/snippet_title.vue' do
element :snippet_title_content, required: true element :snippet_title_content
end end
end end
end end
......
...@@ -22,7 +22,7 @@ module QA ...@@ -22,7 +22,7 @@ module QA
end end
it 'user creates a personal snippet', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347799' do it 'user creates a personal snippet', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347799' do
snippet.visit! snippet
Page::Dashboard::Snippet::Show.perform do |snippet| Page::Dashboard::Snippet::Show.perform do |snippet|
expect(snippet).to have_snippet_title('Snippet title') expect(snippet).to have_snippet_title('Snippet title')
......
...@@ -27,7 +27,7 @@ module QA ...@@ -27,7 +27,7 @@ module QA
end end
it 'creates a personal snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347723' do it 'creates a personal snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347723' do
snippet.visit! snippet
Page::Dashboard::Snippet::Show.perform do |snippet| Page::Dashboard::Snippet::Show.perform do |snippet|
expect(snippet).to have_snippet_title('Personal snippet with multiple files') expect(snippet).to have_snippet_title('Personal snippet with multiple files')
......
...@@ -22,7 +22,7 @@ module QA ...@@ -22,7 +22,7 @@ module QA
end end
it 'user creates a project snippet', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347798' do it 'user creates a project snippet', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347798' do
snippet.visit! snippet
Page::Dashboard::Snippet::Show.perform do |snippet| Page::Dashboard::Snippet::Show.perform do |snippet|
expect(snippet).to have_snippet_title('Project snippet') expect(snippet).to have_snippet_title('Project snippet')
......
...@@ -29,7 +29,7 @@ module QA ...@@ -29,7 +29,7 @@ module QA
end end
it 'creates a project snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347725' do it 'creates a project snippet with multiple files', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/347725' do
snippet.visit! snippet
Page::Dashboard::Snippet::Show.perform do |snippet| Page::Dashboard::Snippet::Show.perform do |snippet|
aggregate_failures 'file content verification' do aggregate_failures 'file content verification' 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