package ru.colibri.ui.steps.general;

import org.jbehave.core.annotations.Named;
import org.jbehave.core.annotations.Then;
import org.openqa.selenium.WebElement;
import org.springframework.stereotype.Component;
import ru.colibri.ui.core.fields.IElement;
import ru.colibri.ui.core.steps.AbsSteps;
import ru.yandex.qatools.allure.annotations.Step;

import java.util.List;

import static java.lang.String.format;
import static org.junit.Assert.assertTrue;

@Component
public class ListItemCheck extends AbsSteps {

    @Step
    @Then("количество найденных элементов \"$fieldName\" равно \"$quantityExpectedValue\"")
    public void listItemCheck(@Named("$fieldName") String fieldName, @Named("$quantityExpectedValue") int quantityExpectedValue) {
        IElement element = getCurrentPage().getElementByName(fieldName);
        List<WebElement> elementsFound = finder.findWebElements(element);
        int quantityActualElements = elementsFound.size();
        assertTrue(format("количество найденных элементов [%s] не равно [%s]", quantityActualElements, quantityExpectedValue), quantityActualElements == quantityExpectedValue);
    }
}

@@ -151,24 +151,87 @@
 WebElement;%0A
+import org.springframework.beans.factory.annotation.Autowired;%0A
 import org.s
@@ -263,24 +263,24 @@
 .Component;%0A
-
 import ru.co
@@ -352,16 +352,69 @@
 sSteps;%0A
+import ru.colibri.ui.settings.general.PropertyUtils;%0A
 import r
@@ -621,16 +621,73 @@
 teps %7B%0A%0A
+    @Autowired%0A    private PropertyUtils propertyUtils;%0A%0A
     @Ste
@@ -882,19 +882,22 @@
 Value%22) 
+Str
 in
-t
+g
  quantit
@@ -1120,16 +1120,103 @@
 size();%0A
+        quantityExpectedValue = propertyUtils.injectProperties(quantityExpectedValue);%0A
         
@@ -1360,16 +1360,33 @@
 ents == 
+Integer.parseInt(
 quantity
@@ -1395,22 +1395,23 @@
 pectedValue)
+)
 ;%0A    %7D%0A%7D%0A

Fix check with template