Commit 00a6bd2c authored by Anastasia McDonald's avatar Anastasia McDonald

Rewrite link_line method for Web IDE E2E

To imitate user behaviour
by clicking the line and using url
instead of retrieving element value
parent cbd76096
...@@ -8,8 +8,6 @@ const createAnchor = (href) => { ...@@ -8,8 +8,6 @@ const createAnchor = (href) => {
const fragment = new DocumentFragment(); const fragment = new DocumentFragment();
const el = document.createElement('a'); const el = document.createElement('a');
el.classList.add('link-anchor'); el.classList.add('link-anchor');
el.setAttribute('data-qa-selector', 'line_link');
el.setAttribute('data-qa-number', href);
el.href = href; el.href = href;
fragment.appendChild(el); fragment.appendChild(el);
el.addEventListener('contextmenu', (e) => { el.addEventListener('contextmenu', (e) => {
......
...@@ -108,10 +108,6 @@ module QA ...@@ -108,10 +108,6 @@ module QA
element :file_to_commit_content element :file_to_commit_content
end end
view 'app/assets/javascripts/editor/extensions/editor_lite_extension_base.js' do
element :line_link
end
def has_file?(file_name) def has_file?(file_name)
within_element(:file_list) do within_element(:file_list) do
has_element?(:file_name_content, file_name: file_name) has_element?(:file_name_content, file_name: file_name)
...@@ -319,11 +315,15 @@ module QA ...@@ -319,11 +315,15 @@ module QA
end end
def link_line(line_number) def link_line(line_number)
previous_url = page.current_url
wait_for_animated_element(:editor_container) wait_for_animated_element(:editor_container)
within_element(:editor_container) do within_element(:editor_container) do
find('.line-numbers', text: line_number).hover find('.line-numbers', text: line_number).hover.click
find_element(:line_link, number: "#L#{line_number}")['href'].to_s end
wait_until(max_duration: 5, reload: false) do
page.current_url != previous_url
end end
page.current_url.to_s
end end
end end
end end
......
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