Jdlrobson has uploaded a new change for review. https://gerrit.wikimedia.org/r/211967
Change subject: QA: Fixes to browser tests ...................................................................... QA: Fixes to browser tests For unknown reasons an empty element is not being located via Selenium Chrome drive. To work around this: * Do not show description element when it is empty * Increase timeout * Update tests to deal with empty element Change-Id: Ib0cb29bf87bfd5aeb25379460caa2e3c0686e675 --- M includes/views/Collection.php M tests/browser/features/edit_collection.feature M tests/browser/features/step_definitions/edit_collection_steps.rb M tests/browser/features/support/pages/gather_page.rb 4 files changed, 15 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather refs/changes/67/211967/1 diff --git a/includes/views/Collection.php b/includes/views/Collection.php index 1a4931a..2070e43 100644 --- a/includes/views/Collection.php +++ b/includes/views/Collection.php @@ -61,9 +61,12 @@ } $html .= Html::closeElement( 'div' ) . $this->getOwnerHtml( $owner ) . - Html::element( 'h1', array( 'id' => 'section_0' ), $collection->getTitle() ) . - Html::element( 'div', array( 'class' => 'collection-description' ), $description ) . - $this->getActionButtonsHtml() . + Html::element( 'h1', array( 'id' => 'section_0' ), $collection->getTitle() ); + if ( $description ) { + $html .= Html::element( 'div', array( 'class' => 'collection-description' ), $description ); + } + + $html .= $this->getActionButtonsHtml() . Html::closeElement( 'div' ); return $html; diff --git a/tests/browser/features/edit_collection.feature b/tests/browser/features/edit_collection.feature index b9f47c9..1c96acf 100644 --- a/tests/browser/features/edit_collection.feature +++ b/tests/browser/features/edit_collection.feature @@ -32,4 +32,4 @@ And I click to save description And I click done And the page has reloaded - Then the description of my collection is "" + Then the description of my collection is empty diff --git a/tests/browser/features/step_definitions/edit_collection_steps.rb b/tests/browser/features/step_definitions/edit_collection_steps.rb index 4564c5f..59506d5 100644 --- a/tests/browser/features/step_definitions/edit_collection_steps.rb +++ b/tests/browser/features/step_definitions/edit_collection_steps.rb @@ -11,6 +11,7 @@ end Then(/^I enter "(.*?)" as the description$/) do |keys| + on(GatherPage).edit_overlay_description_element.when_present.clear() on(GatherPage).edit_overlay_description_element.when_present.send_keys(keys) end @@ -23,11 +24,15 @@ end Then(/^the page has reloaded$/) do - sleep 2 + sleep 5 end Then(/^the description of my collection is "(.*?)"$/) do |text| - expect(on(GatherPage).collection_description_element.when_present.text).to match text + expect(on(GatherPage).collection_description_element.when_present.text).to eq text +end + +Then(/^the description of my collection is empty$/) do + expect(on(GatherPage).collection_description_element.when_not_present).to be_nil end When(/^I click to edit name and description$/) do diff --git a/tests/browser/features/support/pages/gather_page.rb b/tests/browser/features/support/pages/gather_page.rb index 317d5b4..77afdf2 100644 --- a/tests/browser/features/support/pages/gather_page.rb +++ b/tests/browser/features/support/pages/gather_page.rb @@ -6,7 +6,7 @@ a(:my_first_public_collection, css: '.collection-card-title a', index:1) a(:edit, css: '.edit-collection') div(:edit_overlay, css: '.collection-editor-overlay') - text_field(:edit_overlay_description, css: '.collection-editor-overlay .description') + textarea(:edit_overlay_description, css: '.collection-editor-overlay .description') button(:edit_overlay_save_desc, css: '.collection-editor-overlay .save-description') button(:edit_overlay_done, -- To view, visit https://gerrit.wikimedia.org/r/211967 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib0cb29bf87bfd5aeb25379460caa2e3c0686e675 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Gather Gerrit-Branch: master Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits