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

Change subject: Add browser tests for the "add form" story.
......................................................................


Add browser tests for the "add form" story.

This browser test only tests the UI part of the story without checking
that the new form gets persisted.

Bug: T162338
Change-Id: I9527ddd13933c7acb43f4ac6a1dc7ac43d6cd8e3
---
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, 36 insertions(+), 0 deletions(-)

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



diff --git a/tests/browser/features/forms.feature 
b/tests/browser/features/forms.feature
index 9cbb4b4..989794a 100644
--- a/tests/browser/features/forms.feature
+++ b/tests/browser/features/forms.feature
@@ -16,3 +16,11 @@
   @integration
   Scenario: View Forms grammatical features
     And for each Form there is a grammatical feature list
+
+  @integration
+  Scenario: Add Form
+    When I am on a Lexeme page
+     And I click the Forms list add button
+     And I enter "whatever" as the form representation
+     And I save the new Form
+    Then "whatever" should be displayed as a representation in the list of 
Forms
diff --git a/tests/browser/features/step_definitions/forms_steps.rb 
b/tests/browser/features/step_definitions/forms_steps.rb
index 87dfceb..d22375b 100644
--- a/tests/browser/features/step_definitions/forms_steps.rb
+++ b/tests/browser/features/step_definitions/forms_steps.rb
@@ -22,3 +22,25 @@
     expect(form.grammatical_features?).to be true
   end
 end
+
+When(/^I click the Forms list add button$/) do
+  on(LexemePage).add_lexeme_form_element.when_visible.click
+end
+
+When(/^I enter "(.+)" as the form representation$/) do |representation|
+  on(LexemePage) do |page|
+    page.lexeme_form_input_field_element.when_visible.clear
+    page.lexeme_form_input_field = representation
+  end
+end
+
+When(/^I save the new Form$/) do
+  on(LexemePage).lexeme_form_save_element.when_visible.click
+end
+
+Then(/^"(.+)" should be displayed as a representation in the list of Forms$/) 
do |representation|
+  has_lexeme_form = on(LexemePage).lexeme_form_representation_text_elements
+    .any? { |element| element.text == representation }
+
+  expect(has_lexeme_form).to be true
+end
diff --git a/tests/browser/features/support/pages/lexeme_page.rb 
b/tests/browser/features/support/pages/lexeme_page.rb
index 63817ac..1defed2 100644
--- a/tests/browser/features/support/pages/lexeme_page.rb
+++ b/tests/browser/features/support/pages/lexeme_page.rb
@@ -18,6 +18,12 @@
 
   page_sections(:forms, LexemeForm, class: 'wikibase-lexeme-form')
 
+  # Lexeme Form
+  a(:add_lexeme_form, css: '.wikibase-lexeme-forms-section > 
.wikibase-addtoolbar-container a')
+  textarea(:lexeme_form_input_field, css: 
'.wikibase-lexemeformview:last-of-type .wikibase-lexeme-form-text > textarea')
+  spans(:lexeme_form_representation_text, css: 
'.wikibase-lexeme-form-representation .wikibase-lexeme-form-text')
+  a(:lexeme_form_save, css: '.wikibase-lexemeformview:last-of-type 
.wikibase-toolbar-button-save > a')
+
   def create_lexeme(lexeme_data)
     wb_api = MediawikiApi::Wikidata::WikidataClient.new URL.repo_api
     resp = wb_api.create_entity(lexeme_data, "lexeme")

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I9527ddd13933c7acb43f4ac6a1dc7ac43d6cd8e3
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/extensions/WikibaseLexeme
Gerrit-Branch: master
Gerrit-Owner: Jakob <[email protected]>
Gerrit-Reviewer: Aleksey Bekh-Ivanov (WMDE) <[email protected]>
Gerrit-Reviewer: Jonas Kress (WMDE) <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: WMDE-leszek <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to