Skip to content

Commit 09dd595

Browse files
committed
WhenAdminAddSeries.catalogPricesShouldRejectInvalidValues: port to Robot Framework.
Addressed to #530 No functional changes.
1 parent a531576 commit 09dd595

File tree

2 files changed

+23
-32
lines changed

2 files changed

+23
-32
lines changed

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

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,12 @@
2929
import org.testng.annotations.AfterClass;
3030
import org.testng.annotations.BeforeClass;
3131
import org.testng.annotations.BeforeMethod;
32-
import org.testng.annotations.DataProvider;
3332
import org.testng.annotations.Test;
3433

3534
import ru.mystamps.web.tests.page.AbstractPage;
3635
import ru.mystamps.web.tests.page.AddSeriesPage;
3736
import ru.mystamps.web.tests.page.InfoSeriesPage;
3837

39-
import static ru.mystamps.web.tests.TranslationUtils.tr;
4038
import static ru.mystamps.web.tests.fest.PageWithFormAssert.assertThat;
4139

4240
import static org.fest.assertions.api.Assertions.assertThat;
@@ -118,23 +116,6 @@ public void shouldHaveStandardStructure() {
118116
checkStandardStructure();
119117
}
120118

121-
@Test(groups = "invalid", dependsOnGroups = "std", dataProvider = "invalidCatalogPrices")
122-
public void catalogPricesShouldRejectInvalidValues(String price, String msg) {
123-
page.showCatalogNumbers();
124-
125-
page.fillMichelPrice(price);
126-
page.fillScottPrice(price);
127-
page.fillYvertPrice(price);
128-
page.fillGibbonsPrice(price);
129-
130-
page.submit();
131-
132-
assertThat(page).field("michelPrice").hasError(msg);
133-
assertThat(page).field("scottPrice").hasError(msg);
134-
assertThat(page).field("yvertPrice").hasError(msg);
135-
assertThat(page).field("gibbonsPrice").hasError(msg);
136-
}
137-
138119
@Test(groups = "misc", dependsOnGroups = "std")
139120
public void issueYearFieldShouldHaveOptionsForRangeFrom1840ToCurrentYear() {
140121
page.showDateOfRelease();
@@ -169,7 +150,7 @@ public void commentShouldBeStripedFromLeadingAndTrailingSpaces() {
169150
assertThat(page).field("comment").hasValue("example comment");
170151
}
171152

172-
@Test(groups = "logic", dependsOnGroups = { "std", "invalid", "misc" })
153+
@Test(groups = "logic", dependsOnGroups = { "std", "misc" })
173154
public void shouldIgnoreDuplicatedCatalogNumbers() {
174155
page.fillCategory(validCategoryName);
175156
page.fillQuantity("2");
@@ -191,7 +172,7 @@ public void shouldIgnoreDuplicatedCatalogNumbers() {
191172
assertThat(nextPage.getGibbonsCatalogInfo()).isEqualTo("#134, 135");
192173
}
193174

194-
@Test(groups = "logic", dependsOnGroups = { "std", "invalid", "misc" })
175+
@Test(groups = "logic", dependsOnGroups = { "std", "misc" })
195176
public void shouldAllowExistingCatalogNumbers() {
196177
page.fillCategory(validCategoryName);
197178
page.fillQuantity("2");
@@ -212,15 +193,4 @@ public void shouldAllowExistingCatalogNumbers() {
212193
assertThat(nextPage.getGibbonsCatalogInfo()).isEqualTo("#" + existingGibbonsNumber);
213194
}
214195

215-
@DataProvider(name = "invalidCatalogPrices")
216-
public Object[][] getInvalidCatalogPrices() {
217-
String expectedErrorMessage = tr("ru.mystamps.web.validation.jsr303.Price.message");
218-
219-
return new Object[][] {
220-
{"0", expectedErrorMessage},
221-
{"-1", expectedErrorMessage},
222-
{"NaN", expectedErrorMessage}
223-
};
224-
}
225-
226196
}

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ Catalog numbers should reject invalid values
4343
1,09
4444
10000
4545

46+
Catalog price should reject invalid values
47+
[Documentation] Verify that fields with catalog price reject invalid values
48+
[Template] Invalid Catalog Price Should Be Rejected
49+
0
50+
-1
51+
NaN
52+
4653
Create series with too long comment
4754
[Documentation] Verify validation of too long comment
4855
${letter}= Set Variable x
@@ -90,3 +97,17 @@ Invalid Catalog Numbers Should Be Rejected
9097
Element Text Should Be id=scottNumbers.errors Value must be comma delimited numbers
9198
Element Text Should Be id=yvertNumbers.errors Value must be comma delimited numbers
9299
Element Text Should Be id=gibbonsNumbers.errors Value must be comma delimited numbers
100+
101+
Invalid Catalog Price Should Be Rejected
102+
[Documentation] Test that specifying catalog price cause an error
103+
[Arguments] ${catalogPrice}
104+
Click Element id=add-catalog-numbers-link
105+
Input Text id=michelPrice ${catalogPrice}
106+
Input Text id=scottPrice ${catalogPrice}
107+
Input Text id=yvertPrice ${catalogPrice}
108+
Input Text id=gibbonsPrice ${catalogPrice}
109+
Submit Form id=add-series-form
110+
Element Text Should Be id=michelPrice.errors Invalid value
111+
Element Text Should Be id=scottPrice.errors Invalid value
112+
Element Text Should Be id=yvertPrice.errors Invalid value
113+
Element Text Should Be id=gibbonsPrice.errors Invalid value

0 commit comments

Comments
 (0)