QA: port PDF test from /qa/browsertests repo

This test is intended to be run against either test2wiki or
some wiki with proper support for downloading pages as PDF

It does not work in beta labs or in a bare wiki

Change-Id: I16dcc9d2692055c2b972c2a96dfc3f9860115fa4
This commit is contained in:
Cmcmahon 2014-06-30 15:07:17 -07:00
parent 725cb83667
commit 3a4584d3e2
6 changed files with 139 additions and 0 deletions

6
tests/browser/Gemfile Executable file
View file

@ -0,0 +1,6 @@
#ruby=ruby-2.1.1
#ruby-gemset=browsertests
source "https://rubygems.org"
gem "mediawiki_selenium"

View file

@ -0,0 +1,62 @@
GEM
remote: https://rubygems.org/
specs:
builder (3.2.2)
childprocess (0.5.3)
ffi (~> 1.0, >= 1.0.11)
cucumber (1.3.15)
builder (>= 2.1.2)
diff-lcs (>= 1.1.3)
gherkin (~> 2.12)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.1.1)
data_magic (0.19)
faker (>= 1.1.2)
yml_reader (>= 0.3)
diff-lcs (1.2.5)
faker (1.3.0)
i18n (~> 0.5)
ffi (1.9.3)
gherkin (2.12.2)
multi_json (~> 1.3)
headless (1.0.2)
i18n (0.6.9)
json (1.8.1)
mediawiki_selenium (0.2.25)
cucumber (~> 1.3, >= 1.3.10)
headless (~> 1.0, >= 1.0.1)
json (~> 1.8, >= 1.8.1)
page-object (~> 1.0)
rest-client (~> 1.6, >= 1.6.7)
rspec-expectations (~> 2.14, >= 2.14.4)
syntax (~> 1.2, >= 1.2.0)
mime-types (2.3)
multi_json (1.10.1)
multi_test (0.1.1)
page-object (1.0)
page_navigation (>= 0.9)
selenium-webdriver (>= 2.42.0)
watir-webdriver (>= 0.6.9)
page_navigation (0.9)
data_magic (>= 0.14)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec-expectations (2.99.1)
diff-lcs (>= 1.1.3, < 2.0)
rubyzip (1.1.4)
selenium-webdriver (2.42.0)
childprocess (>= 0.5.0)
multi_json (~> 1.0)
rubyzip (~> 1.0)
websocket (~> 1.0.4)
syntax (1.2.0)
watir-webdriver (0.6.10)
selenium-webdriver (>= 2.18.0)
websocket (1.0.7)
yml_reader (0.3)
PLATFORMS
ruby
DEPENDENCIES
mediawiki_selenium

View file

@ -0,0 +1,22 @@
#
# This file is subject to the license terms in the LICENSE file found in the
# qa-browsertests top-level directory and at
# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
# qa-browsertests, including this file, may be copied, modified, propagated, or
# distributed except according to the terms contained in the LICENSE file.
#
# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the
# qa-browsertests top-level directory and at
# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
#
@chrome @firefox @internet_explorer_8 @internet_explorer_9 @internet_explorer_10 @phantomjs @test2.wikipedia.org
Feature: PDF
Scenario: Check for Download as PDF link
Given I am at a random page
Then Download as PDF should be present
Scenario: Click on Download as PDF link
Given I am at a random page
When I click on Download as PDF
Then Download the file link should be present

View file

@ -0,0 +1,20 @@
#
# This file is subject to the license terms in the LICENSE file found in the
# qa-browsertests top-level directory and at
# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
# qa-browsertests, including this file, may be copied, modified, propagated, or
# distributed except according to the terms contained in the LICENSE file.
#
# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the
# qa-browsertests top-level directory and at
# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
#
Then(/^Download as PDF should be present$/) do
on(PdfPage).download_as_pdf_element.should exist
end
When(/^I click on Download as PDF$/) do
on(PdfPage).download_as_pdf_element.when_present.click
end
Then(/^Download the file link should be present$/) do
on(PdfPage).download_the_file_element.when_present(30).should exist
end

View file

@ -0,0 +1,12 @@
#
# This file is subject to the license terms in the LICENSE file found in the
# qa-browsertests top-level directory and at
# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
# qa-browsertests, including this file, may be copied, modified, propagated, or
# distributed except according to the terms contained in the LICENSE file.
#
# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the
# qa-browsertests top-level directory and at
# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
#
require "mediawiki_selenium"

View file

@ -0,0 +1,17 @@
#
# This file is subject to the license terms in the LICENSE file found in the
# qa-browsertests top-level directory and at
# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
# qa-browsertests, including this file, may be copied, modified, propagated, or
# distributed except according to the terms contained in the LICENSE file.
#
# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the
# qa-browsertests top-level directory and at
# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
#
class PdfPage
include PageObject
a(:download_as_pdf, text: "Download as PDF")
a(:download_the_file, text: "Download the file")
end