jenkins-bot has submitted this change and it was merged.

Change subject: QA: Browser test for Thank feature in Flow
......................................................................


QA: Browser test for Thank feature in Flow

Adjustment to work by Benjamin Chan

thank.feature tests for two scenarios:
- Anon does not see Thank button
- Cannot thank own post

Bug: 61930
Change-Id: Icd9afc0a12b228bdbb682959e527cdad5d3253b1
---
A tests/browser/features/step_definitions/thank_steps.rb
M tests/browser/features/support/pages/flow_page.rb
A tests/browser/features/thank.feature
A tests/browser/foo.diff
4 files changed, 62 insertions(+), 0 deletions(-)

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



diff --git a/tests/browser/features/step_definitions/thank_steps.rb 
b/tests/browser/features/step_definitions/thank_steps.rb
new file mode 100644
index 0000000..7fa248c
--- /dev/null
+++ b/tests/browser/features/step_definitions/thank_steps.rb
@@ -0,0 +1,27 @@
+Then(/^I do not see a Thank button$/) do
+  on(FlowPage).thank_button_element.should_not exist
+end
+
+Then(/^I do not see a Thanked button$/) do
+  on(FlowPage).thanked_button_element.should_not exist
+end
+
+Then(/^I should see the Thank button be replaced with Thanked button$/) do
+  # TODO: If we decide to use a loading indicator for the thank button,
+  # then condition can be changed to loading_indicator.when_not_present.
+  @target_container.span_element(class: 'mw-thanks-flow-thanked').when_visible
+end
+
+When(/^I see a Thank button$/) do
+  # Carry on with the test per normal if the element is present.
+  on(FlowPage).thank_button_element.should be_visible
+  @target_container = on(FlowPage).thank_button_element.parent
+end
+
+When(/^I click on the Thank button$/) do
+  on(FlowPage).thank_button_element.click
+end
+
+Then(/^I should not see the Thank button for that post$/) do
+  on(FlowPage).thank_button_element.should_not exist
+end
diff --git a/tests/browser/features/support/pages/flow_page.rb 
b/tests/browser/features/support/pages/flow_page.rb
index d031596..7dd9dba 100644
--- a/tests/browser/features/support/pages/flow_page.rb
+++ b/tests/browser/features/support/pages/flow_page.rb
@@ -123,6 +123,12 @@
   a(:edit_post) do |page|
     page.post_meta_actions_element.link_element(title: "Edit")
   end
+  a(:thank_button) do |page|
+    page.post_meta_actions_element.link_element(css: 
".mw-thanks-flow-thank-link", index: 0)
+  end
+  span(:thanked_button) do |page|
+    page.post_meta_actions_element.span_element(css: 
".mw-thanks-flow-thanked", index: 0)
+  end
 
   ### First post of first topic actions menu
   a(:post_actions_link, css: ".flow-topic .flow-post .flow-menu-js-drop a", 
index: 0)
diff --git a/tests/browser/features/thank.feature 
b/tests/browser/features/thank.feature
new file mode 100644
index 0000000..84319df
--- /dev/null
+++ b/tests/browser/features/thank.feature
@@ -0,0 +1,17 @@
[email protected] @en.wikipedia.beta.wmflabs.org @ee-prototype.wmflabs.org
+
+Feature: Thank author of a Flow post
+
+  @clean
+  Scenario: Anon does not see Thank button
+    Given I am on Flow page
+    When I see a flow creator element
+    Then I do not see a Thank button
+      And I do not see a Thanked button
+
+  @clean @login
+  Scenario: I cannot thank my own post
+    Given I am logged in
+      And I am on Flow page
+      And I have created a Flow topic
+    Then I should not see the Thank button for that post
diff --git a/tests/browser/foo.diff b/tests/browser/foo.diff
new file mode 100644
index 0000000..c2c2f1d
--- /dev/null
+++ b/tests/browser/foo.diff
@@ -0,0 +1,12 @@
+diff --git a/tests/browser/features/step_definitions/thank_steps.rb 
b/tests/browser/features/step_definitions/thank_steps.rb
+index 2d071eb..7fa248c 100644
+--- a/tests/browser/features/step_definitions/thank_steps.rb
++++ b/tests/browser/features/step_definitions/thank_steps.rb
+@@ -1,7 +1,3 @@
+-Given(/^the most recent topic is written by another user$/) do
+-  pending # express the regexp above with the code you wish you had
+-end
+-
+ Then(/^I do not see a Thank button$/) do
+   on(FlowPage).thank_button_element.should_not exist
+ end

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Icd9afc0a12b228bdbb682959e527cdad5d3253b1
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Bencmq <[email protected]>
Gerrit-Reviewer: Bencmq <[email protected]>
Gerrit-Reviewer: Cmcmahon <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Spage <[email protected]>
Gerrit-Reviewer: Zfilipin <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to