[MediaWiki-commits] [Gerrit] mediawiki...ElectronPdfService[master]: Adding basic browsertests
jenkins-bot has submitted this change and it was merged. Change subject: Adding basic browsertests .. Adding basic browsertests Bug: T149189 Change-Id: I080be6304e7be3cfadbead182a23302d6de9d72f --- M .gitignore A Gemfile A tests/browser/README.mediawiki A tests/browser/environments.yml A tests/browser/features/selectionscreen.feature A tests/browser/features/support/env.rb A tests/browser/features/support/hooks.rb A tests/browser/features/support/pages/mainpage_page.rb A tests/browser/features/support/pages/selectionscreen_page.rb A tests/browser/features/support/step_definitions/mainpage.rb A tests/browser/features/support/step_definitions/selectionscreen.rb 11 files changed, 168 insertions(+), 0 deletions(-) Approvals: WMDE-Fisch: Looks good to me, approved jenkins-bot: Verified diff --git a/.gitignore b/.gitignore index 51d4694..fb1c829 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ /composer.lock /vendor /node_modules +Gemfile.lock diff --git a/Gemfile b/Gemfile new file mode 100644 index 000..c960123 --- /dev/null +++ b/Gemfile @@ -0,0 +1,7 @@ +source 'https://rubygems.org' + +gem 'chunky_png', '~> 1.3.4' +gem 'jsduck', '~> 5.3.4' +gem 'mediawiki_selenium', '~> 1.7.0' +gem 'rake', '~> 10.4', '>= 10.4.2' +gem 'rubocop', '~> 0.29.1', require: false \ No newline at end of file diff --git a/tests/browser/README.mediawiki b/tests/browser/README.mediawiki new file mode 100644 index 000..128154a --- /dev/null +++ b/tests/browser/README.mediawiki @@ -0,0 +1,50 @@ +To run the Selenium tests you will have to install Ruby (for the exact +version see Gemfile), the latest versions of RubyGems and Firefox. + +The easiest way to install Ruby on *nix is RVM (https://rvm.io/) and on +Windows RubyInstaller (http://rubyinstaller.org/). + +Open terminal in tests/browser. Update RubyGems and install required +gems with: + + gem update --system + gem install bundler # on Mac OS X Yosemite append ` --user-install -n~/bin`, + # where ~/bin is the install folder + bundle install + +Environment variables MEDIAWIKI_USER and MEDIAWIKI_PASSWORD are required for +tests that require a logged in user. For local testing, create a test user on your local wiki +and export the user and password as the values for those variables. +For example: + + export MEDIAWIKI_USER= # Linux/Unix/Mac + set MEDIAWIKI_USER= # Windows + + export MEDIAWIKI_PASSWORD= # Linux/Unix/Mac + set MEDIAWIKI_PASSWORD= # Windows + +In addition to this create another user which will be reserved for new uploads +"Selenium_newuser". The password for this user should be the same as +MEDIAWIKI_PASSWORD + +Tests that use the "Given I create a random page using the API" step need to set +the MEDIAWIKI_API_URL environment variable, e.g. +export MEDIAWIKI_API_URL=http://en.wikipedia.beta.wmflabs.org/w/api.php + +Run the tests from the ElectronPdfService tests/browser directory with: + + bundle exec cucumber + +If you want to run a single set of tests, go to the tests/browser directory and +call 'bundle exec cucumber' with the path to the test file. For example, to run +only the watchlist tests: + + bundle exec cucumber features/betafeature.feature + +XML report (for Jenkins) is created at tests/browser/reports/junit. + +Jenkins is hosted at https://wmf.ci.cloudbees.com/ and it drives +browsers at http://saucelabs.com/ + +For more information about running Selenium tests please see +https://github.com/wikimedia/mediawiki-selenium diff --git a/tests/browser/environments.yml b/tests/browser/environments.yml new file mode 100644 index 000..2e54bb8 --- /dev/null +++ b/tests/browser/environments.yml @@ -0,0 +1,45 @@ +# Customize this configuration as necessary to provide defaults for various +# test environments. +# +# The set of defaults to use is determined by the MEDIAWIKI_ENVIRONMENT +# environment variable. +# +# export MEDIAWIKI_ENVIRONMENT=mw-vagrant-host +# bundle exec cucumber +# +# Additional variables set by the environment will override the corresponding +# defaults defined here. +# +# export MEDIAWIKI_ENVIRONMENT=mw-vagrant-host +# export MEDIAWIKI_USER=Selenium_user2 +# bundle exec cucumber +# +mw-vagrant-host: + mediawiki_url: http://127.0.0.1:8080/wiki/ + user_factory: true + +barry: + browser: phantomjs + user_factory: false + # mediawiki_url: Will be set manually + +mw-vagrant-guest: + mediawiki_url: http://127.0.0.1/wiki/ + user_factory: true + +beta: + mediawiki_url: http://en.wikipedia.beta.wmflabs.org/wiki/ + mediawiki_user: Selenium_user + # mediawiki_password: SET THIS IN THE ENVIRONMENT! + +test2: + mediawiki_url: http://test2.wikipedia.org/wiki/ + mediawiki_user: Selenium_user + # mediawiki_password: SET THIS IN THE ENVIRONMENT! + +integration: + browser: chrome + user_factory: true + # mediawiki_url: THIS WILL BE SET BY JENKINS + +default: *default \ No newline at end of file diff --git
[MediaWiki-commits] [Gerrit] mediawiki...ElectronPdfService[master]: Adding basic browsertests
Tobias Gritschacher has uploaded a new change for review. https://gerrit.wikimedia.org/r/318088 Change subject: Adding basic browsertests .. Adding basic browsertests Change-Id: I080be6304e7be3cfadbead182a23302d6de9d72f --- M .gitignore A Gemfile A tests/browser/README.mediawiki A tests/browser/features/selectionscreen.feature A tests/browser/features/support/env.rb A tests/browser/features/support/hooks.rb A tests/browser/features/support/pages/mainpage_page.rb A tests/browser/features/support/pages/selectionscreen_page.rb A tests/browser/features/support/step_definitions/mainpage.rb A tests/browser/features/support/step_definitions/selectionscreen.rb 10 files changed, 123 insertions(+), 0 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ElectronPdfService refs/changes/88/318088/1 diff --git a/.gitignore b/.gitignore index 51d4694..fb1c829 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ /composer.lock /vendor /node_modules +Gemfile.lock diff --git a/Gemfile b/Gemfile new file mode 100644 index 000..8f7df47 --- /dev/null +++ b/Gemfile @@ -0,0 +1,7 @@ +source 'https://rubygems.org' + +gem 'chunky_png', '~> 1.3.4' +gem 'jsduck', '~> 5.3.4' +gem 'mediawiki_selenium', '~> 1.6.5' +gem 'rake', '~> 10.4', '>= 10.4.2' +gem 'rubocop', '~> 0.29.1', require: false \ No newline at end of file diff --git a/tests/browser/README.mediawiki b/tests/browser/README.mediawiki new file mode 100644 index 000..6aab0a2 --- /dev/null +++ b/tests/browser/README.mediawiki @@ -0,0 +1,50 @@ +To run the Selenium tests you will have to install Ruby (for the exact +version see Gemfile), the latest versions of RubyGems and Firefox. + +The easiest way to install Ruby on *nix is RVM (https://rvm.io/) and on +Windows RubyInstaller (http://rubyinstaller.org/). + +Open terminal in tests/browser. Update RubyGems and install required +gems with: + + gem update --system + gem install bundler # on Mac OS X Yosemite append ` --user-install -n~/bin`, + # where ~/bin is the install folder + bundle install + +Environment variables MEDIAWIKI_USER and MEDIAWIKI_PASSWORD are required for +tests that require a logged in user. For local testing, create a test user on your local wiki +and export the user and password as the values for those variables. +For example: + + export MEDIAWIKI_USER= # Linux/Unix/Mac + set MEDIAWIKI_USER= # Windows + + export MEDIAWIKI_PASSWORD= # Linux/Unix/Mac + set MEDIAWIKI_PASSWORD= # Windows + +In addition to this create another user which will be reserved for new uploads +"Selenium_newuser". The password for this user should be the same as +MEDIAWIKI_PASSWORD + +Tests that use the "Given I create a random page using the API" step need to set +the MEDIAWIKI_API_URL environment variable, e.g. +export MEDIAWIKI_API_URL=http://en.wikipedia.beta.wmflabs.org/w/api.php + +Run the tests from the RevisionSlider tests/browser directory with: + + bundle exec cucumber + +If you want to run a single set of tests, go to the tests/browser directory and +call 'bundle exec cucumber' with the path to the test file. For example, to run +only the watchlist tests: + + bundle exec cucumber features/betafeature.feature + +XML report (for Jenkins) is created at tests/browser/reports/junit. + +Jenkins is hosted at https://wmf.ci.cloudbees.com/ and it drives +browsers at http://saucelabs.com/ + +For more information about running Selenium tests please see +https://github.com/wikimedia/mediawiki-selenium diff --git a/tests/browser/features/selectionscreen.feature b/tests/browser/features/selectionscreen.feature new file mode 100644 index 000..1998194 --- /dev/null +++ b/tests/browser/features/selectionscreen.feature @@ -0,0 +1,11 @@ +@chrome @en.wikipedia.beta.wmflabs.org @firefox @integration +Feature: ElectronPdfService Selection Screen + Background: +Given I am on the Main Page + + Scenario: Selection screen is shown with correct default selection +When I click Download as PDF +Then Selection screen header should be there +And Selection elements should be there +And Download button should be there +And Single column option should be selected diff --git a/tests/browser/features/support/env.rb b/tests/browser/features/support/env.rb new file mode 100644 index 000..3c896c2 --- /dev/null +++ b/tests/browser/features/support/env.rb @@ -0,0 +1,3 @@ +require 'mediawiki_selenium/cucumber' +require 'mediawiki_selenium/pages' +require 'mediawiki_selenium/step_definitions' \ No newline at end of file diff --git a/tests/browser/features/support/hooks.rb b/tests/browser/features/support/hooks.rb new file mode 100644 index 000..9e8e4cd --- /dev/null +++ b/tests/browser/features/support/hooks.rb @@ -0,0 +1,6 @@ +# Needed for cucumber --dry-run -f stepdefs +require_relative 'env' + +Before('@skip') do |scenario| + scenario.skip_invoke! +end \ No newline at end of