Mooeypoo has uploaded a new change for review.
https://gerrit.wikimedia.org/r/246794
Change subject: Add browser tests for adding/removing categories
......................................................................
Add browser tests for adding/removing categories
Change-Id: I0e87a2913be4a7c20003c1b1bef7fc05b2b3d4fc
---
M tests/browser/features/description.feature
M tests/browser/features/step_definitions/description_steps.rb
M tests/browser/features/support/components/board_description.rb
3 files changed, 66 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/94/246794/1
diff --git a/tests/browser/features/description.feature
b/tests/browser/features/description.feature
index 00f591f..f2ccf42 100644
--- a/tests/browser/features/description.feature
+++ b/tests/browser/features/description.feature
@@ -19,3 +19,17 @@
Given I set the description to "first version"
When I set the description to "second version"
Then the description should be "second version"
+
+ Scenario: Add a category to new board
+ When I add category "Footegory" to the description
+ Then the categories contain "Footegory"
+
+ Scenario: Add multiple categories to new board
+ When I add categories "Footegory" and "Mootegory" to the description
+ Then the categories contain "Footegory"
+ And the categories contain "Mootegory"
+
+ Scenario: Remove categories from a new board
+ Given the board contains categories "Footegory" and "Mootegory"
+ When I remove category "Footegory" from the description
+ Then the categories do not contain "Footegory"
diff --git a/tests/browser/features/step_definitions/description_steps.rb
b/tests/browser/features/step_definitions/description_steps.rb
index a43c649..7d820f0 100644
--- a/tests/browser/features/step_definitions/description_steps.rb
+++ b/tests/browser/features/step_definitions/description_steps.rb
@@ -17,3 +17,51 @@
Then(/^the description should be empty$/) do
step "the description should be \"\""
end
+
+When(/^I add category "(.*?)" to the description$/) do |category_text|
+ on(FlowPage) do |page|
+ page.description.edit
+ page.description.editor_element.when_present.send_keys '[[Category:' +
category_text + ']]'
+ page.description.save
+ page.description.categories_element.when_present
+ end
+end
+
+When(/^I add categories "(.*?)" and "(.*?)" to the description$/) do |cat1,
cat2|
+ on(FlowPage) do |page|
+ page.description.edit
+ page.description.editor_element.when_present.send_keys '[[Category:' +
+ cat1 + ']]' + "\n" +
+ '[[Category:' + cat2 + ']]'
+ page.description.save
+ page.description.categories_element.when_present
+ end
+end
+
+When(/^I remove category "(.*?)" from the description$/) do |category_text|
+ on(FlowPage) do |page|
+ page.description.edit
+ text = page.description.editor_element.when_present.text
+ text.slice! "[[Category:#{category_text}]]"
+ page.description.editor_element.when_present.clear
+ page.description.editor_element.when_present.send_keys text
+ page.description.save
+ page.description.categories_element.when_present
+ end
+end
+
+When(/^the board contains categories "(.*?)" and "(.*?)"$/) do |cat1, cat2|
+ step "I add categories \"#{cat1}\" and \"#{cat2}\" to the description"
+end
+
+When(/^the categories contain "(.*?)"$/) do |category_text|
+ on(FlowPage) do |page|
+ page.description.category_item(category_text).exists?
+ end
+end
+
+When(/^the categories do not contain "(.*?)"$/) do |category_text|
+ on(FlowPage) do |page|
+ expect(page.description.category_item(category_text)).not_to exist
+ end
+end
diff --git a/tests/browser/features/support/components/board_description.rb
b/tests/browser/features/support/components/board_description.rb
index 0d67502..73c6d96 100644
--- a/tests/browser/features/support/components/board_description.rb
+++ b/tests/browser/features/support/components/board_description.rb
@@ -11,10 +11,14 @@
a(:toggle, class: "side-rail-toggle-button")
div(:editor_widget, class: 'flow-ui-boardDescriptionWidget-editor')
+ div(:categories, class: 'flow-ui-categoriesWidget' )
def editor_element
visualeditor_or_textarea editor_widget_element
end
+ def category_item(itemName)
+ categories_element.link_element(text: itemName)
+ end
link(:save, text: /Save description.*/)
--
To view, visit https://gerrit.wikimedia.org/r/246794
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0e87a2913be4a7c20003c1b1bef7fc05b2b3d4fc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits