Skip to content

Commit de2f0a0

Browse files
committed
Fix integration tests.
1 parent 27d1204 commit de2f0a0

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,11 @@ public void shouldCreateSeriesWithOnlyRequiredFieldsFilled() {
431431
InfoSeriesPage nextPage = (InfoSeriesPage)next;
432432

433433
assertThat(nextPage.getCurrentUrl()).matches(expectedPageUrl);
434-
assertThat(nextPage.getImageUrl()).matches(expectedImageUrl);
434+
435+
List<String> imageUrls = nextPage.getImageUrls();
436+
assertThat(imageUrls).hasSize(1);
437+
assertThat(imageUrls.get(0)).matches(expectedImageUrl);
438+
435439
assertThat(nextPage.getCategory()).isEqualTo(expectedCategoryName);
436440
assertThat(nextPage.getQuantity()).isEqualTo(expectedQuantity);
437441
assertThat(nextPage.getPerforated()).isEqualTo(tr("t_yes"));
@@ -482,7 +486,10 @@ public void shouldCreateSeriesWithAllFieldsFilled() {
482486
InfoSeriesPage nextPage = (InfoSeriesPage)next;
483487

484488
assertThat(nextPage.getCurrentUrl()).matches(expectedPageUrl);
485-
assertThat(nextPage.getImageUrl()).matches(expectedImageUrl);
489+
490+
List<String> imageUrls = nextPage.getImageUrls();
491+
assertThat(imageUrls).hasSize(1);
492+
assertThat(imageUrls.get(0)).matches(expectedImageUrl);
486493

487494
assertThat(nextPage.getCategory()).isEqualTo(expectedCategoryName);
488495
assertThat(nextPage.getCountry()).isEqualTo(expectedCountryName);

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,11 @@ public void shouldCreateSeriesWithOnlyRequiredFieldsFilled() {
404404
InfoSeriesPage nextPage = (InfoSeriesPage)next;
405405

406406
assertThat(nextPage.getCurrentUrl()).matches(expectedPageUrl);
407-
assertThat(nextPage.getImageUrl()).matches(expectedImageUrl);
407+
408+
List<String> imageUrls = nextPage.getImageUrls();
409+
assertThat(imageUrls).hasSize(1);
410+
assertThat(imageUrls.get(0)).matches(expectedImageUrl);
411+
408412
assertThat(nextPage.getCategory()).isEqualTo(expectedCategoryName);
409413
assertThat(nextPage.getQuantity()).isEqualTo(expectedQuantity);
410414
assertThat(nextPage.getPerforated()).isEqualTo(tr("t_yes"));
@@ -453,7 +457,10 @@ public void shouldCreateSeriesWithAllFieldsFilled() {
453457
InfoSeriesPage nextPage = (InfoSeriesPage)next;
454458

455459
assertThat(nextPage.getCurrentUrl()).matches(expectedPageUrl);
456-
assertThat(nextPage.getImageUrl()).matches(expectedImageUrl);
460+
461+
List<String> imageUrls = nextPage.getImageUrls();
462+
assertThat(imageUrls).hasSize(1);
463+
assertThat(imageUrls.get(0)).matches(expectedImageUrl);
457464

458465
assertThat(nextPage.getCategory()).isEqualTo(expectedCategoryName);
459466
assertThat(nextPage.getCountry()).isEqualTo(expectedCountryName);

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,26 @@
1717
*/
1818
package ru.mystamps.web.tests.page;
1919

20+
import java.util.List;
21+
2022
import org.openqa.selenium.WebDriver;
23+
import org.openqa.selenium.WebElement;
2124

2225
import ru.mystamps.web.Url;
2326

27+
import static java.util.stream.Collectors.toList;
28+
2429
public class InfoSeriesPage extends AbstractPage {
2530

2631
public InfoSeriesPage(WebDriver driver) {
2732
super(driver, Url.INFO_SERIES_PAGE);
2833
}
2934

30-
public String getImageUrl() {
31-
return getElementById("image").getAttribute("src");
35+
public List<String> getImageUrls() {
36+
return getElementsByClassName("series-images")
37+
.stream()
38+
.map((WebElement el) -> el.getAttribute("src"))
39+
.collect(toList());
3240
}
3341

3442
public String getCategory() {

0 commit comments

Comments
 (0)