Skip to content

Commit 530d381

Browse files
committed
shouldCreateSeriesWithAllFieldsFilled: port to Robot Framework.
Addressed to #530 No functional changes.
1 parent d3f55f8 commit 530d381

File tree

2 files changed

+54
-69
lines changed

2 files changed

+54
-69
lines changed

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

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import org.testng.annotations.DataProvider;
3535
import org.testng.annotations.Test;
3636

37-
import ru.mystamps.web.Url;
3837
import ru.mystamps.web.tests.page.AbstractPage;
3938
import ru.mystamps.web.tests.page.AddSeriesPage;
4039
import ru.mystamps.web.tests.page.InfoSeriesPage;
@@ -271,74 +270,6 @@ public void commentShouldBeStripedFromLeadingAndTrailingSpaces() {
271270
assertThat(page).field("comment").hasValue("example comment");
272271
}
273272

274-
@Test(groups = "logic", dependsOnGroups = { "std", "valid", "invalid", "misc" })
275-
public void shouldCreateSeriesWithAllFieldsFilled() {
276-
String expectedPageUrl = Url.INFO_SERIES_PAGE.replace("{id}", "\\d+");
277-
String expectedImageUrl = Url.SITE + Url.GET_IMAGE_PAGE.replace("{id}", "\\d+");
278-
String expectedQuantity = "3";
279-
String day = "4";
280-
String month = "5";
281-
String year = "1999";
282-
String expectedCountryName = "Italy";
283-
String expectedCategoryName = validCategoryName;
284-
String expectedComment = "Any text";
285-
286-
page.fillCategory(expectedCategoryName);
287-
page.fillCountry(expectedCountryName);
288-
289-
page.showDateOfRelease();
290-
page.fillDay(day);
291-
page.fillMonth(month);
292-
page.fillYear(year);
293-
294-
page.fillQuantity(expectedQuantity);
295-
page.fillPerforated(false);
296-
297-
page.showCatalogNumbers();
298-
299-
page.fillMichelNumbers("101, 102, 103");
300-
page.fillMichelPrice("10.5");
301-
302-
page.fillScottNumbers("110, 111, 112");
303-
page.fillScottPrice("1000");
304-
305-
page.fillYvertNumbers("120, 121, 122");
306-
page.fillYvertPrice("8.11");
307-
308-
page.fillGibbonsNumbers("130, 131, 132");
309-
page.fillGibbonsPrice("400.335");
310-
311-
page.showComment();
312-
page.fillComment(expectedComment);
313-
314-
page.fillImage(SAMPLE_IMAGE_PATH);
315-
316-
AbstractPage next = page.submit();
317-
assertThat(next).isInstanceOf(InfoSeriesPage.class);
318-
319-
InfoSeriesPage nextPage = (InfoSeriesPage)next;
320-
321-
assertThat(nextPage.getCurrentUrl()).matches(expectedPageUrl);
322-
323-
List<String> imageUrls = nextPage.getImageUrls();
324-
assertThat(imageUrls).hasSize(1);
325-
assertThat(imageUrls.get(0)).matches(expectedImageUrl);
326-
327-
assertThat(nextPage.getCategory()).isEqualTo(expectedCategoryName);
328-
assertThat(nextPage.getCountry()).isEqualTo(expectedCountryName);
329-
assertThat(nextPage.getDateOfRelease()).isEqualTo("04.05.1999");
330-
assertThat(nextPage.getQuantity()).isEqualTo(expectedQuantity);
331-
assertThat(nextPage.getPerforated()).isEqualTo(tr("t_no"));
332-
333-
assertThat(nextPage.getMichelCatalogInfo()).isEqualTo("#101-103 (10.5 EUR)");
334-
assertThat(nextPage.getScottCatalogInfo()).isEqualTo("#110-112 (1000 USD)");
335-
assertThat(nextPage.getYvertCatalogInfo()).isEqualTo("#120-122 (8.11 EUR)");
336-
// TODO: disable rounding mode
337-
assertThat(nextPage.getGibbonsCatalogInfo()).isEqualTo("#130-132 (400.34 GBP)");
338-
339-
assertThat(nextPage.getComment()).isEqualTo(expectedComment);
340-
}
341-
342273
@Test(groups = "logic", dependsOnGroups = { "std", "valid", "invalid", "misc" })
343274
public void shouldIgnoreDuplicatedCatalogNumbers() {
344275
page.fillCategory(validCategoryName);

src/test/robotframework/series/creation/logic.robot

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,45 @@ Create series by filling only required fields
2020
Element Text Should Be id=perforated Yes
2121
Page Should Contain Image id=series-image-1
2222

23+
Create series by filling all fields
24+
[Documentation] Verify creation of series by filling all fields
25+
Select From List By Label id=category Sport
26+
Select Country Italy
27+
Input Text id=quantity 3
28+
Unselect Checkbox id=perforated
29+
Choose File id=image ${RESOURCE_DIR}${/}test.png
30+
Click Element id=specify-issue-date-link
31+
Select From List By Value id=day 4
32+
Select From List By Value id=month 5
33+
Select From List By Value id=year 1999
34+
Click Element id=add-catalog-numbers-link
35+
Input Text id=michelNumbers 101, 102, 103
36+
Input Text id=michelPrice 10.5
37+
Input Text id=scottNumbers 110, 111, 112
38+
Input Text id=scottPrice 1000
39+
Input Text id=yvertNumbers 120, 121, 122
40+
Input Text id=yvertPrice 8.11
41+
Input Text id=gibbonsNumbers 130, 131, 132
42+
Input Text id=gibbonsPrice 400.335
43+
Click Element id=add-comment-link
44+
Input Text id=comment Any text
45+
Submit Form id=add-series-form
46+
${location}= Get Location
47+
Log Source
48+
Should Match Regexp ${location} /series/\\d+
49+
Element Text Should Be id=category_name Sport
50+
Element Text Should Be id=country_name Italy
51+
Element Text Should Be id=issue_date 04.05.1999
52+
Element Text Should Be id=quantity 3
53+
Element Text Should Be id=perforated No
54+
Element Text Should Be id=michel_catalog_info \#101-103 (10.5 EUR)
55+
Element Text Should Be id=scott_catalog_info \#110-112 (1000 USD)
56+
Element Text Should Be id=yvert_catalog_info \#120-122 (8.11 EUR)
57+
# TODO: disable rounding mode
58+
Element Text Should Be id=gibbons_catalog_info \#130-132 (400.34 GBP)
59+
Element Text Should Be id=comment Any text
60+
Page Should Contain Image id=series-image-1
61+
2362
*** Keywords ***
2463
Before Test Suite
2564
[Documentation] Open browser, register fail hook and login as admin
@@ -47,3 +86,18 @@ Log In As
4786
Log Out
4887
[Documentation] Log out current user
4988
Submit Form id=logout-form
89+
90+
Select Country
91+
[Documentation] Select the given value in a select list that is using selectize.js
92+
[Arguments] ${value}
93+
# We can't use "Select From List By Label" because
94+
# 1) it doesn't work with invisible elements (and selectize.js makes field invisible)
95+
# 2) selectize.js dynamically creates list of countries only when we're clicking on the field
96+
Click Element id=country-selectized
97+
${countryOption}= Catenate SEPARATOR=/
98+
... //*[contains(@class, "selectize-control")]
99+
... *[contains(@class, "selectize-dropdown")]
100+
... *[contains(@class, "selectize-dropdown-content")]
101+
... *[contains(@class, "option") and text()="${value}"]
102+
Wait Until Page Contains Element xpath=${countryOption}
103+
Click Element xpath=${countryOption}

0 commit comments

Comments
 (0)