[BrowserTest] Added lots of new scenarios for language screenshot

Bug: 62737
Change-Id: If30a9acbe772b76f8a2656ccf3f219dbede9853c
This commit is contained in:
vikassy 2014-07-15 18:05:06 +05:30
parent 72fa906d9f
commit 27390478b9
3 changed files with 344 additions and 3 deletions

View file

@ -11,3 +11,114 @@ Feature: Language Screenshot
When I click the text style menu
Then I should see Formatting pull-down menu
Scenario: VisualEditor_More_Settings
Given I am editing a random page
When I click the hamburger menu
Then I should see pull-down menu containing Page Settings
Scenario: VisualEditor_Insert_Menu
Given I am editing a random page
When I click on the Insert menu
Then I should see Insert pull-down menu
Scenario: VisualEditor_Toolbar_SpecialCharacters
Given I am editing a random page
When I click on the Special character option in Insert menu
Then I should see Special character Insertion window
@login
Scenario: VisualEditor_save_dialog
Given I am logged in
And I am edit a random page with Testing Save
When I click Save page
Then I should see save changes dialog box
Scenario: VisualEditor_Page_Settings
Given I am editing a random page
And I click the hamburger menu
When I click on Page settings option
Then I should see Page settings dialog box
Scenario: VisualEditor_Toolbar_Lists_and_indentation
Given I go to the "Indent Outdent Screenshot" page with source content "Indent Outdent Screenshot"
And I make the text "Indent Outdent" be selected
When I click Bullets
And I click on list and indentation dropdown
Then I should see list and indentation dropdown
Scenario: VisualEditor_External_link
Given I go to the "Links VisualEditor Screenshot" page with source content "Links VisualEditor Screenshot"
And I click in the editable part
And I click the Link button
When I enter http://www.mediawiki.org into link Content box
Then I should see link Content box with dropdown options
Scenario: VisualEditor_Link_editing_inline
Given I go to the "Links VisualEditor Screenshot" page with source content "Links VisualEditor Screenshot"
And I click in the editable part
And I click the Link button
When I enter VisualEditor into link Content box
Then I should see link Content box with dropdown options
Scenario: VisualEditor_Link_editing_inline_icon
Given I go to the "Links VisualEditor LanguageScreenshot Test" page with source content "[[VisualEditor]] is a extension."
And I click in the editable part
Then I should see link icon
Scenario: VisualEditor_Media_editing
Given I go to the "Media Interface Screenshot" page with source content "Media Interface Screenshot"
And I click in the editable part
And I click Media
When I enter San Francisco into media Search box
Then I should see media editing dialog box
Scenario: VisualEditor_Media_caption_editing
Given I go to the "Media Interface Screenshot" page with source content "Media Interface Screenshot"
And I select an image by searching San Francisco in Media option
And I enter "San Francisco" in alternative text
When I enter "San Francisco is located on the West Coast of the United States" in caption text box
Then I should see media caption dialog box
Scenario: VisualEditor_Media_advanced_settings
Given I go to the "Media Interface Screenshot" page with source content "Media Interface Screenshot"
And I select an image by searching San Francisco in Media option
When I click on Advanced Settings tab
Then I should see media advanced settings dialog box
Scenario: VisualEditor_Media_icon
Given I go to the "Media Interface Screenshot" page which has a media image
And I select the image in VisualEditor
Then I should see media in VisualEditor
Scenario: VisualEditor_Cite_Pulldown
Given I am editing a random page
When I click on Cite menu
Then I should see Cite dropdown menu
Scenario: VisualEditor_References_icon
Given I go to "Reference VisualEditor Screenshot" page which has references
When I send right arrow times 39
Then I should see Reference icon
Scenario: VisualEditor_References_edit
Given I go to the "Reference VisualEditor Screenshot" page with source content "VisualEditor is a MediaWiki extension"
And I click on Cite menu
When I click on Basic Reference in Cite menu dropdown
Then I should see Basic Reference dialog box
Scenario: VisualEditor_edit_tab
Given I am logged in
When I am at a random page
Then I should see the right edit tab
Scenario: VisualEditor_toolbar
Given I am logged in
When I am editing a random page
Then I should see the VisualEditor tool-bar
Scenario: VisualEditor_category_editing
Given I am editing a random page
When I click on category in hamburger menu
Then I should see category dialog box

View file

