ParametrizedTest

mail@pastecode.io avatar
unknown
java
2 years ago
1.2 kB
3
Indexable
Never
    @ParameterizedTest
    @MethodSource("intsListProvider")
    void checkIfFilterIsWorkingCorrectly(int minPrice, int maxPrice) {
        HeaderNavigationPage headerNavigationPage = new HeaderNavigationPage(driver);
        ProductGridPage productGridPage = new ProductGridPage(driver);
        FilterPage filterPage = new FilterPage(driver);

        headerNavigationPage.goToCategory("ACCESSORIES");
        filterPage.moveSliderToPrice(minPrice, maxPrice);
        List<ProductPage> products = productGridPage.getListOfProducts();
        for (ProductPage product: products) {
            assertThat(product.getProductPrice()).isGreaterThan(minPrice);
            assertThat(product.getProductPrice()).isLessThan(maxPrice);
        }
        filterPage.resetFilter();
        List<ProductPage> productsWithOutFiltration = productGridPage.getListOfProducts();

        assertThat(products.size()).isNotEqualTo(productsWithOutFiltration.size());

    }

    static Stream<Arguments> intsListProvider() {
        return Stream.of(
                arguments(13,16),
                arguments(15,19),
                arguments(11,13)
        );
    }