mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 03:08:42 +00:00
[Browser test] New test for switching between editing modes
1) Using native page-objects methods for dealing with Javascript alerts. 2) Added tags to feature file per reviewer comment. Change-Id: I3e9d9ae16f1c880878c8e198c647376a0b9aed37
This commit is contained in:
parent
2b74982e95
commit
30f2619c14
|
@ -0,0 +1,47 @@
|
|||
When(/^I click the Edit source tab$/) do
|
||||
on(VisualEditorPage).edit_wikitext_element.when_present.click
|
||||
end
|
||||
|
||||
When(/^I click the Switch to source editing menu option$/) do
|
||||
on(VisualEditorPage) do |page|
|
||||
page.alert do
|
||||
page.switch_to_source_editing_element
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
When(/^I click Edit for VisualEditor from this page$/) do
|
||||
on(VisualEditorPage) do |page|
|
||||
page.alert do
|
||||
page.edit_ve_element
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Then(/^I should be in wikitext editing mode$/) do
|
||||
on(VisualEditorPage) do |page|
|
||||
page.wait_until(15) do
|
||||
page.text.include? "Editing User:"
|
||||
end
|
||||
end
|
||||
@browser.url.should eql(ENV['MEDIAWIKI_URL'] + "User:" + ENV['MEDIAWIKI_USER'] + "?action=submit")
|
||||
end
|
||||
|
||||
Then(/^I should be in Visual Editor editing mode$/) do
|
||||
on(VisualEditorPage) do |page|
|
||||
page.wait_until(15) do
|
||||
page.text.include? "User:"
|
||||
end
|
||||
end
|
||||
expected_url = /index\.php\?title=User:Selenium_user&veaction=edit/
|
||||
@browser.url.should match Regexp.new(expected_url)
|
||||
end
|
||||
|
||||
Then(/^I should be in Visual Editor editing alternate mode$/) do
|
||||
on(VisualEditorPage) do |page|
|
||||
page.wait_until(15) do
|
||||
page.text.include? "User:"
|
||||
end
|
||||
end
|
||||
@browser.url.should eql(ENV['MEDIAWIKI_URL'] + "User:" + ENV['MEDIAWIKI_USER'] + "?veaction=edit")
|
||||
end
|
|
@ -10,6 +10,7 @@ class VisualEditorPage
|
|||
a(:decrease_indentation_on, title: /Decrease indentation/)
|
||||
span(:downarrow, class: 'oo-ui-iconedElement-icon oo-ui-icon-down')
|
||||
a(:edit_ve, title: /Edit this page with VisualEditor/)
|
||||
a(:edit_wikitext, title: /You can edit this page\./)
|
||||
span(:heading, text: 'Heading')
|
||||
span(:increase_indentation, class: 'oo-ui-widget oo-ui-tool oo-ui-tool-name-indent oo-ui-widget-disabled')
|
||||
a(:increase_indentation_on, title: /Increase indentation/)
|
||||
|
@ -31,6 +32,8 @@ class VisualEditorPage
|
|||
span(:subheading2, text: 'Sub-heading 2')
|
||||
span(:subheading3, text: 'Sub-heading 3')
|
||||
span(:subheading4, text: 'Sub-heading 4')
|
||||
span(:switch_to_source_editing, class: 'oo-ui-iconedElement-icon oo-ui-icon-source')
|
||||
span(:tools_menu, class: 'oo-ui-iconedElement-icon oo-ui-icon-menu')
|
||||
span(:ve_bold_text, class: 'oo-ui-iconedElement-icon oo-ui-icon-bold-b')
|
||||
span(:ve_bullets, class: 'oo-ui-iconedElement-icon oo-ui-icon-bullet-list')
|
||||
span(:ve_computer_code, class: 'oo-ui-iconedElement-icon oo-ui-icon-code')
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
@ie6-bug @ie7-bug @ie8-bug @ie9-bug @ie10-bug @en.wikipedia.beta.wmflabs.org @test2.wikipedia.org @login
|
||||
Feature: Switching between wikitext and Visual Editor modes
|
||||
|
||||
Test for both pathways that allow switching between Visual Editor and wikitext editing modes.
|
||||
|
||||
Background:
|
||||
Given I am logged in
|
||||
And I am at my user page
|
||||
When I click Edit for VisualEditor
|
||||
|
||||
Scenario: Switch editing modes via toolbar
|
||||
When I click the Edit source tab
|
||||
And I click Edit for VisualEditor
|
||||
Then I should be in Visual Editor editing mode
|
||||
|
||||
Scenario: Switch editing modes via Page Settings drop-down menu
|
||||
When I click the Switch to source editing menu option
|
||||
And I click Edit for VisualEditor from this page
|
||||
Then I should be in Visual Editor editing alternate mode
|
Loading…
Reference in a new issue