jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/341824 )

Change subject: Add basic browser tests for filter options
......................................................................


Add basic browser tests for filter options

Bug: T159522
Change-Id: I44f71ad923421ed37d2e7d65ee80dda2628c45bc
---
A tests/browser/features/filter_options.feature
M tests/browser/features/support/pages/edit_conflict_page.rb
M tests/browser/features/support/pages/special_preferences_page.rb
M tests/browser/features/support/step_definitions/edit_conflict_steps.rb
M tests/browser/features/support/step_definitions/edit_steps.rb
5 files changed, 109 insertions(+), 3 deletions(-)

Approvals:
  Addshore: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/browser/features/filter_options.feature 
b/tests/browser/features/filter_options.feature
new file mode 100644
index 0000000..918a852
--- /dev/null
+++ b/tests/browser/features/filter_options.feature
@@ -0,0 +1,31 @@
+@chrome @en.wikipedia.beta.wmflabs.org @firefox @integration
+Feature: Two column edit conflict screen
+  Background:
+    Given I am logged in
+    And I have reset my preferences
+    And TwoColConflict is enabled as a beta feature
+
+  Scenario: Show only mine filter hides foreign changes
+    When I handle a multi line edit conflict
+    And I select the show mine option
+    Then The two column edit conflict screen should be shown
+    And Section for common changes should be there
+    And Section for full common changes should be there
+    And Section for collapsed common changes should not be there
+    And Section for foreign changes should not be there
+
+  Scenario: Hide common changes filter collapses common changes
+    When I handle a multi line edit conflict
+    And I select the hide unchanged text option
+    Then The two column edit conflict screen should be shown
+    And Section for collapsed common changes should be there
+    And Section for full common changes should not be there
+
+  Scenario: Show hidden common changes when clicking the collapsed text
+    When I handle a multi line edit conflict
+    And I select the hide unchanged text option
+    And I click on the collapsed common changes
+    Then The two column edit conflict screen should be shown
+    And Section for full common changes should be there
+    And Section for collapsed common changes should not be there
+    And The show unchanged text option should be selected
diff --git a/tests/browser/features/support/pages/edit_conflict_page.rb 
b/tests/browser/features/support/pages/edit_conflict_page.rb
index e64f140..e5d2ba4 100644
--- a/tests/browser/features/support/pages/edit_conflict_page.rb
+++ b/tests/browser/features/support/pages/edit_conflict_page.rb
@@ -7,8 +7,28 @@
   div(:twocolconflict_editor_desc, css: '.mw-twocolconflict-editor-col 
.mw-twocolconflict-col-desc')
   text_area(:twocolconflict_editor_text, css: '.mw-twocolconflict-editor-col 
textarea')
   div(:twocolconflict_changes_same, css: '#mw-twocolconflict-changes-editor 
.mw-twocolconflict-diffchange-same')
+  div(
+      :twocolconflict_changes_same_full,
+      css: '#mw-twocolconflict-changes-editor 
.mw-twocolconflict-diffchange-same-full'
+  )
+  div(
+      :twocolconflict_changes_same_collapsed,
+      css: '#mw-twocolconflict-changes-editor 
.mw-twocolconflict-diffchange-same-collapsed'
+  )
   div(:twocolconflict_changes_foreign, css: '#mw-twocolconflict-changes-editor 
.mw-twocolconflict-diffchange-foreign')
   div(:twocolconflict_changes_own, css: '#mw-twocolconflict-changes-editor 
.mw-twocolconflict-diffchange-own')
-  div(:twocolconflict_changes_title_foreign, css: 
'#mw-twocolconflict-changes-editor .mw-twocolconflict-diffchange-foreign 
.mw-twocolconflict-diffchange-title')
-  div(:twocolconflict_changes_title_own, css: 
'#mw-twocolconflict-changes-editor .mw-twocolconflict-diffchange-own 
.mw-twocolconflict-diffchange-title')
+  div(
+      :twocolconflict_changes_title_foreign,
+      css: '#mw-twocolconflict-changes-editor 
.mw-twocolconflict-diffchange-foreign .mw-twocolconflict-diffchange-title'
+  )
+  div(:twocolconflict_changes_title_own,
+      css: '#mw-twocolconflict-changes-editor 
.mw-twocolconflict-diffchange-own .mw-twocolconflict-diffchange-title'
+  )
+
+  div(:twocolconflict_option_both_div, xpath: 
'(//*[@name="mw-twocolconflict-show-changes"]//parent::div)[1]')
+  div(:twocolconflict_option_mine_div, xpath: 
'(//*[@name="mw-twocolconflict-show-changes"]//parent::div)[2]')
+
+  radio_button(:twocolconflict_option_show, xpath: 
'(//*[@name="mw-twocolconflict-same"])[1]')
+  div(:twocolconflict_option_show_div, xpath: 
'(//*[@name="mw-twocolconflict-same"]//parent::div)[1]')
+  div(:twocolconflict_option_hide_div, xpath: 
'(//*[@name="mw-twocolconflict-same"]//parent::div)[2]')
 end
diff --git a/tests/browser/features/support/pages/special_preferences_page.rb 
b/tests/browser/features/support/pages/special_preferences_page.rb
index 48ff32a..1f76044 100644
--- a/tests/browser/features/support/pages/special_preferences_page.rb
+++ b/tests/browser/features/support/pages/special_preferences_page.rb
@@ -20,4 +20,4 @@
     twocolconflict_checkbox_div_element.click
     submit_button_element.when_visible.click
   end
-end
\ No newline at end of file
+end
diff --git 
a/tests/browser/features/support/step_definitions/edit_conflict_steps.rb 
b/tests/browser/features/support/step_definitions/edit_conflict_steps.rb
index 2ce61eb..b65a22e 100644
--- a/tests/browser/features/support/step_definitions/edit_conflict_steps.rb
+++ b/tests/browser/features/support/step_definitions/edit_conflict_steps.rb
@@ -49,6 +49,14 @@
   expect(on(EditConflictPage).twocolconflict_changes_same_element).to 
be_visible
 end
 
+Then(/^Section for full common changes should be there$/) do
+  expect(on(EditConflictPage).twocolconflict_changes_same_full_element).to 
be_visible
+end
+
+Then(/^Section for collapsed common changes should be there$/) do
+  
expect(on(EditConflictPage).twocolconflict_changes_same_collapsed_element).to 
be_visible
+end
+
 Then(/^Section for foreign changes should be there$/) do
   expect(on(EditConflictPage).twocolconflict_changes_foreign_element).to 
be_visible
 end
@@ -59,6 +67,14 @@
 
 Then(/^Section for common changes should not be there$/) do
   expect(on(EditConflictPage).twocolconflict_changes_same_element).not_to 
be_visible
+end
+
+Then(/^Section for full common changes should not be there$/) do
+  expect(on(EditConflictPage).twocolconflict_changes_same_full_element).not_to 
be_visible
+end
+
+Then(/^Section for collapsed common changes should not be there$/) do
+  
expect(on(EditConflictPage).twocolconflict_changes_same_collapsed_element).not_to
 be_visible
 end
 
 Then(/^Section for foreign changes should not be there$/) do
@@ -76,3 +92,27 @@
 Then(/^Own version title should be there$/) do
   expect(on(EditConflictPage).twocolconflict_changes_title_own_element).to 
be_visible
 end
+
+When(/^I select the show mine option$/) do
+  
on(EditConflictPage).twocolconflict_option_mine_div_element.when_present.click
+end
+
+When(/^I select the hide unchanged text option$/) do
+  
on(EditConflictPage).twocolconflict_option_hide_div_element.when_present.click
+end
+
+When(/^I handle a multi line edit conflict$/) do
+  step 'I go to the "TwoColConflict Test Page" page with multi line content'
+  step 'I click Edit'
+  step 'Another user changes the multi line content of the "TwoColConflict 
Test Page" page'
+  step 'I edit the page with "ChangeB"'
+  step 'I save the edit'
+end
+
+When(/^I click on the collapsed common changes$/) do
+  
on(EditConflictPage).twocolconflict_changes_same_collapsed_element.when_present.click
+end
+
+Then(/^The show unchanged text option should be selected$/) do
+  expect(on(EditConflictPage).twocolconflict_option_show_selected?).to 
be_truthy
+end
diff --git a/tests/browser/features/support/step_definitions/edit_steps.rb 
b/tests/browser/features/support/step_definitions/edit_steps.rb
index 5893d5b..f0a928c 100644
--- a/tests/browser/features/support/step_definitions/edit_steps.rb
+++ b/tests/browser/features/support/step_definitions/edit_steps.rb
@@ -7,3 +7,18 @@
     )
   end
 end
+
+Given(/^I go to the "(.+)" page with multi line content$/) do |page_title|
+  api.create_page page_title, 
"Line1\n\nLine2\n\nLine3\n\nLine4\n\nLine5\n\nLine6\n\nLine7"
+  step "I am on the #{page_title} page"
+end
+
+When(/^Another user changes the multi line content of the "(.+?)" page$/) do 
|page_title|
+  as_user(:conflicting_user) do
+    api.edit(
+        title: page_title,
+        text: 
"Line1\n\nLine2\n\nLine3ChangeA\n\nLine4\n\nLine5\n\nLine6\n\nLine7ChangeA",
+        summary: 'Conflicting edit'
+    )
+  end
+end

-- 
To view, visit https://gerrit.wikimedia.org/r/341824
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I44f71ad923421ed37d2e7d65ee80dda2628c45bc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TwoColConflict
Gerrit-Branch: master
Gerrit-Owner: WMDE-Fisch <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to