jenkins-bot has submitted this change and it was merged. Change subject: Moved tests from browsertests repository ......................................................................
Moved tests from browsertests repository See also the commit[1] that deletes the tests from browsertests repository and the commit[2] in mediawiki/selenium repository that documents changes in Jenkins jobs. 1: https://gerrit.wikimedia.org/r/#/c/112894/ 2: https://gerrit.wikimedia.org/r/#/c/112899/ 3: https://bugzilla.wikimedia.org/show_bug.cgi?id=49313#c2 Bug: 56419 Change-Id: Ifd6005bd1fd1a2ead6bd8c2d5194adafeed4b156 --- A CREDITS A tests/browser/Gemfile A tests/browser/Gemfile.lock A tests/browser/README.md A tests/browser/features/step_definitions/upload_wizard_steps.rb A tests/browser/features/support/env.rb A tests/browser/features/support/pages/describe_page.rb A tests/browser/features/support/pages/learn_page.rb A tests/browser/features/support/pages/release_rights_page.rb A tests/browser/features/support/pages/upload_page.rb A tests/browser/features/support/pages/upload_wizard_page.rb A tests/browser/features/support/pages/use_page.rb A tests/browser/features/upload_wizard.feature 13 files changed, 445 insertions(+), 0 deletions(-) Approvals: Cmcmahon: Looks good to me, approved jenkins-bot: Verified diff --git a/CREDITS b/CREDITS new file mode 100644 index 0000000..b42d366 --- /dev/null +++ b/CREDITS @@ -0,0 +1,15 @@ +MediaWiki UploadWizard is a collaborative project released under the +GNU General Public License v2. We would like to recognize the +following names for their contribution to the product. + +For further details on licensing, see the COPYING file. + +== Developers == +* Neil Kandalgaonkar +* Jeroen De Dauw +* Mark Holmquist +* Ryan Kaldari +* Michael Dale +* Ankur Anand +* Nischay Nahata +* Yuvi Panda diff --git a/tests/browser/Gemfile b/tests/browser/Gemfile new file mode 100755 index 0000000..8c620ac --- /dev/null +++ b/tests/browser/Gemfile @@ -0,0 +1,7 @@ +#ruby=ruby-2.1.0 +#ruby-gemset=UploadWizard + +source "https://rubygems.org" + +gem "chunky_png" +gem "mediawiki_selenium" diff --git a/tests/browser/Gemfile.lock b/tests/browser/Gemfile.lock new file mode 100644 index 0000000..1ddc40b --- /dev/null +++ b/tests/browser/Gemfile.lock @@ -0,0 +1,66 @@ +GEM + remote: https://rubygems.org/ + specs: + builder (3.2.2) + childprocess (0.4.0) + ffi (~> 1.0, >= 1.0.11) + chunky_png (1.3.0) + cucumber (1.3.10) + builder (>= 2.1.2) + diff-lcs (>= 1.1.3) + gherkin (~> 2.12) + multi_json (>= 1.7.5, < 2.0) + multi_test (>= 0.0.2) + data_magic (0.17) + faker (>= 1.1.2) + yml_reader (>= 0.2) + diff-lcs (1.2.5) + faker (1.2.0) + i18n (~> 0.5) + ffi (1.9.3) + gherkin (2.12.2) + multi_json (~> 1.3) + headless (1.0.1) + i18n (0.6.9) + json (1.8.1) + mediawiki_selenium (0.2.2) + cucumber (~> 1.3, >= 1.3.10) + headless (~> 1.0, >= 1.0.1) + json (~> 1.8, >= 1.8.1) + net-http-persistent (~> 2.9, >= 2.9.1) + page-object (~> 0.9, >= 0.9.5) + rest-client (~> 1.6, >= 1.6.7) + rspec-expectations (~> 2.14, >= 2.14.4) + syntax (~> 1.2, >= 1.2.0) + mime-types (2.1) + multi_json (1.8.4) + multi_test (0.0.3) + net-http-persistent (2.9.4) + page-object (0.9.6) + page_navigation (>= 0.9) + selenium-webdriver (>= 2.39.0) + watir-webdriver (>= 0.6.7) + page_navigation (0.9) + data_magic (>= 0.14) + rest-client (1.6.7) + mime-types (>= 1.16) + rspec-expectations (2.14.5) + diff-lcs (>= 1.1.3, < 2.0) + rubyzip (1.1.0) + selenium-webdriver (2.39.0) + childprocess (>= 0.2.5) + multi_json (~> 1.0) + rubyzip (~> 1.0) + websocket (~> 1.0.4) + syntax (1.2.0) + watir-webdriver (0.6.7) + selenium-webdriver (>= 2.18.0) + websocket (1.0.7) + yml_reader (0.2) + +PLATFORMS + ruby + +DEPENDENCIES + chunky_png + mediawiki_selenium diff --git a/tests/browser/README.md b/tests/browser/README.md new file mode 100644 index 0000000..3631949 --- /dev/null +++ b/tests/browser/README.md @@ -0,0 +1 @@ +Please see https://github.com/wikimedia/mediawiki-selenium for instructions on how to run tests. diff --git a/tests/browser/features/step_definitions/upload_wizard_steps.rb b/tests/browser/features/step_definitions/upload_wizard_steps.rb new file mode 100644 index 0000000..5898ea2 --- /dev/null +++ b/tests/browser/features/step_definitions/upload_wizard_steps.rb @@ -0,0 +1,87 @@ +# +# This file is subject to the license terms in the COPYING file found in the +# UploadWizard top-level directory and at +# https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/COPYING. No part of +# UploadWizard, including this file, may be copied, modified, propagated, or +# distributed except according to the terms contained in the COPYING file. +# +# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the +# UploadWizard top-level directory and at +# https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/CREDITS +# +When(/^click button Continue$/) do + on(UploadPage).continue_element.when_present(15).click +end +When(/^I click Next button$/) do + on(UploadWizardPage).next_element.when_present(15).click +end +When(/^I click Next button at Describe page$/) do + sleep 1 # todo # I can not figure out at the moment how to make this work without using sleep + on(DescribePage).next_element.when_present(15).click +end +When(/^I click Next button at Learn page$/) do + on(LearnPage).next_element.when_present(15).click +end +When(/^I click Next button at Release rights page$/) do + on(ReleaseRightsPage).next_element.when_present(15).click +end +When(/^I click This file is my own work$/) do + on(ReleaseRightsPage).select_my_own_work +end +When(/^I enter category$/) do + on(DescribePage).category = "Test" +end +When(/^I enter description$/) do + on(DescribePage).description = "description" +end +When(/^I enter title$/) do + on(DescribePage).title = "Title #{Random.new.rand}" +end +When(/^I navigate to Upload Wizard$/) do + visit UploadWizardPage +end +When(/^thumbnail should be visible$/) do + on(ReleaseRightsPage).thumbnail_element.when_present.should be_visible +end +When(/^upload file (.+)$/) do |file_name| + require "tempfile" + path = "#{Dir.tmpdir}/#{file_name}" + + require "chunky_png" + ChunkyPNG::Image.new(Random.new.rand(255), Random.new.rand(255), Random.new.rand(255)).save path + + if @browser.driver.browser == :chrome + @browser.execute_script "document.getElementsByName('file')[0].removeAttribute('class');" + @browser.execute_script "document.getElementsByName('file')[0].removeAttribute('style');" + end + + on(UploadPage).select_file = path +end +Then(/^(.+) checkbox should be there$/) do |_| + on(LearnPage).skip_element.when_present.should be_visible +end +Then(/^Describe page should open$/) do + @browser.url.should match /Special:UploadWizard/ +end +Then(/^Learn page should appear$/) do + @browser.url.should match /Special:UploadWizard/ +end +Then(/^Release rights page should open$/) do + @browser.url.should match /Special:UploadWizard/ +end +Then(/^Select a media file to donate button should be there$/) do + sleep 1 + on(UploadPage).select_file_element.when_present.should be_visible +end +Then(/^title text field should be there$/) do + on(DescribePage).title_element.when_present.should be_visible +end +Then(/^Upload more files button should be there$/) do + on(UsePage).upload_more_files_element.when_present.should be_visible +end +Then(/^Upload page should appear$/) do + @browser.url.should match /Special:UploadWizard/ +end +Then(/^Use page should open$/) do + @browser.url.should match /Special:UploadWizard/ +end diff --git a/tests/browser/features/support/env.rb b/tests/browser/features/support/env.rb new file mode 100644 index 0000000..2c4ee59 --- /dev/null +++ b/tests/browser/features/support/env.rb @@ -0,0 +1,12 @@ +# +# This file is subject to the license terms in the COPYING file found in the +# UploadWizard top-level directory and at +# https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/COPYING. No part of +# UploadWizard, including this file, may be copied, modified, propagated, or +# distributed except according to the terms contained in the COPYING file. +# +# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the +# UploadWizard top-level directory and at +# https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/CREDITS +# +require "mediawiki_selenium" diff --git a/tests/browser/features/support/pages/describe_page.rb b/tests/browser/features/support/pages/describe_page.rb new file mode 100644 index 0000000..2134bd2 --- /dev/null +++ b/tests/browser/features/support/pages/describe_page.rb @@ -0,0 +1,28 @@ +# +# This file is subject to the license terms in the COPYING file found in the +# UploadWizard top-level directory and at +# https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/COPYING. No part of +# UploadWizard, including this file, may be copied, modified, propagated, or +# distributed except according to the terms contained in the COPYING file. +# +# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the +# UploadWizard top-level directory and at +# https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/CREDITS +# +class DescribePage + include PageObject + + include URL + def self.url + URL.url("Special:UploadWizard") + end + page_url url + + text_field(:category, id: "categories0") + textarea(:description, name: /^description/) + div(:next_parent, id: "mwe-upwiz-stepdiv-details") + span(:next) do |page| + page.next_parent_element.span_element(text: "Next") + end + text_field(:title, id: "title0") +end diff --git a/tests/browser/features/support/pages/learn_page.rb b/tests/browser/features/support/pages/learn_page.rb new file mode 100644 index 0000000..53f3c47 --- /dev/null +++ b/tests/browser/features/support/pages/learn_page.rb @@ -0,0 +1,23 @@ +# +# This file is subject to the license terms in the COPYING file found in the +# UploadWizard top-level directory and at +# https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/COPYING. No part of +# UploadWizard, including this file, may be copied, modified, propagated, or +# distributed except according to the terms contained in the COPYING file. +# +# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the +# UploadWizard top-level directory and at +# https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/CREDITS +# +class LearnPage + include PageObject + + include URL + page_url URL.url("Special:UploadWizard") + + div(:next_parent, id: "mwe-upwiz-stepdiv-tutorial") + span(:next) do |page| + page.next_parent_element.span_element(text: "Next") + end + checkbox(:skip, id: "mwe-upwiz-skip") +end diff --git a/tests/browser/features/support/pages/release_rights_page.rb b/tests/browser/features/support/pages/release_rights_page.rb new file mode 100644 index 0000000..208dbb3 --- /dev/null +++ b/tests/browser/features/support/pages/release_rights_page.rb @@ -0,0 +1,27 @@ +# +# This file is subject to the license terms in the COPYING file found in the +# UploadWizard top-level directory and at +# https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/COPYING. No part of +# UploadWizard, including this file, may be copied, modified, propagated, or +# distributed except according to the terms contained in the COPYING file. +# +# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the +# UploadWizard top-level directory and at +# https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/CREDITS +# +class ReleaseRightsPage + include PageObject + + include URL + def self.url + URL.url("Special:UploadWizard") + end + page_url url + + radio(:my_own_work, id: "deedChooser1-ownwork") + div(:next_parent, id: "mwe-upwiz-stepdiv-deeds") + span(:next) do |page| + page.next_parent_element.span_element(text: "Next") + end + div(:thumbnail, id: "mwe-upwiz-deeds-thumbnails") +end diff --git a/tests/browser/features/support/pages/upload_page.rb b/tests/browser/features/support/pages/upload_page.rb new file mode 100644 index 0000000..294772a --- /dev/null +++ b/tests/browser/features/support/pages/upload_page.rb @@ -0,0 +1,23 @@ +# +# This file is subject to the license terms in the COPYING file found in the +# UploadWizard top-level directory and at +# https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/COPYING. No part of +# UploadWizard, including this file, may be copied, modified, propagated, or +# distributed except according to the terms contained in the COPYING file. +# +# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the +# UploadWizard top-level directory and at +# https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/CREDITS +# +class UploadPage + include PageObject + + include URL + def self.url + URL.url("Special:UploadWizard") + end + page_url url + + span(:continue, text: "Continue") + file_field(:select_file, name: "file") +end diff --git a/tests/browser/features/support/pages/upload_wizard_page.rb b/tests/browser/features/support/pages/upload_wizard_page.rb new file mode 100644 index 0000000..b1027db --- /dev/null +++ b/tests/browser/features/support/pages/upload_wizard_page.rb @@ -0,0 +1,77 @@ +# +# This file is subject to the license terms in the COPYING file found in the +# UploadWizard top-level directory and at +# https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/COPYING. No part of +# UploadWizard, including this file, may be copied, modified, propagated, or +# distributed except according to the terms contained in the COPYING file. +# +# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the +# UploadWizard top-level directory and at +# https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/CREDITS +# +class UploadWizardPage + include PageObject + + include URL + def self.url + URL.url("Special:UploadWizard") + end + page_url url + + text_field(:add_categories, id: "categories0") + text_field(:altitude, id: "location-altitude0") + text_field(:author, name: "author2") + textarea(:author, name: "author") # todo # fix duplicate + radio(:believe_free, id: "license2_13") + a(:categories, text: "Add categories and more information ...") + a(:cc, text: "The copyright holder published this work with the right Creative Commons license") + radio(:cc_cc, id: "license1_2") + radio(:cc_waiver, id: "license2_4") + radio(:cca2, id: "license2_3") + radio(:cca3, id: "license1_1") + radio(:cca3_2, id: "license2_2") + radio(:cca_2_2, id: "license2_6") + radio(:cca_sa, id: "license1_0") + radio(:cca_sa2, id: "license2_1") + radio(:cca_sa20, id: "license2_5") + radio(:cca_sa3, id: "license2_0") + button(:continue_button, xpath: "//div[2]/div[2]/div/button") + # todo # replace xpath # button(:continue_button, class: "mwe-upwiz-button-next ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only") + text_field(:date_created, id: "dateInput0") + textarea(:description_field, name: "description1") + a(:different_license, text: "Use a different license") + a(:expired, text: "The copyright has definitely expired in the USA") + a(:flickr, text: "The copyright holder published their photo or video on Flickr with the right license") + a(:found_it, text: "I found it on the Internet -- I'm not sure") + radio(:free_form, id: "license2_12") + textarea(:free_lic, id: "license2_12_custom") + select(:language, name: "lang") + text_field(:latitude, id: "location-latitude0") + # todo # check if legal_* links actually go the right place https://bugzilla.wikimedia.org/show_bug.cgi?id=35702 + a(:legal_code_cc_sa25, href: "https://creativecommons.org/licenses/by-sa/2.5/") + a(:legal_code_cc_sa3, href: "https://creativecommons.org/licenses/by-sa/3.0/") + a(:legal_code_cc_waiver, href: "https://creativecommons.org/publicdomain/zero/1.0/") + a(:legal_code_cca25, href: "https://creativecommons.org/licenses/by/2.5/") + a(:legal_code_cca3, href: "https://creativecommons.org/licenses/by/3.0/") + a(:legal_code_recommended, href: "https://creativecommons.org/licenses/by-sa/3.0/") + a(:logged_in, text: "logged in") + text_field(:longitude, id: "location-longitude0") + radio(:nasa, id: "license2_11") + span(:next, text: "Next") + button(:next_button, xpath: "//div[4]/button") + a(:not_mentioned, text: "Another reason not mentioned above") + textarea(:other_information, id: "otherInformation0") + radio(:own_work_button, id: "deedChooser1-ownwork") + radio(:pre_1923, id: "license2_8") + a(:recommended_license, text: "Use the recommended license") + radio(:repro, id: "license2_9") + file_field(:select_file, name: "file") + checkbox(:skip_radio, id: "mwe-upwiz-skip") + textarea(:source, name: "source") + radio(:third_party_button, id: "deedChooser1-thirdparty") + text_field(:title_field, id: "title0") + div(:tutorial_map, id: "mwe-upwiz-tutorial") + a(:us_govt, text: "This work was made by the United States government") + radio(:us_govt_2, id: "license2_7") + radio(:us_govt_3, id: "license2_10") +end diff --git a/tests/browser/features/support/pages/use_page.rb b/tests/browser/features/support/pages/use_page.rb new file mode 100644 index 0000000..76a76f2 --- /dev/null +++ b/tests/browser/features/support/pages/use_page.rb @@ -0,0 +1,22 @@ +# +# This file is subject to the license terms in the COPYING file found in the +# UploadWizard top-level directory and at +# https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/COPYING. No part of +# UploadWizard, including this file, may be copied, modified, propagated, or +# distributed except according to the terms contained in the COPYING file. +# +# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the +# UploadWizard top-level directory and at +# https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/CREDITS +# +class UsePage + include PageObject + + include URL + def self.url + URL.url("Special:UploadWizard") + end + page_url url + + span(:upload_more_files, text: "Upload more files") +end diff --git a/tests/browser/features/upload_wizard.feature b/tests/browser/features/upload_wizard.feature new file mode 100644 index 0000000..1deb483 --- /dev/null +++ b/tests/browser/features/upload_wizard.feature @@ -0,0 +1,57 @@ +# +# This file is subject to the license terms in the COPYING file found in the +# UploadWizard top-level directory and at +# https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/COPYING. No part of +# UploadWizard, including this file, may be copied, modified, propagated, or +# distributed except according to the terms contained in the COPYING file. +# +# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the +# UploadWizard top-level directory and at +# https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/CREDITS +# +@commons.wikimedia.beta.wmflabs.org @ie6-bug @ie7-bug @ie8-bug @login @test2.wikipedia.org +Feature: UploadWizard + + Background: + Given I am logged in + When I navigate to Upload Wizard + + Scenario: Navigate to Learn page + Then Learn page should appear + And Skip this step in the future checkbox should be there + + Scenario: Navigate to Upload page + When I click Next button at Learn page + Then Upload page should appear + + + Scenario: Navigate to Release rights page + When I click Next button at Learn page + And upload file image.png + And click button Continue + Then Release rights page should open + And thumbnail should be visible + + + Scenario: Navigate to Describe page + When I click Next button at Learn page + And upload file image.png + And click button Continue + And I click This file is my own work + And I click Next button at Release rights page + Then Describe page should open + And title text field should be there + + @ie6-bug @ie7-bug @ie8-bug + Scenario: Navigate to Use page + When I click Next button at Learn page + And upload file image.png + And click button Continue + And I click This file is my own work + And I click Next button at Release rights page + And I enter title + And I enter description + And I enter category + And I click Next button at Describe page + Then Use page should open + And Upload more files button should be there -- To view, visit https://gerrit.wikimedia.org/r/112895 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifd6005bd1fd1a2ead6bd8c2d5194adafeed4b156 Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/UploadWizard Gerrit-Branch: master Gerrit-Owner: Zfilipin <zfili...@wikimedia.org> Gerrit-Reviewer: Cmcmahon <cmcma...@wikimedia.org> Gerrit-Reviewer: Jeroen De Dauw <jeroended...@gmail.com> Gerrit-Reviewer: Jhall <jh...@wikimedia.org> Gerrit-Reviewer: Kaldari <rkald...@wikimedia.org> Gerrit-Reviewer: LuisVilla <lvi...@wikimedia.org> Gerrit-Reviewer: Yuvipanda <yuvipa...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits