mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 06:24:08 +00:00
[BrowserTest] Load i18n messages from MediaWiki to browser tests
* translate method can be called to translate a particular string to a specific language. Bug: T90577 Change-Id: I7852ee0b0009e70bd9decef0dd317055d91a06a6
This commit is contained in:
parent
fbd83f2d4b
commit
df2c17bfd2
|
@ -177,3 +177,7 @@ Feature: Language Screenshot
|
|||
Given I go to the "Reference VisualEditor Screenshot" page with source content "VisualEditor is a MediaWiki extension"
|
||||
When I click on References list in Insert menu
|
||||
Then I should see References list dialog box
|
||||
|
||||
Scenario: Load i18n messages from MediaWiki to browser tests
|
||||
Given I am on the Main page
|
||||
Then I should see save button
|
||||
|
|
|
@ -529,3 +529,7 @@ When(/^I go to language screenshot page$/) do
|
|||
step 'I am on the Language Screenshot page'
|
||||
browser.goto "#{browser.url}&setlang=#{lookup(:language_screenshot_code)}"
|
||||
end
|
||||
|
||||
Then(/^I should see save button$/) do
|
||||
on(VisualEditorPage).save_page_element.when_present.should be_visible
|
||||
end
|
||||
|
|
|
@ -4,6 +4,12 @@ class VisualEditorPage
|
|||
|
||||
page_url 'User:<%= env.user %>/<%= env.browser_name %>?vehidebetadialog=true&veaction=edit'
|
||||
|
||||
def self.translate(string)
|
||||
file = File.read "../../i18n/#{ENV['LANGUAGE_SCREENSHOT_CODE']}.json"
|
||||
json = JSON.parse(file)
|
||||
json[string]
|
||||
end
|
||||
|
||||
div(:add_a_template_title, class: 'oo-ui-processDialog-location', text: /Add a template/)
|
||||
text_field(:add_category, css: 'div.ve-ui-mwCategoryInputWidget > input')
|
||||
span(:add_template, text: 'Add template')
|
||||
|
@ -150,7 +156,7 @@ class VisualEditorPage
|
|||
div(:top_editing_tabs, id: 'p-views')
|
||||
li(:ve_edit_tab, id: 'ca-ve-edit')
|
||||
li(:edit_source_tab, id: 'ca-edit')
|
||||
a(:save_page, css: '.oo-ui-flaggedElement-progressive > a:nth-child(1)')
|
||||
a(:save_page, text: translate('visualeditor-savedialog-label-save'))
|
||||
div(:save_enabled, css: 'div.ve-init-mw-desktopArticleTarget-toolbar .oo-ui-toolbar-actions > div.oo-ui-flaggedElement-progressive.oo-ui-widget-enabled')
|
||||
div(:search_page_link, class: 'oo-ui-optionWidget-selected')
|
||||
a(:second_reference, text: '[1]', index: 2)
|
||||
|
|
Loading…
Reference in a new issue