From 4aa8be0e71f076cd23da7c609101eee8b2c8a08f Mon Sep 17 00:00:00 2001 From: "ryasmeen@wikimedia.org" Date: Tue, 4 Nov 2014 12:21:28 +0100 Subject: [PATCH] [BrowserTest] WIP adding cases to test other options under Page Settings to options.feature Also: * Fixed a typo in options_steps.rb * Disabled Metrics/ClassLength Rubocop cop. Change-Id: I7128ba8f7ebf9c63aef9399a9cdf24831e1a2d38 --- .rubocop.yml | 3 ++ .rubocop_todo.yml | 5 ---- .../tests/browser/features/options.feature | 20 ++++++++++--- .../step_definitions/options_steps.rb | 29 +++++++++++++++---- .../support/pages/visual_editor_page.rb | 8 ++++- 5 files changed, 50 insertions(+), 15 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index cc32da4b99..bbb0089466 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1 +1,4 @@ inherit_from: .rubocop_todo.yml + +Metrics/ClassLength: + Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 8486652cee..809449ba4d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -23,11 +23,6 @@ Lint/ParenthesesAsGroupedExpression: Lint/UnusedBlockArgument: Enabled: false -# Offense count: 1 -# Configuration parameters: CountComments. -Metrics/ClassLength: - Max: 167 - # Offense count: 185 # Configuration parameters: AllowURI, URISchemes. Metrics/LineLength: diff --git a/modules/ve-mw/tests/browser/features/options.feature b/modules/ve-mw/tests/browser/features/options.feature index af85cb1271..ad769313cb 100644 --- a/modules/ve-mw/tests/browser/features/options.feature +++ b/modules/ve-mw/tests/browser/features/options.feature @@ -1,9 +1,21 @@ @chrome @en.wikipedia.beta.wmflabs.org @firefox @internet_explorer_10 @safari @test2.wikipedia.org Feature: VisualEditor Options - Scenario: Options + Background: Given I go to the "Options VisualEditor Test" page with content "Options VisualEditor Test" And I click in the editable part - When I click the hamburger menu - And I click Options - Then I should see the options overlay \ No newline at end of file + And I click the hamburger menu + + Scenario: Options + When I click Options + Then I should see the options overlay + + Scenario: Advanced Settings + When I click Advanced Settings + Then I should see the options overlay + And the options overlay should display Advanced Settings + + Scenario: Page Settings + When I click Page Settings + Then I should see the options overlay + And the options overlay should display Page Settings \ No newline at end of file diff --git a/modules/ve-mw/tests/browser/features/step_definitions/options_steps.rb b/modules/ve-mw/tests/browser/features/step_definitions/options_steps.rb index e9dff27b71..ed0c7b7728 100644 --- a/modules/ve-mw/tests/browser/features/step_definitions/options_steps.rb +++ b/modules/ve-mw/tests/browser/features/step_definitions/options_steps.rb @@ -1,12 +1,31 @@ - -When(/^I click the hamburger menu$/) do - on(VisualEditorPage).hamburger_menu_element.when_present.click +When(/^I click Advanced Settings$/) do + on(VisualEditorPage).option_advanced_settings_element.when_present.click end When(/^I click Options$/) do on(VisualEditorPage).options_in_hamburger_element.when_present.click end -Then(/^I should see the options overlay$/) do - on(VisualEditorPage).options_page_title_element.when_present.should be_visible +When(/^I click Page Settings$/) do + on(VisualEditorPage).option_page_settings_element.when_present.click end + +When(/^I click the hamburger menu$/) do + on(VisualEditorPage).hamburger_menu_element.when_present.click +end + +When(/^I see options overlay$/) do + on(VisualEditorPage).options_page_title_element.when_present +end + +Then(/^I should see the options overlay$/) do + expect(on(VisualEditorPage).options_page_title_element.when_present).to be_visible +end + +Then(/^the options overlay should display Advanced Settings$/) do + expect(on(VisualEditorPage).options_settings_content_element.text).to match "Advanced settings" +end + +Then(/^the options overlay should display Page Settings$/) do + expect(on(VisualEditorPage).options_settings_content_element.text).to match "Page settings" +end \ No newline at end of file diff --git a/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb b/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb index f0bf700a2c..1f8ce008cb 100644 --- a/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb +++ b/modules/ve-mw/tests/browser/features/support/pages/visual_editor_page.rb @@ -26,6 +26,8 @@ class VisualEditorPage span(:looks_good, class: "oo-ui-labelElement-label", text: "Looks good to me") div(:medium_dialog, class: "oo-ui-window oo-ui-dialog oo-ui-dialog-open oo-ui-dialog-medium") span(:options_in_hamburger, class: "oo-ui-tool-title", text: "Options") + span(:option_advanced_settings, class:"oo-ui-tool-title", text:"Advanced settings") + span(:option_page_settings, class:"oo-ui-tool-title", text:"Page settings") div(:page_text, id: "mw-content-text") a(:page_title, text: /Page title/) a(:paragraph, text: /Paragraph/) @@ -149,6 +151,8 @@ class VisualEditorPage span(:confirm_switch_cancel_on_switch, text: "Cancel") span(:confirm_switch_discard, text: "Discard changes") + div(:options_settings_content, class: "oo-ui-layout oo-ui-panelLayout oo-ui-panelLayout-scrollable oo-ui-panelLayout-expanded oo-ui-pageLayout oo-ui-pageLayout-active") + in_iframe(index: 0) do |frame| a(:beta_warning, title: "Close", frame: frame) div(:content_box, class: "ve-ce-documentNode ve-ce-branchNode", frame: frame) @@ -183,6 +187,7 @@ class VisualEditorPage a(:insert_media, css: "div.oo-ui-processDialog-actions-primary > div.oo-ui-buttonElement-frameless > a", frame: frame) text_area(:formula_area, class: "oo-ui-ltr", frame: frame) div(:settings_apply_button, class: "oo-ui-processDialog-actions-primary", frame: frame) + end # not having beta warning makes iframes off by one @@ -190,6 +195,7 @@ class VisualEditorPage div(:links_diff_view, class: "ve-ui-mwSaveDialog-viewer", frame: frame) span(:links_review_changes, class: "oo-ui-labelElement-label", text: "Review your changes", frame: frame) div(:media_diff_view, class: "ve-ui-mwSaveDialog-viewer", frame: frame) - + span(:media_exit, text: "Return to save form", frame: frame) + div(:advanced_settings_overlay, class:"oo-ui-layout oo-ui-iconElement oo-ui-labelElement oo-ui-fieldsetLayout", frame: frame) end end