From 1aa5d8905b4e07c0b10b909ef0967834f3e6d919 Mon Sep 17 00:00:00 2001 From: Cmcmahon Date: Fri, 14 Nov 2014 10:55:50 -0700 Subject: [PATCH] [BrowserTest] remove sleeps from links test Change-Id: Ib0e09735331dadd5bb494fe87683f6f08b6aee31 --- .../tests/browser/features/links.feature | 6 ++--- .../features/step_definitions/links_steps.rb | 23 +++++++++++++++---- .../support/pages/visual_editor_page.rb | 5 ++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/modules/ve-mw/tests/browser/features/links.feature b/modules/ve-mw/tests/browser/features/links.feature index f6bab9c44c..208c692355 100644 --- a/modules/ve-mw/tests/browser/features/links.feature +++ b/modules/ve-mw/tests/browser/features/links.feature @@ -8,21 +8,21 @@ Feature: VisualEditor Links And I can see the Link User Inteface Scenario: Enter external link - When I enter http://www.example.com into link Content box + When I enter external link http://www.example.com into link Content box And I click Done to close Link User Interface And I click Save page And I click Review your changes Then an external link appears in the diff view Scenario: Enter internal link - When I enter Main Page into link Content box + When I enter internal link Main Page into link Content box And I click Done to close Link User Interface And I click Save page And I click Review your changes Then an internal link appears in the diff view Scenario: Enter non-existing link - When I enter DoesNotExist into link Content box + When I enter non existing link DoesNotExist into link Content box And I click Done to close Link User Interface And I click Save page And I click Review your changes diff --git a/modules/ve-mw/tests/browser/features/step_definitions/links_steps.rb b/modules/ve-mw/tests/browser/features/step_definitions/links_steps.rb index 119a790088..8b4e6dd272 100644 --- a/modules/ve-mw/tests/browser/features/step_definitions/links_steps.rb +++ b/modules/ve-mw/tests/browser/features/step_definitions/links_steps.rb @@ -14,15 +14,30 @@ When(/^I click Links Review your changes$/) do end When(/^I click the Link button$/) do - sleep 1 #Chrome seems to not honor when_present correctly as of 5 Dec 2013 on(VisualEditorPage).ve_link_icon_element.when_present.click end -When(/^I enter (.+) into link Content box$/) do |content| +When(/^I enter external link (.+) into link Content box$/) do |link_content| on(VisualEditorPage) do |page| page.link_textfield_element.when_present - page.link_textfield_element.send_keys(content) - sleep 1 + page.link_textfield_element.send_keys(link_content) + page.link_overlay_external_link_element.when_present + end +end + +When(/^I enter internal link (.+) into link Content box$/) do |link_content| + on(VisualEditorPage) do |page| + page.link_textfield_element.when_present + page.link_textfield_element.send_keys(link_content) + page.link_overlay_wiki_page_element.when_present + end +end + +When(/^I enter non existing link (.+) into link Content box$/) do |link_content| + on(VisualEditorPage) do |page| + page.link_textfield_element.when_present + page.link_textfield_element.send_keys(link_content) + page.link_overlay_does_not_exist_element.when_present end end diff --git a/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb b/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb index 8909849571..edee8ce5c7 100644 --- a/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb +++ b/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb @@ -23,6 +23,7 @@ class VisualEditorPage span(:insert_menu, class: "oo-ui-popupToolGroup-handle", index: 4) div(:insert_references, class: "oo-ui-processDialog-location") div(:ip_warning, class: "ve-ui-mwNoticesPopupTool-item") + span(:looks_good, class: "oo-ui-labelElement-label", text: "Looks good to me") div(:medium_dialog, class: "oo-ui-window oo-ui-dialog oo-ui-dialog-open oo-ui-dialog-medium") span(:options_in_hamburger, class: "oo-ui-tool-title", text: "Options") @@ -158,6 +159,10 @@ class VisualEditorPage span(:ex, text: "Return to save form") text_area(:describe_change, index: 0) + div(:link_overlay_does_not_exist, text: /New page/) + div(:link_overlay_external_link, text: /External link.+New page/m) + div(:link_overlay_wiki_page, text: /Matching page/) + #USED IN LANGUAGE SCREENSHOT TEST: span(:page_settings_icon, class: "oo-ui-iconElement-icon oo-ui-icon-settings", index: 2) label(:prevent_redirect, class: "oo-ui-layout oo-ui-labelElement oo-ui-fieldLayout oo-ui-fieldLayout-align-inline oo-ui-fieldLayout-disabled")