mediawiki-extensions-Math/tests/browser/features/step_definitions/math_steps.rb
Antoine Musso 0cebe64840 browser test: fix logic to find edit action
The simple math test failed to find the edit link on a non existent
page. It was looking for the text 'Create source' from Vector which is
now simply 'Create'.

Change the PageObject selector to use a CSS selector, more robust to
text changes.

Change-Id: Ifcbd07da8e343b5697fcff6af6ffac90ff4d6420
2015-12-14 21:24:13 +01:00

41 lines
1.3 KiB
Ruby

#
# 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$/) do
on(DoesNotExistPage).action_edit_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|
expect(on(EditPage).math_image_element.element.alt).to eq(alt)
end
Then(/^src for that img should come from (.+)$/) do |src|
expect(on(EditPage).math_image_element.element.src).to match Regexp.escape src
end
Then(/^the page should contain an img tag$/) do
expect(on(EditPage).math_image_element.when_present).to be_visible
end