jenkins-bot has submitted this change and it was merged.
Change subject: Respect preferences' default license when picking a license per
file
......................................................................
Respect preferences' default license when picking a license per file
Also adds browser test coverage for the license preference
Bug: T89717
Change-Id: I6eb1b2183ce8c3626f05ffd3807dde5397f07d0a
---
M resources/mw.UploadWizardLicenseInput.js
M tests/browser/features/step_definitions/upload_wizard_steps.rb
M tests/browser/features/support/pages/describe_page.rb
M tests/browser/features/support/pages/preferences_page.rb
M tests/browser/features/support/pages/release_rights_page.rb
A tests/browser/features/upload_wizard_preferences.feature
6 files changed, 136 insertions(+), 6 deletions(-)
Approvals:
MarkTraceur: Looks good to me, approved
jenkins-bot: Verified
diff --git a/resources/mw.UploadWizardLicenseInput.js
b/resources/mw.UploadWizardLicenseInput.js
index 4d82f9e..99bbecd 100644
--- a/resources/mw.UploadWizardLicenseInput.js
+++ b/resources/mw.UploadWizardLicenseInput.js
@@ -32,7 +32,13 @@
this.type = config.type === 'or' ? 'radio' : 'checkbox';
- this.defaults = ( config.licenses && config.licenses[0] ) ? [
config.licenses[0] ] : [];
+ this.defaults = [];
+
+ if ( config.defaults && config.defaults[0] ) {
+ this.defaults = config.defaults;
+ } else if ( config.licenses && config.licenses[0] ) {
+ this.defaults = [ config.licenses[0] ];
+ }
mw.UploadWizardLicenseInput.prototype.count++;
this.name = 'license' +
mw.UploadWizardLicenseInput.prototype.count;
@@ -122,9 +128,11 @@
*/
createInputs: function ( $el, config, $groupToggler ) {
var input = this;
+
if ( config.licenses === undefined || typeof
config.licenses !== 'object' ) {
throw new Error( 'improper license config' );
}
+
$.each( config.licenses, function ( i, licenseName ) {
if (
mw.UploadWizard.config.licenses[licenseName] !== undefined ) {
var $customDiv,
diff --git a/tests/browser/features/step_definitions/upload_wizard_steps.rb
b/tests/browser/features/step_definitions/upload_wizard_steps.rb
index 0da0029..b649c37 100644
--- a/tests/browser/features/step_definitions/upload_wizard_steps.rb
+++ b/tests/browser/features/step_definitions/upload_wizard_steps.rb
@@ -32,6 +32,30 @@
end
end
+When(/^I set the default license to Own work - Creative Commons CC0 Waiver in
my Preferences$/) do
+ visit(PreferencesPage) do |page|
+ page.upload_wizard_pref_tab_element.when_present.click
+ page.select_own_cc_zero_radio
+ page.preferences_save_button_element.click
+ end
+end
+
+When(/^I set the default license to Someone else's work - Original work of
NASA in my Preferences$/) do
+ visit(PreferencesPage) do |page|
+ page.upload_wizard_pref_tab_element.when_present.click
+ page.select_thirdparty_nasa_radio
+ page.preferences_save_button_element.click
+ end
+end
+
+When(/^I set the default license to Use whatever the default is in my
Preferences$/) do
+ visit(PreferencesPage) do |page|
+ page.upload_wizard_pref_tab_element.when_present.click
+ page.select_default_radio
+ page.preferences_save_button_element.click
+ end
+end
+
When(/^click button Continue$/) do
on(UploadPage).continue_element.when_present(15).click
end
@@ -75,14 +99,24 @@
page.next_element.click
page.wait_for_ajax # Clicking Next fetches data about each file through
AJAX
end
+ on(DescribePage).highlighted_step_heading_element.when_present
end
When(/^I click This file is my own work$/) do
on(ReleaseRightsPage) do |page|
page.highlighted_step_heading_element.when_present
- sleep 0.5 # Sleep because of annoying JS animation happening in this menu
+ sleep 1 # Sleep because of annoying JS animation happening in this menu
page.my_own_work_element.when_present.click
- sleep 0.5 # Sleep because of annoying JS animation happening in this menu
+ sleep 1 # Sleep because of annoying JS animation happening in this menu
+ end
+end
+
+When(/^I click Provide copyright information for each file$/) do
+ on(ReleaseRightsPage) do |page|
+ page.highlighted_step_heading_element.when_present
+ sleep 1 # Sleep because of annoying JS animation happening in this menu
+ on(ReleaseRightsPage).select_provide_copyright_information
+ sleep 1 # Sleep because of annoying JS animation happening in this menu
end
end
@@ -147,6 +181,14 @@
on(UploadPage).select_file_control_to_wait_for_element.when_present
end
+When(/^I click Use a different license for the first file$/) do
+ on(DescribePage).use_a_different_license_element.when_present.click
+end
+
+When(/^I click Upload more files button at Use page$/) do
+ on(UsePage).upload_more_files_element.when_present(15).click
+end
+
Then(/^link to log in should appear$/) do
on(UploadWizardPage).logged_in_element.should be_visible
end
@@ -187,15 +229,30 @@
end
Then(/^there should be an upload for (\S+)$/) do |filename|
- on(UploadPage).upload?(filename).should == true
+ on(UploadPage).upload?(filename).should eq(true)
end
Then(/^a duplicate name error should appear$/) do
on(UploadPage).duplicate_error_element.when_present.should be_visible
end
-When(/^I click Upload more files button at Use page$/) do
- on(UsePage).upload_more_files_element.when_present(15).click
+Then(/^Creative Commons CC0 Waiver should be checked for the first file$/) do
+ on(DescribePage).own_cc_zero_radio_selected?.should eq(true)
+end
+
+Then(/^Creative Commons Attribution ShareAlike 4.0 should be checked for the
first file$/) do
+ on(DescribePage).own_cc_by_sa_4_radio_selected?.should eq(true)
+end
+
+Then(/^Original work of NASA should be checked for the first file$/) do
+ on(DescribePage).thirdparty_nasa_radio_selected?.should eq(true)
+end
+
+Then(/^The Release rights radio buttons should be unchecked$/) do
+ on(DescribePage) do |page|
+ page.own_work_radio_selected?.should eq(false)
+ page.thirdparty_radio_selected?.should eq(false)
+ end
end
When(/^I click Copy information to all uploads below$/) do
diff --git a/tests/browser/features/support/pages/describe_page.rb
b/tests/browser/features/support/pages/describe_page.rb
index cfc53bd..9778bcf 100644
--- a/tests/browser/features/support/pages/describe_page.rb
+++ b/tests/browser/features/support/pages/describe_page.rb
@@ -27,11 +27,21 @@
page.next_parent_element.span_element(text: "Next")
end
text_field(:title, id: "title0")
+
checkbox(:title_check, id: "mwe-upwiz-copy-title")
checkbox(:description_check, id: "mwe-upwiz-copy-description")
checkbox(:date_check, id: "mwe-upwiz-copy-date")
checkbox(:categories_check, id: "mwe-upwiz-copy-categories")
checkbox(:other_check, id: "mwe-upwiz-copy-other")
+
+ a(:use_a_different_license, xpath:
"//div[@id='mwe-upwiz-stepdiv-details']//form[@id='mwe-upwiz-detailsform0']//p[@class='mwe-more-options']/a")
+
+ radio(:own_cc_zero_radio, id: "license3_4")
+ radio(:thirdparty_nasa_radio, id: "license4_13")
+ radio(:own_cc_by_sa_4_radio, id: "license3_0")
+ radio(:own_work_radio, id: "deedChooser2-ownwork")
+ radio(:thirdparty_radio, id: "deedChooser2-thirdparty")
+
span(:copy_expand) do |page|
page.next_parent_element.link_element(text: "Copy information to all
uploads below ...")
end
diff --git a/tests/browser/features/support/pages/preferences_page.rb
b/tests/browser/features/support/pages/preferences_page.rb
index 5b96a6f..16b5fba 100644
--- a/tests/browser/features/support/pages/preferences_page.rb
+++ b/tests/browser/features/support/pages/preferences_page.rb
@@ -21,4 +21,7 @@
a(:upload_wizard_pref_tab, id: "preftab-uploads")
checkbox(:reset_skip_checkbox, id: "mw-input-wpupwiz_skiptutorial")
button(:preferences_save_button, id: "prefcontrol")
+ radio(:own_cc_zero_radio, id: "mw-input-wpupwiz_deflicense-ownwork-cc-zero")
+ radio(:thirdparty_nasa_radio, id:
"mw-input-wpupwiz_deflicense-thirdparty-pd-usgov-nasa")
+ radio(:default_radio, id: "mw-input-wpupwiz_deflicense-default")
end
diff --git a/tests/browser/features/support/pages/release_rights_page.rb
b/tests/browser/features/support/pages/release_rights_page.rb
index 2eecdfd..7df94e6 100644
--- a/tests/browser/features/support/pages/release_rights_page.rb
+++ b/tests/browser/features/support/pages/release_rights_page.rb
@@ -19,6 +19,7 @@
page_url url
radio(:my_own_work, id: "deedChooser1-ownwork")
+ radio(:provide_copyright_information, id: "deedChooser1-custom")
div(:next_parent, id: "mwe-upwiz-stepdiv-deeds")
span(:next) do |page|
page.next_parent_element.span_element(text: "Next")
diff --git a/tests/browser/features/upload_wizard_preferences.feature
b/tests/browser/features/upload_wizard_preferences.feature
new file mode 100644
index 0000000..66c0ade
--- /dev/null
+++ b/tests/browser/features/upload_wizard_preferences.feature
@@ -0,0 +1,51 @@
+#
+# This file is subject to the license terms in the COPYING file found in the
+# UploadWizard top-level directory and at
+#
https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/COPYING.
No part of
+# UploadWizard, including this file, may be copied, modified, propagated, or
+# distributed except according to the terms contained in the COPYING file.
+#
+# Copyright 2012-2014 by the Mediawiki developers. See the CREDITS file in the
+# UploadWizard top-level directory and at
+#
https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FUploadWizard/HEAD/CREDITS
+#
+@chrome @commons.wikimedia.beta.wmflabs.org @firefox @login
@test2.wikipedia.org
+Feature: UploadWizard preferences
+
+ Background:
+ Given I am logged in
+ And my Preferences Skip tutorial box is unchecked
+
+ Scenario: Set license preference to Own work - Creative Commons CC0 Waiver
+ When I set the default license to Own work - Creative Commons CC0 Waiver
in my Preferences
+ And I navigate to Upload Wizard
+ And I click the Next button at the Learn page
+ And I add file image.png
+ And I add file image2.png
+ And click button Continue
+ And I click Provide copyright information for each file
+ And I click the Next button at the Release rights page
+ And I click Use a different license for the first file
+ Then Creative Commons CC0 Waiver should be checked for the first file
+
+ Scenario: Set license preference to Someone else's work - Original work of
NASA
+ When I set the default license to Someone else's work - Original work of
NASA in my Preferences
+ And I navigate to Upload Wizard
+ And I click the Next button at the Learn page
+ And I add file image.png
+ And I add file image2.png
+ And click button Continue
+ And I click Provide copyright information for each file
+ And I click the Next button at the Release rights page
+ Then Original work of NASA should be checked for the first file
+
+ Scenario: Set license preference to Use whatever the default is
+ When I set the default license to Use whatever the default is in my
Preferences
+ And I navigate to Upload Wizard
+ And I click the Next button at the Learn page
+ And I add file image.png
+ And I add file image2.png
+ And click button Continue
+ And I click Provide copyright information for each file
+ And I click the Next button at the Release rights page
+ Then The Release rights radio buttons should be unchecked
\ No newline at end of file
--
To view, visit https://gerrit.wikimedia.org/r/191191
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6eb1b2183ce8c3626f05ffd3807dde5397f07d0a
Gerrit-PatchSet: 11
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Gilles <[email protected]>
Gerrit-Reviewer: Cmcmahon <[email protected]>
Gerrit-Reviewer: Gergő Tisza <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits