Skip to content

Commit d3f55f8

Browse files
committed
shouldCreateSeriesWithOnlyRequiredFieldsFilled: port to Robot Framework.
Addressed to #530 No functional changes.
1 parent 9c0f01a commit d3f55f8

File tree

5 files changed

+57
-30
lines changed

5 files changed

+57
-30
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,7 @@
926926
-->
927927
<variables>
928928
<variable>BROWSER:htmlunitwithjs</variable>
929+
<variable>RESOURCE_DIR:${basedir}/src/test/resources</variable>
929930
<!-- See also ru.mystamps.web.Url.SITE constant -->
930931
<variable>SITE_URL:http://127.0.0.1:8080</variable>
931932
</variables>

src/main/webapp/WEB-INF/views/series/add.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ <h3 th:text="${#strings.capitalize(add_series)}">
112112
</small>
113113
</div>
114114

115-
<form method="post" enctype="multipart/form-data" class="form-horizontal" action="info.html"
115+
<form id="add-series-form" method="post" enctype="multipart/form-data" class="form-horizontal" action="info.html"
116116
th:action="@{${ADD_SERIES_PAGE}}"
117117
th:object="${addSeriesForm}"
118118
th:with="michelHasErrors=${#fields.hasErrors('michelNumbers') or #fields.hasErrors('michelPrice')},

src/main/webapp/WEB-INF/views/series/info.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,14 @@
104104
<div class="row">
105105

106106
<div class="col-sm-4">
107-
<div class="row" th:each="imageId : ${series.imageIds}">
107+
<div class="row" th:each="imageId,iter : ${series.imageIds}">
108108
<div class="col-sm-12">
109109
<a target="_blank" href="../../../../../test/resources/test.png" th:href="@{${GET_IMAGE_PAGE}(id=${imageId})}">
110-
<img src="../../../../../test/resources/test.png" class="img-responsive series-images" th:src="@{${GET_IMAGE_PAGE}(id=${imageId})}" />
110+
<img class="img-responsive series-images"
111+
id="series-image-1"
112+
src="../../../../../test/resources/test.png"
113+
th:id="|series-image-${iter.count}|"
114+
th:src="@{${GET_IMAGE_PAGE}(id=${imageId})}" />
111115
</a>
112116
</div>
113117
</div>

src/test/java/ru/mystamps/web/tests/cases/WhenAdminAddSeries.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -271,33 +271,6 @@ public void commentShouldBeStripedFromLeadingAndTrailingSpaces() {
271271
assertThat(page).field("comment").hasValue("example comment");
272272
}
273273

274-
@Test(groups = "logic", dependsOnGroups = { "std", "valid", "invalid", "misc" })
275-
public void shouldCreateSeriesWithOnlyRequiredFieldsFilled() {
276-
String expectedCategoryName = validCategoryName;
277-
String expectedQuantity = "2";
278-
String expectedPageUrl = Url.INFO_SERIES_PAGE.replace("{id}", "\\d+");
279-
String expectedImageUrl = Url.SITE + Url.GET_IMAGE_PAGE.replace("{id}", "\\d+");
280-
281-
page.fillCategory(expectedCategoryName);
282-
page.fillQuantity(expectedQuantity);
283-
page.fillImage(SAMPLE_IMAGE_PATH);
284-
285-
AbstractPage next = page.submit();
286-
assertThat(next).isInstanceOf(InfoSeriesPage.class);
287-
288-
InfoSeriesPage nextPage = (InfoSeriesPage)next;
289-
290-
assertThat(nextPage.getCurrentUrl()).matches(expectedPageUrl);
291-
292-
List<String> imageUrls = nextPage.getImageUrls();
293-
assertThat(imageUrls).hasSize(1);
294-
assertThat(imageUrls.get(0)).matches(expectedImageUrl);
295-
296-
assertThat(nextPage.getCategory()).isEqualTo(expectedCategoryName);
297-
assertThat(nextPage.getQuantity()).isEqualTo(expectedQuantity);
298-
assertThat(nextPage.getPerforated()).isEqualTo(tr("t_yes"));
299-
}
300-
301274
@Test(groups = "logic", dependsOnGroups = { "std", "valid", "invalid", "misc" })
302275
public void shouldCreateSeriesWithAllFieldsFilled() {
303276
String expectedPageUrl = Url.INFO_SERIES_PAGE.replace("{id}", "\\d+");
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
*** Settings ***
2+
Documentation Verify series creation scenarios
3+
Library Selenium2Library
4+
Suite Setup Before Test Suite
5+
Suite Teardown After Test Suite
6+
Test Setup Before Test
7+
Force Tags series logic
8+
9+
*** Test Cases ***
10+
Create series by filling only required fields
11+
[Documentation] Verify creation of series by filling only mandatory fields
12+
Select From List By Label id=category Sport
13+
Input Text id=quantity 2
14+
Choose File id=image ${RESOURCE_DIR}${/}test.png
15+
Submit Form id=add-series-form
16+
${location}= Get Location
17+
Should Match Regexp ${location} /series/\\d+
18+
Element Text Should Be id=category_name Sport
19+
Element Text Should Be id=quantity 2
20+
Element Text Should Be id=perforated Yes
21+
Page Should Contain Image id=series-image-1
22+
23+
*** Keywords ***
24+
Before Test Suite
25+
[Documentation] Open browser, register fail hook and login as admin
26+
Open Browser ${SITE_URL} ${BROWSER}
27+
Register Keyword To Run On Failure Log Source
28+
Log In As login=admin password=test
29+
30+
Before Test
31+
[Documentation] Open create series page
32+
Go To ${SITE_URL}/series/add
33+
34+
After Test Suite
35+
[Documentation] Log out and close browser
36+
Log Out
37+
Close Browser
38+
39+
Log In As
40+
[Documentation] Log in as a user
41+
[Arguments] ${login} ${password}
42+
Go To ${SITE_URL}/account/auth
43+
Input Text id=login ${login}
44+
Input Password id=password ${password}
45+
Submit Form id=auth-account-form
46+
47+
Log Out
48+
[Documentation] Log out current user
49+
Submit Form id=logout-form

0 commit comments

Comments
 (0)