Sbisson has uploaded a new change for review. https://gerrit.wikimedia.org/r/220820
Change subject: Browser tests: clearning the content of VE ...................................................................... Browser tests: clearning the content of VE Some tests have to clear to content of text editors to replace the content. text_field and text_area support :clear but VE is actually a div. Clear is implemented as select all and backspace. Change-Id: I5fac261637135fefcdf50c78152a8b14423388d0 --- M handlebars/compiled/flow_block_header.handlebars.php M handlebars/flow_header_detail.partial.handlebars M tests/browser/features/description.feature M tests/browser/features/step_definitions/description_steps.rb A tests/browser/features/support/div_extension.rb M tests/browser/features/support/env.rb M tests/browser/features/support/pages/flow_page.rb 7 files changed, 22 insertions(+), 12 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow refs/changes/20/220820/1 diff --git a/handlebars/compiled/flow_block_header.handlebars.php b/handlebars/compiled/flow_block_header.handlebars.php index 7f1811a..a61b98e 100644 --- a/handlebars/compiled/flow_block_header.handlebars.php +++ b/handlebars/compiled/flow_block_header.handlebars.php @@ -39,10 +39,9 @@ '.$sp.' <span class="mw-ui-icon mw-ui-icon-before mw-ui-icon-edit flow-board-header-icon"></span>'.LCRun3::ch($cx, 'l10n', array(array('flow-edit-header-link'),array()), 'encq').' '.$sp.' </a> '.$sp.'' : '').' </div> -'.$sp.''.((LCRun3::ifvar($cx, ((isset($in['revision']['content']) && is_array($in['revision'])) ? $in['revision']['content'] : null))) ? ' <div class="flow-board-header-content"> -'.$sp.' '.LCRun3::ch($cx, 'escapeContent', array(array(((isset($in['revision']['content']['format']) && is_array($in['revision']['content'])) ? $in['revision']['content']['format'] : null),((isset($in['revision']['content']['content']) && is_array($in['revision']['content'])) ? $in['revision']['content']['content'] : null)),array()), 'encq').' -'.$sp.' </div> -'.$sp.'' : '').'</div> +'.$sp.' <div class="flow-board-header-content"> +'.$sp.''.((LCRun3::ifvar($cx, ((isset($in['revision']['content']) && is_array($in['revision'])) ? $in['revision']['content'] : null))) ? ''.LCRun3::ch($cx, 'escapeContent', array(array(((isset($in['revision']['content']['format']) && is_array($in['revision']['content'])) ? $in['revision']['content']['format'] : null),((isset($in['revision']['content']['content']) && is_array($in['revision']['content'])) ? $in['revision']['content']['content'] : null)),array()), 'encq').'' : '').' </div> +'.$sp.'</div> '.$sp.'<a href="javascript:void(0);" '.$sp.' class="mw-ui-button mw-ui-quiet side-rail-toggle-button" '.$sp.' data-flow-interactive-handler="toggleSideRail"> diff --git a/handlebars/flow_header_detail.partial.handlebars b/handlebars/flow_header_detail.partial.handlebars index b8ba757..f0159f4 100644 --- a/handlebars/flow_header_detail.partial.handlebars +++ b/handlebars/flow_header_detail.partial.handlebars @@ -11,11 +11,11 @@ </a> {{/if}} </div> - {{#if revision.content}} - <div class="flow-board-header-content"> - {{escapeContent revision.content.format revision.content.content}} - </div> - {{/if}} + <div class="flow-board-header-content"> + {{#if revision.content}} + {{~escapeContent revision.content.format revision.content.content~}} + {{/if}} + </div> </div> <a href="javascript:void(0);" class="mw-ui-button mw-ui-quiet side-rail-toggle-button" diff --git a/tests/browser/features/description.feature b/tests/browser/features/description.feature index 2dbae1f..8c7c5a1 100644 --- a/tests/browser/features/description.feature +++ b/tests/browser/features/description.feature @@ -10,7 +10,7 @@ Scenario: No description on a new board When I am on a new board - Then the description should be " " + Then the description should be empty Scenario: Edit description on a new board Given I am on a new board diff --git a/tests/browser/features/step_definitions/description_steps.rb b/tests/browser/features/step_definitions/description_steps.rb index 9593dc9..05fa45a 100644 --- a/tests/browser/features/step_definitions/description_steps.rb +++ b/tests/browser/features/step_definitions/description_steps.rb @@ -1,7 +1,7 @@ Then(/^the description should be "(.*?)"$/) do |content| on(FlowPage) do |page| page.description_content_element.when_present - page.description_content.should match Regexp.escape(content) + page.description_content.should eq(content) end end @@ -14,3 +14,7 @@ page.edit_description_save_element.when_present.click end end + +Then(/^the description should be empty$/) do + step "the description should be \"\"" +end \ No newline at end of file diff --git a/tests/browser/features/support/div_extension.rb b/tests/browser/features/support/div_extension.rb new file mode 100644 index 0000000..ec046b4 --- /dev/null +++ b/tests/browser/features/support/div_extension.rb @@ -0,0 +1,6 @@ +class Watir::Div + def clear + send_keys [:control, 'a'], :backspace + send_keys [:command, 'a'], :backspace + end +end \ No newline at end of file diff --git a/tests/browser/features/support/env.rb b/tests/browser/features/support/env.rb index 55b30ce..b15b014 100644 --- a/tests/browser/features/support/env.rb +++ b/tests/browser/features/support/env.rb @@ -1,5 +1,6 @@ require "mediawiki_api" require "mediawiki_selenium" +require_relative 'div_extension' if ENV['PAGE_WAIT_TIMEOUT'] PageObject.default_page_wait = ENV['PAGE_WAIT_TIMEOUT'].to_i diff --git a/tests/browser/features/support/pages/flow_page.rb b/tests/browser/features/support/pages/flow_page.rb index 43ae07a..e47a4c9 100644 --- a/tests/browser/features/support/pages/flow_page.rb +++ b/tests/browser/features/support/pages/flow_page.rb @@ -16,7 +16,7 @@ # board description a(:edit_description_link, title: "Edit description") - div(:description_content, css: ".flow-board-header-detail-view") + div(:description_content, css: ".flow-board-header-content") form(:edit_description_form, css: ".edit-header-form") def edit_description_textbox_element visualeditor_or_textarea 'edit-header-form' -- To view, visit https://gerrit.wikimedia.org/r/220820 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5fac261637135fefcdf50c78152a8b14423388d0 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Flow Gerrit-Branch: master Gerrit-Owner: Sbisson <sbis...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits