Skip to content

Commit 235b8fa

Browse files
committed
refactor(WhenUserAddSeries): port issueYearFieldShouldHaveOptionsForRangeFrom1840ToCurrentYear() to Robot Framework.
Also remove a similar test from misc-admin.robot: one test for that case is enough. If this will be broken only for admin it won't be so critical as when it's broken for users. Addressed to #530 No functional changes.
1 parent 17691d3 commit 235b8fa

File tree

4 files changed

+31
-38
lines changed

4 files changed

+31
-38
lines changed

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030

3131
import java.io.File;
3232
import java.net.URISyntaxException;
33-
import java.time.Year;
34-
import java.util.ArrayList;
3533
import java.util.List;
3634

3735
import static org.fest.assertions.api.Assertions.assertThat;
@@ -40,22 +38,10 @@
4038

4139
public class WhenUserAddSeries extends WhenAnyUserAtAnyPageWithForm<AddSeriesPage> {
4240

43-
private static final int SINCE_YEAR = 1840;
44-
private static final int CURRENT_YEAR = Year.now().getValue();
45-
46-
private static final List<String> EXPECTED_YEARS =
47-
new ArrayList<>(CURRENT_YEAR - SINCE_YEAR + 1);
48-
4941
private static final String SAMPLE_IMAGE_NAME = "test/test.png";
5042
private static final String SAMPLE_IMAGE_PATH;
5143

5244
static {
53-
EXPECTED_YEARS.add("Year");
54-
// years in reverse order
55-
for (int i = CURRENT_YEAR; i >= SINCE_YEAR; i--) {
56-
EXPECTED_YEARS.add(String.valueOf(i));
57-
}
58-
5945
try {
6046
SAMPLE_IMAGE_PATH = new File(
6147
WhenUserAddSeries.class.getClassLoader().getResource(SAMPLE_IMAGE_NAME).toURI()
@@ -185,13 +171,6 @@ public void catalogPricesShouldRejectInvalidValues(String price, String msg) {
185171
assertThat(page).field("zagorskiPrice").hasError(msg);
186172
}
187173

188-
@Test(groups = "misc", dependsOnGroups = "std")
189-
public void issueYearFieldShouldHaveOptionsForRangeFrom1840ToCurrentYear() {
190-
page.showDateOfRelease();
191-
192-
assertThat(page.getYearFieldValues()).isEqualTo(EXPECTED_YEARS);
193-
}
194-
195174
@Test(groups = "misc", dependsOnGroups = "std")
196175
public void catalogNumbersShouldBeStripedFromSpaces() {
197176
page.showCatalogNumbers();

src/test/java/ru/mystamps/web/tests/page/AddSeriesPage.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,6 @@ public void fillCountry(String value) {
149149
.click();
150150
}
151151

152-
public List<String> getYearFieldValues() {
153-
return getSelectOptions("year");
154-
}
155-
156152
public void fillDay(String value) {
157153
if (value != null) {
158154
new Select(getElementByName("day")).selectByVisibleText(value);

src/test/robotframework/series/creation/misc-admin.robot

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
*** Settings ***
22
Documentation Verify miscellaneous aspects of series creation
3-
Library Collections
43
Library SeleniumLibrary
54
Resource ../../auth.steps.robot
65
Suite Setup Before Test Suite
@@ -73,18 +72,6 @@ Catalog numbers should accept existing numbers
7372
Element Text Should Be id=solovyov_catalog_info \#77
7473
Element Text Should Be id=zagorski_catalog_info \#83
7574

76-
Issue year should have options for range from 1840 to the current year
77-
Go To ${SITE_URL}/series/add
78-
Click Element id=specify-issue-date-link
79-
${availableYears}= Get List Items id=year
80-
${currentYear}= Get Time year NOW
81-
${numberOfYears}= Get Length ${availableYears}
82-
# +2 here is to include the current year and option with title
83-
${expectedNumberOfYears}= Evaluate ${currentYear}-1840+2
84-
List Should Contain Value ${availableYears} 1840
85-
List Should Contain Value ${availableYears} ${currentYear}
86-
Should Be Equal As Integers ${numberOfYears} ${expectedNumberOfYears}
87-
8875
Comment should be stripped from leading and trailing spaces
8976
Click Element id=add-comment-link
9077
Input Text id=comment ${SPACE * 2}example comment${SPACE * 2}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
*** Settings ***
2+
Documentation Verify miscellaneous aspects of series creation
3+
Library Collections
4+
Library SeleniumLibrary
5+
Resource ../../auth.steps.robot
6+
Suite Setup Before Test Suite
7+
Suite Teardown After Test Suite
8+
Force Tags series misc
9+
10+
*** Test Cases ***
11+
Issue year should have options for range from 1840 to the current year
12+
Click Element id=specify-issue-date-link
13+
${availableYears}= Get List Items id=year
14+
${currentYear}= Get Time year NOW
15+
${numberOfYears}= Get Length ${availableYears}
16+
# +2 here is to include the current year and option with title
17+
${expectedNumberOfYears}= Evaluate ${currentYear}-1840+2
18+
List Should Contain Value ${availableYears} 1840
19+
List Should Contain Value ${availableYears} ${currentYear}
20+
Should Be Equal As Integers ${numberOfYears} ${expectedNumberOfYears}
21+
22+
*** Keywords ***
23+
Before Test Suite
24+
Open Browser ${SITE_URL}/account/auth ${BROWSER}
25+
Register Keyword To Run On Failure Log Source
26+
Log In As login=coder password=test
27+
Go To ${SITE_URL}/series/add
28+
29+
After Test Suite
30+
Log Out
31+
Close Browser

0 commit comments

Comments
 (0)