From 901b0deeeda31e3f9b681d77fe9ebb0cebeabc2c Mon Sep 17 00:00:00 2001 From: Vikas S Yaligar Date: Thu, 6 Nov 2014 17:53:11 +0530 Subject: [PATCH] [BrowserTest] Fixed failing language screenshot browser tests Bug: 73033 Change-Id: Iea3a03b1ec628bfe03f10b4cb2a4795d4fabb8bc --- .../language_screenshot_steps.rb | 17 ++++++++++---- .../support/pages/visual_editor_page.rb | 23 ++++++++++--------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/modules/ve-mw/tests/browser/features/step_definitions/language_screenshot_steps.rb b/modules/ve-mw/tests/browser/features/step_definitions/language_screenshot_steps.rb index ebc0b18e78..87e566e2ed 100644 --- a/modules/ve-mw/tests/browser/features/step_definitions/language_screenshot_steps.rb +++ b/modules/ve-mw/tests/browser/features/step_definitions/language_screenshot_steps.rb @@ -56,6 +56,7 @@ end When(/^I click on the Special character option in Insert menu$/) do step "I click on the Insert menu" + step "I click on More in insert pull-down menu" on(VisualEditorPage).special_character_element.when_present.click end @@ -114,12 +115,15 @@ When(/^I go to random page for screenshot$/) do end When(/^I click on References list in Insert menu$/) do + step "I click in the editable part" step "I click on the Insert menu" + step "I click on More in insert pull-down menu" on(VisualEditorPage).ve_references_element.when_present.click end Then(/^I should see category dialog box$/) do on(VisualEditorPage).iframe_element.when_present.should be_visible + capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.iframe_element]) end Then(/^I should see Headings pull-down menu$/) do @@ -155,6 +159,7 @@ Then(/^I should see Insert pull-down menu$/) do end Then(/^I take screenshot of insert pull-down menu$/) do + step "I click on More in insert pull-down menu" capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.insert_menu_element, @current_page.insert_pull_down_element]) highlight @current_page.media_insert_menu_element @@ -173,6 +178,10 @@ Then(/^I take screenshot of insert pull-down menu$/) do capture_screenshot("VisualEditor_Formula_Insert_Menu-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.insert_menu_element, @current_page.insert_pull_down_element], nil, 0) end +Then(/^I click on More in insert pull-down menu$/) do + on(VisualEditorPage).ve_more_references_options_element.when_present.click +end + Then(/^I should see Special character Insertion window$/) do on(VisualEditorPage).iframe_element.when_present.should be_visible capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.iframe_element], nil, -2) @@ -188,13 +197,13 @@ Then(/^I should see Page settings dialog box$/) do capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.iframe_element], nil, 0) - capture_screenshot("VisualEditor_Page_Settings_Redirects-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.page_settings_heading_element, @current_page.prevent_redirect_element], @current_page.iframe_element, 0) + capture_screenshot("VisualEditor_Page_Settings_Redirects-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.page_settings_icon_element, @current_page.prevent_redirect_element], nil, 0) - capture_screenshot("VisualEditor_Page_Settings_TOC-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.table_of_contents_element], @current_page.iframe_element, 0) + capture_screenshot("VisualEditor_Page_Settings_TOC-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.table_of_contents_element], nil, 0) - capture_screenshot("VisualEditor_Page_Settings_Edit_Links-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.page_settings_editlinks_element], @current_page.iframe_element, 0) + capture_screenshot("VisualEditor_Page_Settings_Edit_Links-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.page_settings_editlinks_element], nil, 0) - capture_screenshot("VisualEditor_Apply_Changes-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.settings_apply_button_element], @current_page.iframe_element, 3) + capture_screenshot("VisualEditor_Apply_Changes-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.settings_apply_button_element], nil, 3) end Then(/^I should see list and indentation dropdown$/) do 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 d7f0710d30..7e57465043 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 @@ -26,8 +26,8 @@ class VisualEditorPage 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") - span(:option_advanced_settings, class:"oo-ui-tool-title", text:"Advanced settings") - span(:option_page_settings, class:"oo-ui-tool-title", text:"Page settings") + span(:option_advanced_settings, class: "oo-ui-tool-title", text: "Advanced settings") + span(:option_page_settings, class: "oo-ui-tool-title", text: "Page settings") div(:page_text, id: "mw-content-text") a(:page_title, text: /Page title/) a(:paragraph, text: /Paragraph/) @@ -46,9 +46,9 @@ class VisualEditorPage span(:page_settings, class: "oo-ui-iconElement-icon oo-ui-icon-settings") div(:indentation_pull_down, class: "oo-ui-toolGroup-tools oo-ui-clippableElement-clippable", index: 3) div(:insert_pull_down, class: "oo-ui-toolGroup-tools oo-ui-clippableElement-clippable", index: 4) - div(:page_option_menu, class: "oo-ui-toolGroup-tools oo-ui-clippableElement-clippable", index: 5) + div(:page_option_menu, class: "oo-ui-toolGroup-tools oo-ui-clippableElement-clippable", index: 6) span(:special_character, class: "oo-ui-iconElement-icon oo-ui-icon-special-character") - div(:iframe, class: "oo-ui-window-frame") + div(:iframe, css: "div.oo-ui-window-setup > div.oo-ui-window-frame") figure(:media_image, index: 0) unordered_list(:media_caption, class: "ve-ui-contextMenuWidget") span(:cite_menu, class: "oo-ui-popupToolGroup-handle", index: 2) @@ -121,7 +121,7 @@ class VisualEditorPage #text_field(:cite_custom_field_name, css: ".oo-ui-textInputWidget-decorated > input:nth-child(1)", frame: frame) text_field(:cite_custom_field_name, css: ".oo-ui-searchWidget-query > div:nth-child(1) > input:nth-child(1)") - div(:cite_group_name_textarea, class: "oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-indicatorElement oo-ui-textInputWidget" ) + div(:cite_group_name_textarea, class: "oo-ui-widget oo-ui-widget-enabled oo-ui-inputWidget oo-ui-indicatorElement oo-ui-textInputWidget") text_area(:cite_new_website_field, css: "div.oo-ui-layout:nth-child(10) > div:nth-child(3) > div:nth-child(1) > textarea:nth-child(1)") div(:cite_new_field_label, css: ".oo-ui-optionWidget") div(:cite_show_more_fields, class: "ve-ui-mwMoreParametersResultWidget-label") @@ -158,6 +158,13 @@ class VisualEditorPage span(:ex, text: "Return to save form") text_area(:describe_change, index: 0) + #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") + label(:table_of_contents, class: "oo-ui-layout oo-ui-labelElement oo-ui-fieldLayout oo-ui-fieldLayout-align-top", index: 1) + label(:page_settings_editlinks, class: "oo-ui-layout oo-ui-labelElement oo-ui-fieldLayout oo-ui-fieldLayout-align-inline", index: 4) + div(:settings_apply_button, class: "oo-ui-widget oo-ui-widget-enabled oo-ui-buttonElement oo-ui-labelElement oo-ui-flaggedElement-primary oo-ui-buttonWidget oo-ui-actionWidget oo-ui-buttonElement-framed") + in_iframe(index: 0) do |frame| #ACTUALLY IS IN THE IFRAME: @@ -172,16 +179,10 @@ class VisualEditorPage div(:content_box, class: "ve-ce-documentNode ve-ce-branchNode", frame: frame) #ALSO USED IN LANGUAGE SCREENSHOT #USED IN LANGUAGE SCREENSHOT TEST: - span(:page_settings_heading, css: "div.oo-ui-fieldsetLayout > span.oo-ui-labelElement-label", frame: frame) - div(:prevent_redirect, class: "oo-ui-layout oo-ui-labelElement oo-ui-fieldLayout oo-ui-fieldLayout-align-inline oo-ui-fieldLayout-disabled", frame: frame) - div(:table_of_contents, class: "oo-ui-layout oo-ui-labelElement oo-ui-fieldLayout oo-ui-fieldLayout-align-top", frame: frame) - div(:page_settings_editlinks, class: "oo-ui-layout oo-ui-labelElement oo-ui-fieldLayout oo-ui-fieldLayout-align-inline", frame: frame) text_field(:media_alternative_text, css: "div.oo-ui-widget.oo-ui-widget-enabled.oo-ui-inputWidget.oo-ui-textInputWidget.ve-ui-mwMediaDialog-altText > input", frame: frame) div(:media_alternative_block, class: "oo-ui-layout oo-ui-iconElement oo-ui-labelElement oo-ui-fieldsetLayout", index: 1, frame: frame) list_item(:media_advanced_settings, class: "oo-ui-widget oo-ui-widget-enabled oo-ui-optionWidget oo-ui-decoratedOptionWidget oo-ui-outlineItemWidget oo-ui-outlineItemWidget-level-0 oo-ui-iconElement oo-ui-labelElement", frame: frame) a(:insert_media, css: "div.oo-ui-processDialog-actions-primary > div.oo-ui-buttonElement-frameless > a", frame: frame) text_area(:formula_area, class: "oo-ui-ltr", frame: frame) - div(:settings_apply_button, class: "oo-ui-processDialog-actions-primary", frame: frame) - end end