@ -1,9 +1,105 @@
Given(/^I go to the "(.*?)" page which has a media image$/) do |page_title|
wikitext = "[[File:2012-07-18 Market Street - San Francisco.webm|thumb]]"
step "I go to the \"#{page_title}\" page with source content \"#{wikitext}\""
end
Given(/^I select the image in VisualEditor$/) do
step "I click in the editable part"
on(VisualEditorPage).content_element.send_keys :arrow_left
end
Given (/^I go to "(.+)" page which has references$/) do |page_title|
wikitext = "VisualEditor is a MediaWiki extension.<ref>[http://www.mediawiki.org/wiki/Extension:VisualEditor Extension:VisualEditor]</ref>"
on(APIPage).create page_title, wikitext
step "I go to the #{page_title} page"
step "I click in the editable part"
end
Given(/^I go to the "(.*?)" page with source content "(.*?)"$/) do |page_title, page_content|
on(APIPage).create page_title, page_content
step "I go to the #{page_title} page"
end
Given(/^I go to the (.+) page$/) do |page_name|
step "I am on the #{page_name} page"
@browser.goto "#{@browser.url}&uselang=#{ENV['LANGUAGE_SCREENSHOT_CODE']}"
end
Given(/^I am editing a random page$/) do
step "I am at a random page"
@browser.goto "#{@browser.url}?uselang=#{ENV['LANGUAGE_SCREENSHOT_CODE']}&vehidebetadialog=true&veaction=edit"
step "I click in the editable part"
end
Given(/^I am edit a random page with (.+)$/) do |content|
step "I am editing a random page"
step "I edit the page with #{content}"
end
Given(/^I select an image by searching (.+) in Media option$/) do |content|
step "I click in the editable part"
step "I click Media"
step "I enter San Francisco into media Search box"
step "I select an Image"
end
Given(/^I enter "(.*?)" in alternative text$/) do |content|
on(VisualEditorPage).media_alternative_text_element.when_present.send_keys content
end
When(/^I click on the Insert menu$/) do
on(VisualEditorPage).insert_menu_element.when_present.click
end
When(/^I click on the Special character option in Insert menu$/) do
step "I click on the Insert menu"
on(VisualEditorPage).special_character_element.when_present.click
end
When (/^I click on list and indentation dropdown$/) do
on(VisualEditorPage).bullet_number_selector_element.when_present.click
end
When(/^I click on Page settings option$/) do
on(VisualEditorPage).page_settings_element.when_present.click
end
When(/^^I enter "(.*?)" in caption text box$/) do |content|
on(VisualEditorPage).content_box_element.when_present(2).send_keys content
end
When(/^I click on Advanced Settings tab$/) do
on(VisualEditorPage).media_advanced_settings_element.when_present.click
end
When(/^I click on Insert media button$/) do
on(VisualEditorPage).insert_media_element.when_present.click
end
When(/^I click on Cite menu$/) do
on(VisualEditorPage).cite_menu_element.when_present.click
end
When(/^I send right arrow times (\d+)$/) do |number|
number.to_i.times do
on(VisualEditorPage).content_element.send_keys :arrow_right
on(VisualEditorPage).content_element.fire_event("onblur") #gerrit 86800/86801
end
end
When(/^I click on Basic Reference in Cite menu dropdown$/) do
on(VisualEditorPage).basic_reference_element.when_present.click
end
When(/^I click on category in hamburger menu$/) do
step "I click the hamburger menu"
on(VisualEditorPage).category_link_element.when_present.click
end
Then(/^I should see category dialog box$/) do
on(VisualEditorPage).iframe_element.when_present.should be_visible
end
Then(/^I should see Headings pull-down menu$/) do
on(VisualEditorPage).heading_dropdown_menus_element.when_present.should be_visible
step "I take screenshot of pull-dowm menu"
@ -21,3 +117,106 @@ end
Then(/^I take screenshot of Formatting pull-down menu$/) do
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.ve_text_style_element,@current_page.formatting_option_menus_element])
end
Then(/^I should see pull-down menu containing Page Settings$/) do
on(VisualEditorPage).page_settings_element.when_present.should be_visible
step "I take screenshot of Visual Editor insert menu"
end
Then(/^I take screenshot of Visual Editor insert menu$/) do
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.tools_menu_element, @current_page.page_option_menu_element])
end
Then(/^I should see Insert pull-down menu$/) do
on(VisualEditorPage).insert_pull_down_element.when_present.should be_visible
step "I take screenshot of insert pull-down menu"
end
Then(/^I take screenshot of insert pull-down menu$/) do
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.insert_menu_element, @current_page.insert_pull_down_element])
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])
end
Then(/^I should see save changes 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 Page settings 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])
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_TOC-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.table_of_contents_element], @current_page.iframe_element, 0)
capture_screenshot("VisualEditor_Page_Settings_Edit_Links-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.page_settings_editlinks_element], @current_page.iframe_element, 0)
end
Then(/^I should see list and indentation dropdown$/) do
on(VisualEditorPage).indentation_pull_down_element.when_present.should be_visible
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.indentation_pull_down_element, @current_page.bullet_number_selector_element], nil, 3)
end
Then(/^I should see link Content box with dropdown options$/) do
on(VisualEditorPage).link_list_element.when_present(5).should be_visible
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.link_list_element, @current_page.iframe_element, @current_page.new_link_element], nil, 0)
end
Then(/^I should see link icon$/) do
on(VisualEditorPage).popup_icon_element.when_present(5).should be_visible
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.popup_icon_element, @current_page.internal_link_element])
end
Then(/^I should see media editing 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 media caption 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], nil, 0)
capture_screenshot("VisualEditor_Media_alternative_text-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.media_alternative_block_element], @current_page.iframe_element)
end
Then(/^I should see media advanced settings 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], nil, 0)
end
Then(/^I should see media in VisualEditor$/) do
on(VisualEditorPage).media_image_element.when_present.should be_visible
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.media_image_element, @current_page.media_caption_element])
end
Then (/^I should see Cite dropdown menu$/) do
on(VisualEditorPage).cite_pull_down_element.when_present.should be_visible
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.cite_pull_down_element, @current_page.cite_menu_element])
end
Then(/^I should see Reference icon$/) do
on(VisualEditorPage).popup_icon_element.when_present.should be_visible
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.popup_icon_element, @current_page.first_reference_element])
end
Then(/^I should see Basic Reference 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 the right edit tab$/) do
on(VisualEditorPage).right_navigation_element.when_present.should be_visible
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.right_navigation_element, @current_page.left_navigation_element])
end
Then(/^I should see the VisualEditor tool-bar$/) do
on(VisualEditorPage).toolbar_element.when_present.should be_visible
capture_screenshot("#{@scenario.name}-#{ENV['LANGUAGE_SCREENSHOT_CODE']}.png", [@current_page.right_navigation_element, @current_page.left_navigation_element, @current_page.toolbar_element])
end

