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

Change subject: Add browser test for removing a grammatical feature.
......................................................................


Add browser test for removing a grammatical feature.

Bug: T163972
Change-Id: I161d8c06414f52f4ea7d958dd73de61f43c822c1
---
M tests/browser/features/forms.feature
M tests/browser/features/step_definitions/forms_steps.rb
M tests/browser/features/support/pages/lexeme_page.rb
3 files changed, 39 insertions(+), 4 deletions(-)

Approvals:
  WMDE-leszek: Checked; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/browser/features/forms.feature 
b/tests/browser/features/forms.feature
index 9f9c7db..c2794b2 100644
--- a/tests/browser/features/forms.feature
+++ b/tests/browser/features/forms.feature
@@ -22,16 +22,25 @@
     Given I have a Lexeme with a Form
      And I am on the page of the Lexeme to test
      And I have an item to test
-    When I click on first Form's edit button
+    When I click on the first Form's edit button
      And I select the test item as the grammatical feature
      And I save the Form
     Then I should see the item's label in the list of grammatical features of 
the Form
 
   @integration
+  Scenario: Remove grammatical feature
+    Given I have a Lexeme with a Form
+     And I am on the page of the Lexeme to test
+     And a grammatical feature exists for the first Form of the Lexeme
+    When I click on the first Form's edit button
+     And I remove the first grammatical feature of the first Form
+    Then the first Form should no longer have the removed grammatical feature
+
+  @integration
   Scenario: Change representation
     Given I have a Lexeme with a Form
      And I am on the page of the Lexeme to test
-    When I click on first Form's edit button
+    When I click on the first Form's edit button
      And I enter "new-representation" as the form representation
      And I save the Form
     Then "new-representation" should be displayed as a representation of the 
Form
diff --git a/tests/browser/features/step_definitions/forms_steps.rb 
b/tests/browser/features/step_definitions/forms_steps.rb
index a5d3798..446bb17 100644
--- a/tests/browser/features/step_definitions/forms_steps.rb
+++ b/tests/browser/features/step_definitions/forms_steps.rb
@@ -57,7 +57,7 @@
   step 'I have a Lexeme to test' # TODO: implement once Forms are storable
 end
 
-When(/^I click on first Form's edit button$/) do
+When(/^I click on the first Form's edit button$/) do
   @form_I_am_currently_editing = on(LexemePage).forms[0]
   @form_I_am_currently_editing.edit_element.when_visible.click
 end
@@ -98,3 +98,24 @@
 
   
expect(@form_I_am_currently_editing.statement_group.statement_with_value?(property_label,
 property_value)).to be true
 end
+
+Given(/^a grammatical feature exists for the first Form of the Lexeme$/) do
+  # TODO: the grammatical feature to remove should be added in the backend 
once Forms can be stored
+  step 'I have an item to test'
+  step 'I click on the first Form\'s edit button'
+  step 'I select the test item as the grammatical feature'
+  step 'I save the Form'
+end
+
+When(/^I remove the first grammatical feature of the first Form$/) do
+  gf_to_delete = on(LexemePage).forms[0].grammatical_features[0]
+  @grammatical_feature_to_delete = gf_to_delete.text
+
+  gf_to_delete.delete_button_element
+      .when_visible
+      .click
+end
+
+Then(/^the first Form should no longer have the removed grammatical feature$/) 
do
+  
expect(@form_I_am_currently_editing.grammatical_feature?(@grammatical_feature_to_delete)).to
 be false
+end
diff --git a/tests/browser/features/support/pages/lexeme_page.rb 
b/tests/browser/features/support/pages/lexeme_page.rb
index d11120f..5726413 100644
--- a/tests/browser/features/support/pages/lexeme_page.rb
+++ b/tests/browser/features/support/pages/lexeme_page.rb
@@ -24,6 +24,7 @@
   include PageObject
 
   a(:value)
+  a(:delete_button, css: '.oo-ui-buttonElement > .oo-ui-buttonElement-button')
 end
 
 class LexemeForm
@@ -40,7 +41,11 @@
   a(:grammatical_feature_selection_first_option, css: 
'.wikibase-lexeme-form-grammatical-features-values 
.oo-ui-menuOptionWidget:first-of-type a')
 
   page_section(:statement_group, StatementGroup, class: 
'wikibase-statementgrouplistview')
-  page_sections(:grammatical_features, GrammaticalFeatureValue, css: 
'.wikibase-lexeme-form-grammatical-features-values > span')
+  page_sections(
+    :grammatical_features,
+    GrammaticalFeatureValue,
+    css: '.wikibase-lexeme-form-grammatical-features-values > span, 
.wikibase-lexeme-form-grammatical-features-values .oo-ui-tagItemWidget'
+  )
 
   def grammatical_feature?(label)
     self.grammatical_features.any? do |gf|

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I161d8c06414f52f4ea7d958dd73de61f43c822c1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseLexeme
Gerrit-Branch: master
Gerrit-Owner: Jakob <jakob.warkot...@wikimedia.de>
Gerrit-Reviewer: WMDE-leszek <leszek.mani...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to