Tobias Gritschacher has uploaded a new change for review.
https://gerrit.wikimedia.org/r/63854
Change subject: Selenium tests for false edit-conflicts in claim editing
......................................................................
Selenium tests for false edit-conflicts in claim editing
Bug: 48138
Change-Id: Ic27263a040d4d04ca330409ef4fbe238d33a602a
---
M repo/tests/selenium/statements/statements_bugs_spec.rb
M selenium/lib/modules/reference_module.rb
M selenium/lib/modules/statement_module.rb
3 files changed, 68 insertions(+), 24 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/54/63854/1
diff --git a/repo/tests/selenium/statements/statements_bugs_spec.rb
b/repo/tests/selenium/statements/statements_bugs_spec.rb
index 8d57146..58b00a5 100644
--- a/repo/tests/selenium/statements/statements_bugs_spec.rb
+++ b/repo/tests/selenium/statements/statements_bugs_spec.rb
@@ -8,28 +8,48 @@
require 'spec_helper'
-item_label = generate_random_string(10)
-item_description = generate_random_string(20)
-prop_a_label = generate_random_string(10)
-prop_a_description = generate_random_string(20)
-prop_a_datatype = "Commons media file"
statement_value = generate_random_string(10)
+
+num_items = 2
+num_props_cm = 2
+
+# items
+count = 0
+items = Array.new
+while count < num_items do
+ items.push({"label"=>generate_random_string(10),
"description"=>generate_random_string(20)})
+ count = count + 1
+end
+
+# commons media properties
+count = 0
+properties_cm = Array.new
+while count < num_props_cm do
+ properties_cm.push({"label"=>generate_random_string(10),
"description"=>generate_random_string(20), "datatype"=>"Commons media file"})
+ count = count + 1
+end
describe "Check for bugs in statements UI" do
before :all do
# set up: create item & property
- visit_page(CreateItemPage) do |page|
- page.create_new_item(item_label, item_description)
+ items.each do |item|
+ visit_page(CreateItemPage) do |page|
+ item['id'] = page.create_new_item(item['label'], item['description'])
+ item['url'] = page.current_url
+ end
end
- visit_page(NewPropertyPage) do |page|
- page.create_new_property(prop_a_label, prop_a_description,
prop_a_datatype)
+ properties_cm.each do |property|
+ visit_page(NewPropertyPage) do |page|
+ property['id'] = page.create_new_property(property['label'],
property['description'], property['datatype'])
+ property['url'] = page.current_url
+ end
end
end
context "Check for bugs in statements UI" do
it "should check that save-button is disabled when property field is
empty" do
on_page(ItemPage) do |page|
- page.navigate_to_item
+ page.navigate_to items[0]["url"]
page.wait_for_entity_to_load
page.addStatement
page.saveStatement?.should be_false
@@ -38,10 +58,10 @@
end
it "should check that save-button is disabled when no property is
selected" do
on_page(ItemPage) do |page|
- page.navigate_to_item
+ page.navigate_to items[0]["url"]
page.wait_for_entity_to_load
page.addStatement
- page.entitySelectorInput = prop_a_label[0..8]
+ page.entitySelectorInput = properties_cm[0]['label'][0..8]
ajax_wait
page.wait_for_entity_selector_list
page.saveStatement?.should be_false
@@ -50,10 +70,10 @@
end
it "should check that save-button is disabled when property value field is
empty" do
on_page(ItemPage) do |page|
- page.navigate_to_item
+ page.navigate_to items[0]["url"]
page.wait_for_entity_to_load
page.addStatement
- page.entitySelectorInput = prop_a_label
+ page.entitySelectorInput =properties_cm[0]['label']
ajax_wait
page.wait_for_entity_selector_list
page.wait_for_property_value_box
@@ -64,10 +84,10 @@
end
it "should check that property-value-input gets removed when
property-field gets cleared" do
on_page(ItemPage) do |page|
- page.navigate_to_item
+ page.navigate_to items[0]["url"]
page.wait_for_entity_to_load
page.addStatement
- page.entitySelectorInput = prop_a_label
+ page.entitySelectorInput = properties_cm[0]['label']
ajax_wait
page.wait_for_entity_selector_list
page.wait_for_property_value_box
@@ -80,10 +100,10 @@
end
it "should check that selecting an entity from the entityselector by click
works" do
on_page(ItemPage) do |page|
- page.navigate_to_item
+ page.navigate_to items[0]["url"]
page.wait_for_entity_to_load
page.addStatement
- page.entitySelectorInput = prop_a_label[0..8]
+ page.entitySelectorInput = properties_cm[0]['label'][0..8]
ajax_wait
page.wait_for_entity_selector_list
page.firstEntitySelectorLink
@@ -95,9 +115,9 @@
end
it "should check that save-button is disabled in edit-mode when value has
not changed or is empty" do
on_page(ItemPage) do |page|
- page.navigate_to_item
+ page.navigate_to items[0]["url"]
page.wait_for_entity_to_load
- page.add_statement(prop_a_label, statement_value)
+ page.add_statement(properties_cm[0]['label'], statement_value)
page.editFirstStatement
page.saveStatement?.should be_false
page.statementValueInput_element.clear
@@ -107,10 +127,10 @@
end
it "should check that cancel editmode is possible when property and
statement-value fields are empty" do
on_page(ItemPage) do |page|
- page.navigate_to_item
+ page.navigate_to items[0]["url"]
page.wait_for_entity_to_load
page.addStatement
- page.entitySelectorInput = prop_a_label
+ page.entitySelectorInput = properties_cm[0]['label']
ajax_wait
page.wait_for_entity_selector_list
page.wait_for_property_value_box
@@ -126,6 +146,30 @@
page.addStatement?.should be_true
end
end
+ it "should check that no false edit-conflicts occur" do
+ on_page(ItemPage) do |page|
+ page.navigate_to items[1]["url"]
+ page.wait_for_entity_to_load
+ page.add_statement(properties_cm[0]['label'],
generate_random_string(10))
+ page.add_statement(properties_cm[1]['label'],
generate_random_string(10))
+ page.wait_for_entity_to_load
+ page.addReferenceToFirstClaim?.should be_true
+ page.addReferenceToSecondClaim?.should be_true
+ page.add_reference_to_first_claim(properties_cm[0]['label'],
generate_random_string(10))
+ page.addReferenceToSecondClaim
+ page.entitySelectorInput = properties_cm[1]['label']
+ ajax_wait
+ page.wait_for_entity_selector_list
+ page.wait_for_reference_value_box
+ page.referenceValueInput = generate_random_string(10)
+ ajax_wait
+ page.saveReference
+ ajax_wait
+ page.wbErrorDiv?.should be_false
+ page.wait_for_statement_request_finished
+ page.wbErrorDiv?.should be_false
+ end
+ end
end
after :all do
diff --git a/selenium/lib/modules/reference_module.rb
b/selenium/lib/modules/reference_module.rb
index c9d6510..f30b6c0 100644
--- a/selenium/lib/modules/reference_module.rb
+++ b/selenium/lib/modules/reference_module.rb
@@ -36,7 +36,8 @@
link(:removeReferenceLine1, :xpath => "//div[contains(@class,
'wb-referenceview')]/div[contains(@class,
'wb-snaklistview-listview')]/div[contains(@class,
'wb-snakview')][1]/span[contains(@class,
'wb-removetoolbar')]/div/span/span/a[text()='remove']")
link(:removeReferenceLine2, :xpath => "//div[contains(@class,
'wb-referenceview')]/div[contains(@class,
'wb-snaklistview-listview')]/div[contains(@class,
'wb-snakview')][2]/span[contains(@class,
'wb-removetoolbar')]/div/span/span/a[text()='remove']")
link(:addReferenceLine, :xpath => "//div[contains(@class,
'wb-referenceview')]/span[contains(@class,
'wb-addtoolbar')]/div/span/span/a[text()='add']")
- link(:addReferenceToFirstClaim, :xpath => "//div[contains(@class,
'wb-statement-references-container')][1]/div[contains(@class,
'wb-statement-references')]/span[contains(@class,
'wb-addtoolbar')]/div/span/span/a")
+ link(:addReferenceToFirstClaim, :text => "add source", :index => 0)
+ link(:addReferenceToSecondClaim, :text => "add source", :index => 1)
link(:editReference1, :xpath => "//div[contains(@class,
'wb-referenceview')][1]/span[contains(@class,
'wb-edittoolbar')]/span/span/span/span/a[text()='edit']")
def wait_for_reference_value_box
diff --git a/selenium/lib/modules/statement_module.rb
b/selenium/lib/modules/statement_module.rb
index e35e389..53fdc22 100644
--- a/selenium/lib/modules/statement_module.rb
+++ b/selenium/lib/modules/statement_module.rb
@@ -57,7 +57,6 @@
self.wait_for_property_value_box
if self.statementValueInput?
self.statementValueInput = statement_value
- # TODO: bug 43609: Regarding item property, as long as no verification
of the input is done, we have to wait for the entityselector to finish the
selection
ajax_wait
end
saveStatement
--
To view, visit https://gerrit.wikimedia.org/r/63854
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic27263a040d4d04ca330409ef4fbe238d33a602a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Tobias Gritschacher <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits