Port browser test for Math extension from the /qa/browsertest repo
From an earlier discussion with physikerwelt. This is one step toward retiring the /qa/browsertest repo entirely. Change-Id: I804f32d2a5a984c8eb0dfc50c8ab50a7f1035256
This commit is contained in:
parent
9f54b57689
commit
94ded6c7b9
6
tests/browser/Gemfile
Executable file
6
tests/browser/Gemfile
Executable file
@ -0,0 +1,6 @@
|
||||
#ruby=ruby-2.1.1
|
||||
#ruby-gemset=browsertests
|
||||
|
||||
source "https://rubygems.org"
|
||||
|
||||
gem "mediawiki_selenium"
|
64
tests/browser/Gemfile.lock
Normal file
64
tests/browser/Gemfile.lock
Normal file
@ -0,0 +1,64 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
builder (3.2.2)
|
||||
childprocess (0.5.2)
|
||||
ffi (~> 1.0, >= 1.0.11)
|
||||
cucumber (1.3.14)
|
||||
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.18)
|
||||
faker (>= 1.1.2)
|
||||
yml_reader (>= 0.2)
|
||||
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.1)
|
||||
i18n (0.6.9)
|
||||
json (1.8.1)
|
||||
mediawiki_selenium (0.2.20)
|
||||
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.2)
|
||||
multi_json (1.9.2)
|
||||
multi_test (0.1.1)
|
||||
net-http-persistent (2.9.4)
|
||||
page-object (0.9.8)
|
||||
page_navigation (>= 0.9)
|
||||
selenium-webdriver (>= 2.40.0)
|
||||
watir-webdriver (>= 0.6.8)
|
||||
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.3)
|
||||
selenium-webdriver (2.41.0)
|
||||
childprocess (>= 0.5.0)
|
||||
multi_json (~> 1.0)
|
||||
rubyzip (~> 1.0)
|
||||
websocket (~> 1.0.4)
|
||||
syntax (1.2.0)
|
||||
watir-webdriver (0.6.9)
|
||||
selenium-webdriver (>= 2.18.0)
|
||||
websocket (1.0.7)
|
||||
yml_reader (0.2)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
mediawiki_selenium
|
23
tests/browser/features/math.feature
Normal file
23
tests/browser/features/math.feature
Normal file
@ -0,0 +1,23 @@
|
||||
#
|
||||
# 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 @en.wikipedia.beta.wmflabs.org @firefox @internet_explorer_6 @internet_explorer_7 @internet_explorer_8 @internet_explorer_9 @internet_explorer_10 @login @phantomjs @test2.wikipedia.org
|
||||
Feature: Math
|
||||
|
||||
Scenario: Display simple math
|
||||
Given I am logged in
|
||||
And I am at page that does not exist
|
||||
And I click link Create source
|
||||
When I type <math>3 + 2</math>
|
||||
And I click Preview
|
||||
Then the page should contain an img tag
|
||||
And alt for that img should be 3 + 2
|
||||
And src for that img should come from //upload
|
40
tests/browser/features/step_definitions/math_steps.rb
Normal file
40
tests/browser/features/step_definitions/math_steps.rb
Normal file
@ -0,0 +1,40 @@
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
Given(/^I am at page that does not exist$/) do
|
||||
visit(DoesNotExistPage, using_params: {page_name: @random_string})
|
||||
end
|
||||
|
||||
When(/^I click link Create source$/) do
|
||||
on(DoesNotExistPage).create_source_element.when_present.click
|
||||
end
|
||||
|
||||
When(/^I click Preview$/) do
|
||||
on(EditPage).preview
|
||||
end
|
||||
|
||||
When(/^I type (.+)$/) do |write_text|
|
||||
on(EditPage).article_text=write_text
|
||||
end
|
||||
|
||||
Then(/^alt for that img should be (.+)$/) do |alt|
|
||||
on(EditPage).math_image_element.element.alt.should == alt
|
||||
end
|
||||
|
||||
Then(/^src for that img should come from (.+)$/) do |src|
|
||||
on(EditPage).math_image_element.element.src.should match Regexp.escape(src)
|
||||
end
|
||||
|
||||
|
||||
Then(/^the page should contain an img tag$/) do
|
||||
on(EditPage).math_image_element.when_present.should be_visible
|
||||
end
|
12
tests/browser/features/support/env.rb
Normal file
12
tests/browser/features/support/env.rb
Normal 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"
|
19
tests/browser/features/support/pages/does_not_exist_page.rb
Normal file
19
tests/browser/features/support/pages/does_not_exist_page.rb
Normal file
@ -0,0 +1,19 @@
|
||||
#
|
||||
# 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 DoesNotExistPage
|
||||
include PageObject
|
||||
|
||||
include URL
|
||||
page_url URL.url("<%=params[:page_name]%>")
|
||||
|
||||
a(:create_source, text: "Create source")
|
||||
end
|
18
tests/browser/features/support/pages/edit_page.rb
Normal file
18
tests/browser/features/support/pages/edit_page.rb
Normal file
@ -0,0 +1,18 @@
|
||||
#
|
||||
# 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 EditPage
|
||||
include PageObject
|
||||
|
||||
text_area(:article_text, id: "wpTextbox1")
|
||||
img(:math_image, class: "tex")
|
||||
button(:preview, id: "wpPreview")
|
||||
end
|
Loading…
Reference in New Issue
Block a user