View file

@ -13,7 +13,7 @@ class VisualEditorPage
a(:heading, text: /Heading/)
span(:hamburger_menu, css: "div.oo-ui-listToolGroup:nth-child(2) > span:nth-child(1) > span:nth-child(3)")
span(:increase_indentation, class: "oo-ui-iconedElement-icon oo-ui-icon-indent-list")
span(:insert_menu, text: "Insert")
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-labeledElement-label", text: "Looks good to me")
@ -26,7 +26,7 @@ class VisualEditorPage
a(:preformatted, text: /Preformatted/)
span(:refs_link, text: "Reference")
div(:save_disabled, class: "oo-ui-widget oo-ui-widget-disabled oo-ui-flaggableElement-constructive oo-ui-.oo-ui-buttonedElement-framed")
span(:save_page, class: "oo-ui-labeledElement-label", text: "Save page")
a(:save_page, css: "div.ve-ui-toolbar-saveButton > a.oo-ui-buttonedElement-button")
a(:subheading1, text: /Sub-heading 1/)
a(:subheading2, text: /Sub-heading 2/)
a(:subheading3, text: /Sub-heading 3/)
@ -34,6 +34,21 @@ class VisualEditorPage
span(:switch_to_source_editing, class: "oo-ui-iconedElement-icon oo-ui-icon-source")
div(:heading_dropdown_menus, class: "oo-ui-toolGroup-tools oo-ui-clippableElement-clippable")
div(:formatting_option_menus, class: "oo-ui-toolGroup-tools oo-ui-clippableElement-clippable", index: 1)
span(:page_settings, class: "oo-ui-iconedElement-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)
span(:special_character, class: "oo-ui-iconedElement-icon oo-ui-icon-special-character")
div(:iframe, class: "oo-ui-window-frame")
image(:media_image, class: "ve-ce-focusableNode-highlight-relocatable-marker")
unordered_list(:media_caption, class: "ve-ui-contextMenuWidget")
span(:cite_menu, class: "oo-ui-popupToolGroup-handle", index: 2)
div(:cite_pull_down, class: "oo-ui-toolGroup-tools oo-ui-clippableElement-clippable", index: 2)
div(:right_navigation, id: "p-views")
div(:left_navigation, id: "left-navigation")
div(:toolbar, class: "ve-init-mw-viewPageTarget-toolbar")
span(:category_link, class: "oo-ui-iconedElement-icon oo-ui-icon-tag")
if ENV["BROWSER"] == "chrome"
div(:tools_menu, class: "oo-ui-widget oo-ui-widget-enabled oo-ui-toolGroup oo-ui-iconedElement oo-ui-popupToolGroup oo-ui-listToolGroup")
@ -60,6 +75,11 @@ class VisualEditorPage
text_area(:wikitext_editor, id: "wpTextbox1")
a(:first_reference, text: "[1]", index: 1)
a(:second_reference, text: "[1]", index: 2)
unordered_list(:link_list, class: 'oo-ui-widget oo-ui-widget-enabled oo-ui-selectWidget oo-ui-selectWidget-depressed oo-ui-clippableElement-clippable oo-ui-menuWidget oo-ui-textInputMenuWidget oo-ui-lookupWidget-menu ve-ui-mwLinkTargetInputWidget-menu')
a(:new_link, class: "ve-ce-LinkAnnotation ve-ce-mwInternalLinkAnnotation new")
a(:internal_link, class: "ve-ce-LinkAnnotation ve-ce-mwInternalLinkAnnotation")
unordered_list(:popup_icon, class: "ve-ui-context-menu")
span(:basic_reference, class: "oo-ui-iconedElement-icon oo-ui-icon-reference")
in_iframe(index: 0) do |frame|
a(:beta_warning, title: "Close", frame: frame)
@ -85,7 +105,7 @@ class VisualEditorPage
span(:ex, text: "Return to save form", frame: frame)
span(:insert_references_list, text: "Insert references list", frame: frame)
span(:media_apply_changes, text: "Insert media", frame: frame)
text_field(:media_search, placeholder: "Search for media", frame: frame)
text_field(:media_search, css: "div.oo-ui-textInputWidget > input", frame: frame)
div(:media_select, class: "ve-ui-mwMediaResultWidget-overlay", frame: frame)
checkbox(:minor_edit, id: "wpMinoredit", frame: frame)
text_field(:parameter_box, index: 0, frame: frame)
@ -97,12 +117,23 @@ class VisualEditorPage
div(:review_failed, class: "oo-ui-window-head", frame: frame)
span(:second_save_page, class: "oo-ui-labeledElement-label", text: "Save page", frame: frame)
unordered_list(:suggestion_list, class: "ve-ui-mwTitleInputWidget-menu", frame: frame)
div(:template_header, class: "ve-ui-mwTransclusionDialog-single", frame: frame)
li(:template_list_item, text: "S", frame: frame)
div(:title, class: "oo-ui-processDialog-location", frame: frame)
text_area(:transclusion_textarea, index: 0, frame: frame)
text_field(:transclusion_textfield, index: 0, frame: frame)
span(:existing_reference, text: "Use an existing reference", frame: frame)
div(:extension_reference, class: "ve-ui-mwReferenceResultWidget-shield", frame: frame)
div(:page_settings_heading, class: "oo-ui-labeledElement-label", frame: frame)
div(:redirect_page_option, class: "oo-ui-layout oo-ui-labeledElement oo-ui-fieldLayout oo-ui-fieldLayout-align-inline", frame: frame)
div(:target_redirect, class: "oo-ui-layout oo-ui-fieldLayout oo-ui-fieldLayout-align-top oo-ui-fieldLayout-disabled", frame: frame)
div(:prevent_redirect, class: "oo-ui-layout oo-ui-labeledElement oo-ui-fieldLayout oo-ui-fieldLayout-align-inline oo-ui-fieldLayout-disabled", frame: frame)
div(:table_of_contents, class: "oo-ui-layout oo-ui-labeledElement oo-ui-fieldLayout oo-ui-fieldLayout-align-top", frame: frame)
div(:page_settings_editlinks, class: "oo-ui-layout oo-ui-labeledElement 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-iconedElement oo-ui-labeledElement 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-iconedElement oo-ui-labeledElement", frame: frame)
a(:insert_media, css: "div.oo-ui-processDialog-actions-primary > div.oo-ui-buttonedElement-frameless > a", frame: frame)
end
# not having beta warning makes iframes off by one