jenkins-bot has submitted this change and it was merged.
Change subject: While approving/rejecting, show next message from results
matching current filter
......................................................................
While approving/rejecting, show next message from results matching current
filter
Change-Id: Idb64e368392e8448dfb78bd714638b2ad46e0ed1
---
M resources/js/ext.translate.special.managetranslatorsandbox.js
M tests/browser/features/manage_translator_sandbox.feature
M tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb
M tests/browser/features/support/pages/manage_translator_sandbox_page.rb
4 files changed, 39 insertions(+), 7 deletions(-)
Approvals:
Nikerabbit: Looks good to me, approved
jenkins-bot: Verified
diff --git a/resources/js/ext.translate.special.managetranslatorsandbox.js
b/resources/js/ext.translate.special.managetranslatorsandbox.js
index 5c3aad2..b618914 100644
--- a/resources/js/ext.translate.special.managetranslatorsandbox.js
+++ b/resources/js/ext.translate.special.managetranslatorsandbox.js
@@ -38,7 +38,12 @@
var $nextRequest,
$selectedRequests = $( '.request-selector:checked' );
- $nextRequest = $selectedRequests.first().closest( '.request'
).prev();
+ $nextRequest = $selectedRequests
+ .first() // First selected request
+ .closest( '.request' ) // The request corresponds that
checkbox
+ .prevAll( ':not(.hide)' ) // Go back till a non-hidden
request
+ .first(); // The above selecter gives list from bottom
to top. Select the bottom one.
+
$selectedRequests.closest( '.request' ).remove();
updateRequestCount();
@@ -46,14 +51,13 @@
if ( !$nextRequest.length ) {
// If there's no request above the first checked
request,
// try to get the first request in the column
- $nextRequest = $( '.requests .request' ).first();
+ $nextRequest = $( '.requests .request:not(.hide)'
).first();
}
if ( $nextRequest.length ) {
$nextRequest.click();
updateSelectedIndicator( 1 );
} else {
- $( '.details.pane' ).empty();
updateSelectedIndicator( 0 );
}
}
diff --git a/tests/browser/features/manage_translator_sandbox.feature
b/tests/browser/features/manage_translator_sandbox.feature
index 1a35ef2..670aa2e 100644
--- a/tests/browser/features/manage_translator_sandbox.feature
+++ b/tests/browser/features/manage_translator_sandbox.feature
@@ -270,3 +270,14 @@
And I click the "Accept all" button
Then no users are displayed in the first column
And I should see "0 requests" at the top of the first column
+
+ Scenario: Search for users and accept the first user
+ Given I am on the Translator sandbox management page with users in the
sandbox
+ When I search for "pupu" in the sandboxed users search field
+ And I click on "Pupu4" in the first column
+ And I click the "Accept" button
+ Then I should see "Pupu3" in the header of the second column
+ And I should see the checkbox next to the request from "Pupu3" checked
+ And I should see the checkbox next to the request from "Pupu3" disabled
+ And I should see "1 user selected" at the bottom of the first column
+ And I should see "4 requests" at the top of the first column
diff --git
a/tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb
b/tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb
index 3caade9..4273055 100644
--- a/tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb
+++ b/tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb
@@ -37,7 +37,7 @@
end
When(/^I click the "(.+)" button$/) do |label|
- on(ManageTranslatorSandboxPage).details_button(label).click
+ on(ManageTranslatorSandboxPage).click_button(label)
end
When(/^I click on "(.+)" in the first column$/) do |username|
@@ -162,12 +162,12 @@
Then(/^I should see the name of the first user in the first column in the
header of the second column$/) do
on(ManageTranslatorSandboxPage) do |page|
- page.details_header.should == page.username_in_request(0)
+ page.details_header.text.should == page.username_in_request(0)
end
end
Then(/^I should see "(.+)" in the header of the second column$/) do |text|
- on(ManageTranslatorSandboxPage).details_header.should == text
+ on(ManageTranslatorSandboxPage).details_header.text.should == text
end
Then(/^I should see the userlist in the first column sorted by the number of
translations and the most recent within them$/) do
diff --git
a/tests/browser/features/support/pages/manage_translator_sandbox_page.rb
b/tests/browser/features/support/pages/manage_translator_sandbox_page.rb
index e3d12f5..93694ab 100644
--- a/tests/browser/features/support/pages/manage_translator_sandbox_page.rb
+++ b/tests/browser/features/support/pages/manage_translator_sandbox_page.rb
@@ -9,7 +9,6 @@
button(:clear_language_selector, class: "clear-language-selector")
div(:details, class: "details")
- div(:details_header, class: "tsb-header")
text_field(:language_filter, id: "languagefilter")
button(:language_selector_button, class: "language-selector")
@@ -26,6 +25,11 @@
checkbox(:select_all_checkbox, class: "request-selector-all")
div(:signup_comment_text, class: "signup-comment-text")
+
+ # This must be reloaded every time, because it may change during the
test
+ def details_header
+ @browser.element(class: "tsb-header")
+ end
def details_button(label)
@browser.button(text: label)
@@ -120,6 +124,19 @@
@browser.elements(css: ".details.pane .translations
.info.autonym")
end
+ def click_button(label)
+ initial_header_text = details_header.text
+
+ details_button(label).click
+
+ # It takes a few moments until Accept and Reject buttons
+ # finish performing the action, and this action always
+ # removes the currently displayed users and changes the header
+ p details_header.text
+ Watir::Wait.until { details_header.text != initial_header_text
}
+ p details_header.text
+ end
+
def only_request_with_username_is_selected?(username)
requests_without_username(username).all? do |element|
not element.attribute_value("class").split("
").include?("selected")
--
To view, visit https://gerrit.wikimedia.org/r/102419
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Idb64e368392e8448dfb78bd714638b2ad46e0ed1
Gerrit-PatchSet: 9
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>
Gerrit-Reviewer: Amire80 <[email protected]>
Gerrit-Reviewer: Nikerabbit <[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