diff --git a/NEWS.txt b/NEWS.txt index f17e8ed6e9..d79a5c6712 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -15,6 +15,7 @@ - (functionality) name of category/country in Russian now are optional fields - (functionality) preview now is generated after uploading an image - (functionality) add interface for adding buyers and sellers +- (functionality) add capability to specify image URL (as alternative to providing a file) 0.3 - (functionality) implemented possibility to user to add series to his collection diff --git a/src/main/config/findbugs-filter.xml b/src/main/config/findbugs-filter.xml index c938e71341..783587134b 100644 --- a/src/main/config/findbugs-filter.xml +++ b/src/main/config/findbugs-filter.xml @@ -8,6 +8,15 @@ + + + + +
- + Later you will be able to add additional images @@ -242,6 +249,23 @@

+
+ +
+ + +
+
+
 Specify date of release diff --git a/src/main/webapp/WEB-INF/views/series/info.html b/src/main/webapp/WEB-INF/views/series/info.html index ed93d23118..99b139edec 100644 --- a/src/main/webapp/WEB-INF/views/series/info.html +++ b/src/main/webapp/WEB-INF/views/series/info.html @@ -86,21 +86,51 @@
-
+
-
- - +
+ +
+ + +
-
- +
+ +
+ + +
+
+
+
+ +
diff --git a/src/test/groovy/ru/mystamps/web/service/SeriesServiceImplTest.groovy b/src/test/groovy/ru/mystamps/web/service/SeriesServiceImplTest.groovy index 35987a2c17..d79da53573 100644 --- a/src/test/groovy/ru/mystamps/web/service/SeriesServiceImplTest.groovy +++ b/src/test/groovy/ru/mystamps/web/service/SeriesServiceImplTest.groovy @@ -55,6 +55,7 @@ class SeriesServiceImplTest extends Specification { private AddImageForm imageForm private Integer userId + @SuppressWarnings('UnnecessaryGetter') def setup() { form = new AddSeriesForm() form.setQuantity(2) @@ -76,6 +77,8 @@ class SeriesServiceImplTest extends Specification { yvertCatalogService, gibbonsCatalogService ) + + multipartFile.getOriginalFilename() >> '/path/to/test/file.ext' } // diff --git a/src/test/java/ru/mystamps/web/tests/page/AddSeriesPage.java b/src/test/java/ru/mystamps/web/tests/page/AddSeriesPage.java index db889568bc..f4313a3e3e 100644 --- a/src/test/java/ru/mystamps/web/tests/page/AddSeriesPage.java +++ b/src/test/java/ru/mystamps/web/tests/page/AddSeriesPage.java @@ -79,7 +79,7 @@ public AddSeriesPage(WebDriver driver) { inputField("gibbonsNumbers"), inputField("gibbonsPrice"), textareaField("comment").accessibleByAll(false), - required(uploadFileField("image")) + uploadFileField("image") ) .and() .with(submitButton(tr("t_add"))) diff --git a/src/test/robotframework/series/add-image/logic.robot b/src/test/robotframework/series/add-image/logic.robot index 21d27a12de..89ffe85aca 100644 --- a/src/test/robotframework/series/add-image/logic.robot +++ b/src/test/robotframework/series/add-image/logic.robot @@ -8,14 +8,22 @@ Test Setup Before Test Force Tags series add-image logic *** Test Cases *** -Add additional image - [Documentation] Verify adding an additional image to a series +Add additional image by providing a file + [Documentation] Verify uploading an additional image to a series Page Should Not Contain Image id=series-image-2 Choose File id=image ${MAIN_RESOURCE_DIR}${/}test.png Submit Form id=add-image-form Location Should Be ${SITE_URL}/series/1 Page Should Contain Image id=series-image-2 +Add additional image by providing a URL to image + [Documentation] Verify downloading an additional image to a series + Page Should Not Contain Image id=series-image-3 + Input Text id=image-url ${SITE_URL}/image/1 + Submit Form id=add-image-form + Location Should Be ${SITE_URL}/series/1 + Page Should Contain Image id=series-image-3 + *** Keywords *** Before Test Suite [Documentation] Open browser, register fail hook and login as admin diff --git a/src/test/robotframework/series/add-image/validation.robot b/src/test/robotframework/series/add-image/validation.robot index 1c4eda722d..1198ab77f5 100644 --- a/src/test/robotframework/series/add-image/validation.robot +++ b/src/test/robotframework/series/add-image/validation.robot @@ -7,10 +7,11 @@ Suite Teardown After Test Suite Force Tags series add-image validation *** Test Cases *** -Add image but without filling a required field - [Documentation] Verify validation of a required field +Add image with empty required fields + [Documentation] Verify validation of mandatory fields Submit Form id=add-image-form - Element Text Should Be id=image.errors Value must not be empty + Element Text Should Be id=image.errors Image or image URL must be specified + Element Text Should Be id=image-url.errors Image or image URL must be specified Add image with empty file [Documentation] Verify validation of an empty file @@ -18,6 +19,50 @@ Add image with empty file Submit Form id=add-image-form Element Text Should Be id=image.errors File must not be empty +Add image with both image and an image URL + [Documentation] Verify validation of an image and an image URL provided at the same time + Choose File id=image ${MAIN_RESOURCE_DIR}${/}test.png + Input Text id=image-url ${SITE_URL}/image/1 + Submit Form id=add-image-form + Element Text Should Be id=image.errors Image or image URL must be specified + Element Text Should Be id=image-url.errors Image or image URL must be specified + +Add image with invalid URL + [Documentation] Verify validation of invalid URL + Input Text id=image-url invalid-url + Submit Form id=add-image-form + Element Text Should Be id=image-url.errors Value must be a valid URL + +Add image with image URL with invalid response + [Documentation] Verify validation of invalid response from a server + Input Text id=image-url ${SITE_URL}/test/invalid/response-400 + Submit Form id=add-image-form + Element Text Should Be id=image-url.errors Could not download file + +Add image with image URL to a file that does not exist + [Documentation] Verify validation of URL to non existing file + Input Text id=image-url ${SITE_URL}/test/invalid/response-404 + Submit Form id=add-image-form + Element Text Should Be id=image-url.errors File not found + +Add image with image URL that causes a redirect + [Documentation] Verify validation of URL with redirect + Input Text id=image-url ${SITE_URL}/test/invalid/response-301 + Submit Form id=add-image-form + Element Text Should Be id=image-url.errors URL must not redirect to another address + +Add image with image URL to an empty file + [Documentation] Verify validation of URL to an empty file + Input Text id=image-url ${SITE_URL}/test/invalid/empty-jpeg-file + Submit Form id=add-image-form + Element Text Should Be id=image-url.errors File must not be empty + +Add image with image URL to not an image file + [Documentation] Verify validation of URL to a file of unsupported type + Input Text id=image-url ${SITE_URL}/test/invalid/not-image-file + Submit Form id=add-image-form + Element Text Should Be id=image-url.errors Invalid file type + *** Keywords *** Before Test Suite [Documentation] Login as admin and open a page with a series info diff --git a/src/test/robotframework/series/creation/logic.robot b/src/test/robotframework/series/creation/logic.robot index 6fab0575bf..e508035ce9 100644 --- a/src/test/robotframework/series/creation/logic.robot +++ b/src/test/robotframework/series/creation/logic.robot @@ -8,8 +8,8 @@ Test Setup Before Test Force Tags series logic *** Test Cases *** -Create series by filling only required fields - [Documentation] Verify creation of series by filling only mandatory fields +Create series by filling only required fields and providing an image + [Documentation] Verify creation of series by filling only mandatory fields (with image) Select From List By Label id=category Sport Input Text id=quantity 2 Choose File id=image ${MAIN_RESOURCE_DIR}${/}test.png @@ -21,6 +21,19 @@ Create series by filling only required fields Element Text Should Be id=perforated Yes Page Should Contain Image id=series-image-1 +Create series by filling only required fields and providing a URL to image + [Documentation] Verify creation of series by filling only mandatory fields (with an image URL) + Select From List By Label id=category Sport + Input Text id=quantity 1 + Input Text id=image-url ${SITE_URL}/image/1 + Submit Form id=add-series-form + ${location}= Get Location + Should Match Regexp ${location} /series/\\d+ + Element Text Should Be id=category_name Sport + Element Text Should Be id=quantity 1 + Element Text Should Be id=perforated Yes + Page Should Contain Image id=series-image-1 + Create series by filling all fields [Documentation] Verify creation of series by filling all fields [Tags] unstable diff --git a/src/test/robotframework/series/creation/validation-user.robot b/src/test/robotframework/series/creation/validation-user.robot new file mode 100644 index 0000000000..cb0dacf656 --- /dev/null +++ b/src/test/robotframework/series/creation/validation-user.robot @@ -0,0 +1,40 @@ +*** Settings *** +Documentation Verify series creation validation scenarios from a user +Library Selenium2Library +Suite Setup Before Test Suite +Suite Teardown After Test Suite +Force Tags series validation + +*** Test Cases *** +Create series with empty required fields + [Documentation] Verify validation of mandatory fields + Submit Form id=add-series-form + Element Text Should Be id=category.errors Value must not be empty + Element Text Should Be id=quantity.errors Value must not be empty + Element Text Should Be id=image.errors Value must not be empty + Page Should Not Contain Element id=image-url.errors + +*** Keywords *** +Before Test Suite + [Documentation] Login as a user and go to create series page + Open Browser ${SITE_URL} ${BROWSER} + Register Keyword To Run On Failure Log Source + Log In As login=coder password=test + Go To ${SITE_URL}/series/add + +After Test Suite + [Documentation] Log out and close browser + Log Out + Close Browser + +Log In As + [Documentation] Log in as a user + [Arguments] ${login} ${password} + Go To ${SITE_URL}/account/auth + Input Text id=login ${login} + Input Password id=password ${password} + Submit Form id=auth-account-form + +Log Out + [Documentation] Log out current user + Submit Form id=logout-form diff --git a/src/test/robotframework/series/creation/validation.robot b/src/test/robotframework/series/creation/validation.robot index 35cf7e3631..6b8c87e66e 100644 --- a/src/test/robotframework/series/creation/validation.robot +++ b/src/test/robotframework/series/creation/validation.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify series creation validation scenarios +Documentation Verify series creation validation scenarios from admin Library Selenium2Library Resource ../../auth.steps.robot Suite Setup Before Test Suite @@ -7,6 +7,14 @@ Suite Teardown After Test Suite Force Tags series validation *** Test Cases *** +Create series with empty required fields + [Documentation] Verify validation of mandatory fields + Submit Form id=add-series-form + Element Text Should Be id=category.errors Value must not be empty + Element Text Should Be id=quantity.errors Value must not be empty + Element Text Should Be id=image.errors Image or image URL must be specified + Element Text Should Be id=image-url.errors Image or image URL must be specified + Create series with non-numeric quantity [Documentation] Verify validation of non-numeric quantity Input Text id=quantity NaN @@ -31,6 +39,50 @@ Create series with empty image Submit Form id=add-series-form Element Text Should Be id=image.errors File must not be empty +Create series with both image and an image URL + [Documentation] Verify validation of an image and an image URL provided at the same time + Choose File id=image ${MAIN_RESOURCE_DIR}${/}test.png + Input Text id=image-url ${SITE_URL}/image/1 + Submit Form id=add-series-form + Element Text Should Be id=image.errors Image or image URL must be specified + Element Text Should Be id=image-url.errors Image or image URL must be specified + +Create series with invalid image URL + [Documentation] Verify validation of invalid URL + Input Text id=image-url invalid-url + Submit Form id=add-series-form + Element Text Should Be id=image-url.errors Value must be a valid URL + +Create series with image URL with invalid response + [Documentation] Verify validation of invalid response from a server + Input Text id=image-url ${SITE_URL}/test/invalid/response-400 + Submit Form id=add-series-form + Element Text Should Be id=image-url.errors Could not download file + +Create series with image URL to a file that does not exist + [Documentation] Verify validation of URL to non existing file + Input Text id=image-url ${SITE_URL}/test/invalid/response-404 + Submit Form id=add-series-form + Element Text Should Be id=image-url.errors File not found + +Create series with image URL that causes a redirect + [Documentation] Verify validation of URL with redirect + Input Text id=image-url ${SITE_URL}/test/invalid/response-301 + Submit Form id=add-series-form + Element Text Should Be id=image-url.errors URL must not redirect to another address + +Create series with image URL to an empty file + [Documentation] Verify validation of URL to an empty file + Input Text id=image-url ${SITE_URL}/test/invalid/empty-jpeg-file + Submit Form id=add-series-form + Element Text Should Be id=image-url.errors File must not be empty + +Create series with image URL to not an image file + [Documentation] Verify validation of URL to a file of unsupported type + Input Text id=image-url ${SITE_URL}/test/invalid/not-image-file + Submit Form id=add-series-form + Element Text Should Be id=image-url.errors Invalid file type + Catalog numbers should reject invalid values [Documentation] Verify that fields with catalog numbers reject invalid values [Tags] unstable