From eea130381a0b38655ea84354227e93303b9b5bbb Mon Sep 17 00:00:00 2001 From: "ryasmeen@wikimedia.org" Date: Wed, 28 Jan 2015 11:36:36 -0800 Subject: [PATCH] [BrowserTest] Updating test for Media Settings interface Fixed the following: 1.The workflow was incomplete and incorporated new changes 2.Wrong css pointer to the first image 3.The Given statement was defined as When in step definition file 4.Removed unnecessary/obsolete steps that was making the test to fail while we can verify the basic functionality with miminum steps. Change-Id: Ic8a265678900ed52bbed6d90e971d6c016ef610d --- Gemfile | 2 +- Gemfile.lock | 2 +- .../features/media_general_settings.feature | 27 +++++++++++++++++++ .../browser/features/media_interface.feature | 10 +++---- .../step_definitions/media_interface_steps.rb | 10 ++++++- .../support/pages/visual_editor_page.rb | 8 +++--- 6 files changed, 47 insertions(+), 12 deletions(-) create mode 100644 modules/ve-mw/tests/browser/features/media_general_settings.feature diff --git a/Gemfile b/Gemfile index ba0171c4b2..f88eecd483 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,6 @@ source 'https://rubygems.org' gem 'chunky_png' gem 'mediawiki_api' -gem 'mediawiki_selenium' +gem 'mediawiki_selenium', '~> 0.4.1' gem 'rspec' gem 'rubocop', require: false diff --git a/Gemfile.lock b/Gemfile.lock index b50ab792d6..97379f4d79 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -101,6 +101,6 @@ PLATFORMS DEPENDENCIES chunky_png mediawiki_api - mediawiki_selenium + mediawiki_selenium (~> 0.4.1) rspec rubocop diff --git a/modules/ve-mw/tests/browser/features/media_general_settings.feature b/modules/ve-mw/tests/browser/features/media_general_settings.feature new file mode 100644 index 0000000000..12e096a340 --- /dev/null +++ b/modules/ve-mw/tests/browser/features/media_general_settings.feature @@ -0,0 +1,27 @@ +@en.wikipedia.beta.wmflabs.org @firefox @internet_explorer_10 @login @safari @test2.wikipedia.org +Feature: VisualEditor Media Interface + + Background: + Given I go to the "Media Interface VisualEditor Test" page with content "Media Interface VisualEditor Test" + And I click in the editable part + + Scenario Outline: VisualEditor insert new media + Given I click Media + And I enter into media Search box + And I select an Image + And I click Use this image + + When I fill in the text area for caption with "caption" + And I fill in the test area for alternative text with "alt text" + And I click "Insert" + And I click Save page + And I click Review your changes + Then diff view should show proper caption and alt text + + + + Examples: + | search_term | expected_markup_text | + | San Francisco | [[File:California county map (San Francisco County highlighted).svg\|thumb\|150x150px]] | + | Flash video | [[File:Flash video file icon.png\|thumb\|32x32px]] | + | cunfrunti | [[File:Cunfrunti.mpg.OGG\|thumb\|183x183px]] | diff --git a/modules/ve-mw/tests/browser/features/media_interface.feature b/modules/ve-mw/tests/browser/features/media_interface.feature index 89dfa94f49..e846945ba4 100644 --- a/modules/ve-mw/tests/browser/features/media_interface.feature +++ b/modules/ve-mw/tests/browser/features/media_interface.feature @@ -9,14 +9,12 @@ Feature: VisualEditor Media Interface Given I click Media And I enter into media Search box And I select an Image - When I click Save page the second time + And I click Use this image + And I click Insert And I click Save page And I click Review your changes Then should appear in the media diff view And I can click the X on the media save box Examples: - | search_term | expected_markup_text | - | San Francisco | [[File:California county map (San Francisco County highlighted).svg\|thumb\|150x150px]] | - | Flash video | [[File:Flash video file icon.png\|thumb\|32x32px]] | - | cunfrunti | [[File:Cunfrunti.mpg.OGG\|thumb\|183x183px]] | - + | search_term | expected_markup_text | + | bug | [[File:Folgers.ogv\|thumb]] | diff --git a/modules/ve-mw/tests/browser/features/step_definitions/media_interface_steps.rb b/modules/ve-mw/tests/browser/features/step_definitions/media_interface_steps.rb index ef54f6fa25..11dea2baeb 100644 --- a/modules/ve-mw/tests/browser/features/step_definitions/media_interface_steps.rb +++ b/modules/ve-mw/tests/browser/features/step_definitions/media_interface_steps.rb @@ -13,7 +13,15 @@ When(/^I enter (.+) into media Search box$/) do |content| end When(/^I select an Image$/) do - on(VisualEditorPage).media_select_element.when_present.click + on(VisualEditorPage).media_select_element.when_present(20).click +end + +When (/^I click Use this image/) do + on(VisualEditorPage).use_image_button_element.when_present.click +end + +When (/^I click Insert$/) do + on(VisualEditorPage).media_insert_button_element.when_present.click end Then(/^(.+) should appear in the media diff view$/) do |headings_string| 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 5b9a865bfe..56598efb09 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 @@ -85,8 +85,10 @@ class VisualEditorPage figure(:media_image, index: 0) span(:media_insert_menu, class: 'oo-ui-tool-name-media') text_field(:media_search, css: 'div.oo-ui-textInputWidget > input') - div(:media_select, class: 've-ui-mwMediaResultWidget-overlay') + div(:media_select, css: 'div.ve-ui-mwMediaResultWidget-row:nth-child(1) > div:nth-child(1) > div:nth-child(3)') div(:medium_dialog, class: 'oo-ui-window oo-ui-dialog oo-ui-dialog-open oo-ui-dialog-medium') + span(:use_image_button, css: '.oo-ui-processDialog-actions-primary > div:nth-child(1) > a:nth-child(1) > span:nth-child(2)') + span(:media_insert_button, css: '.oo-ui-flaggedElement-constructive > a:nth-child(1) > span:nth-child(2)') checkbox(:minor_edit, id: 'wpMinoredit') div(:no_unused_fields, text: 'No unused fields') a(:new_link, class: 've-ce-linkAnnotation ve-ce-mwInternalLinkAnnotation new') @@ -121,10 +123,10 @@ class VisualEditorPage div(:references_title, class: 'oo-ui-processDialog-location', text: /References/) a(:remove_parameter, css: '.ve-ui-mwParameterPage-removeButton > a:nth-child(1)') span(:return_to_save, class: 'oo-ui-labelElement-label', text: 'Return to save form') - a(:review_changes, css: '.oo-ui-processDialog-actions-other > div:nth-child(1) > a:nth-child(1)') + a(:review_changes, css: '.oo-ui-window-content-setup > div:nth-child(3) > div:nth-child(1) > div:nth-child(1) > a:nth-child(1)') span(:review_failed, text: 'No changes to review') div(:right_navigation, id: 'p-views') - a(:save_page, css: '.ve-init-mw-viewPageTarget-toolbar-actions .oo-ui-buttonElement-button') + a(:save_page, css: '.oo-ui-flaggedElement-progressive > a:nth-child(1)') div(:save_enabled, css: 'div.ve-init-mw-viewPageTarget-toolbar-actions > div.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled') a(:second_reference, text: '[1]', index: 2) span(:second_save_page, css: '.oo-ui-processDialog-actions-primary > div:nth-child(1) > a:nth-child(1) > span:nth-child(2)')