jenkins-bot has submitted this change and it was merged.
Change subject: Extending the label cucumber test
......................................................................
Extending the label cucumber test
Change-Id: I35c54506580ce097307f992ebc923f2b5afec259
---
M selenium_cuc/features/label.feature
M selenium_cuc/features/steps/label_steps.rb
M selenium_cuc/features/support/modules/entity_module.rb
3 files changed, 80 insertions(+), 8 deletions(-)
Approvals:
Zfilipin: Looks good to me, approved
jenkins-bot: Verified
diff --git a/selenium_cuc/features/label.feature
b/selenium_cuc/features/label.feature
index 4ae6df2..d5d3864 100644
--- a/selenium_cuc/features/label.feature
+++ b/selenium_cuc/features/label.feature
@@ -21,14 +21,50 @@
And Label cancel button should be there
Scenario: Modify the label
When I click the label edit button
- And I modify the label
+ And I enter MODIFIED LABEL as label
Then Label save button should be there
And Label cancel button should be there
And Label edit button should not be there
Scenario: Label cancel
When I click the label edit button
- And I modify the label
+ And I enter MODIFIED LABEL as label
And I click the label cancel button
Then Original label should be displayed
And Label edit button should be there
- And Label cancel button should not be there
\ No newline at end of file
+ And Label cancel button should not be there
+ Scenario: Label cancel with ESCAPE
+ When I click the label edit button
+ And I enter MODIFIED LABEL as label
+ And I press the ESC key
+ Then Original label should be displayed
+ And Label edit button should be there
+ And Label cancel button should not be there
+ Scenario: Label save
+ When I click the label edit button
+ And I enter MODIFIED LABEL as label
+ And I click the label save button
+ Then MODIFIED LABEL should be displayed as label
+ When I reload the page
+ Then MODIFIED LABEL should be displayed as label
+ Scenario: Label save with RETURN
+ When I click the label edit button
+ And I enter MODIFIED LABEL as label
+ And I press the RETURN key
+ Then MODIFIED LABEL should be displayed as label
+ When I reload the page
+ Then MODIFIED LABEL should be displayed as label
+ Scenario: Label with unnormalized value
+ When I click the label edit button
+ And I enter bla bla as label
+ And I click the label save button
+ Then bla bla should be displayed as label
+ Scenario: Label with "0" as value
+ When I click the label edit button
+ And I enter 0 as label
+ And I click the label save button
+ Then 0 should be displayed as label
+ Scenario: Label with a too long value
+ When I click the label edit button
+ And I enter
looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong
as label
+ And I click the label save button
+ Then An error message should be displayed
diff --git a/selenium_cuc/features/steps/label_steps.rb
b/selenium_cuc/features/steps/label_steps.rb
index e254d83..e9cb1a4 100644
--- a/selenium_cuc/features/steps/label_steps.rb
+++ b/selenium_cuc/features/steps/label_steps.rb
@@ -6,8 +6,7 @@
#
# tests for item label
-label = generate_random_string(10)
-label_changed = label + " Adding something."
+label = generate_random_string(8)
Given /^I am on an entity page$/ do
visit(CreateItemPage).create_new_item(label, generate_random_string(20))
@@ -17,15 +16,39 @@
on(ItemPage).editLabelLink
end
+When /^I press the ESC key$/ do
+ on(ItemPage).labelInputField_element.send_keys :escape
+end
+
+When /^I press the RETURN key$/ do
+ on(ItemPage) do |page|
+ page.labelInputField_element.send_keys :return
+ #page.ajax_wait
+ page.wait_for_api_callback
+ end
+end
+
When /^I click the label cancel button$/ do
on(ItemPage).cancelLabelLink
end
-When /^I modify the label$/ do
+When /^I click the label save button$/ do
+ on(ItemPage) do |page|
+ page.saveLabelLink
+ #page.ajax_wait
+ page.wait_for_api_callback
+ end
+end
+
+When /^I enter (.+) as label$/ do |value|
on(ItemPage) do |page|
page.labelInputField_element.clear
- page.labelInputField = label_changed
+ page.labelInputField = value
end
+end
+
+When /^I reload the page$/ do
+ @browser.refresh
end
Then /^Label edit button should be there$/ do
@@ -68,3 +91,16 @@
page.entityLabelSpan.should == label
end
end
+
+Then /^(.+) should be displayed as label$/ do |value|
+ on(ItemPage) do |page|
+ page.firstHeading.should be_true
+ page.entityLabelSpan.should be_true
+ @browser.title.include?(value).should be_true
+ page.entityLabelSpan.should == value
+ end
+end
+
+Then /^An error message should be displayed$/ do
+ on(ItemPage).wbErrorDiv?.should be_true
+end
diff --git a/selenium_cuc/features/support/modules/entity_module.rb
b/selenium_cuc/features/support/modules/entity_module.rb
index 1a9f8e0..78f3626 100644
--- a/selenium_cuc/features/support/modules/entity_module.rb
+++ b/selenium_cuc/features/support/modules/entity_module.rb
@@ -111,7 +111,7 @@
def ajax_wait
sleep 1
- while (script = @browser.execute_script("return jQuery.active")) == 1 do
+ while (script = @browser.execute_script("return jQuery.active")) != 0 do
sleep(1.0/3)
end
return true
--
To view, visit https://gerrit.wikimedia.org/r/79045
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I35c54506580ce097307f992ebc923f2b5afec259
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Tobias Gritschacher <[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