-
Notifications
You must be signed in to change notification settings - Fork 65
Add new steps #63
Add new steps #63
Conversation
Added steps for entering random numbers (alfa-laboratory#60)
public void checkIfListContainsCounterFromVariable(String listName, String variableName) { | ||
List<SelenideElement> list = akitaScenario.getCurrentPage().getElementsList(listName); | ||
int expectedListSize = getCounterFromString(variableName); | ||
assertEquals("Количество записей в списке " + listName + " должно быть " + expectedListSize, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
есть уже шаг: @Тогда("^в списке "([^\"]*)" содержится (\d+) (?:элемент|элементов|элемента)")
кажется, лучше его немного подправить, чтоб переменные можно было передавать, чем новый шаг добавлять. есть метод getPropertyOrStringVariableOrValue, который как раз переменные резолвить умеет
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
на шаг
@Тогда("^в списке "([^"]*)" содержится (\d+) (?:элемент|элементов|элемента)")
повесил @deprecated
добавил новый шаг и тесты к нему
* Проверка, что список не содержит количество элементов, | ||
* равное сохраненному ранее значению из переменной | ||
*/ | ||
@Тогда("^список \"([^\"]*)\" не содержит количество элементов, равное значению в переменной \"([^\"]*)\"$") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а когда эта проверка может быть полезна? есть уже шаги с проверками на больше - меньше чем n
вот на то, что не равно, сразу вопрос, а сколько ожидалось?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Удалил
@Тогда("^значения из переменной \"([^\"]*)\" и из property файла \"([^\"]*)\" совпадают$") | ||
public void checkIfValueFromVariableEqualPropertyVariable(String envVarible, String propertyVariable) { | ||
assertThat("Переменные " + envVarible + " и " + propertyVariable + " не совпадают", | ||
akitaScenario.getVar(envVarible), equalTo(loadProperty(propertyVariable))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучше equalToIgnoringCase()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поправил тут и в шаге ниже
fork update
…o add-new-steps
|
||
/** | ||
* Производится проверка соответствия числа элементов списка значению, указанному в шаге или в переменной |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Производится проверка соответствия числа элементов списка значению из property файла, или из переменной сценария или указанному в шаге
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
готово
/** | ||
* Склеивание найденных данных в стрингу | ||
*/ | ||
private String matcherForString(Matcher matcher) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getStringMatching
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
готово
ds.listContainsNumberOfElementsOrContainsFromVariable("List", "4"); | ||
} | ||
|
||
@Test(expected = IllegalArgumentException.class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
с IllegalArgumentException излишние проверки. они уже реализованы для akitaScenario и в PropertyLoaderTests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
готово
ds.checkIfValueFromVariableEqualPropertyVariable("timeout","waitingAppearTimeout"); | ||
} | ||
|
||
@Test(expected = IllegalArgumentException.class) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тоже излишни
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
готово
/** | ||
* Выдергиваем число из строки | ||
*/ | ||
private int getCounterFromString(String variableName) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
хотелось бы на проверку этого метода тест для шага listContainsNumberOfElementsOrContainsFromVariable добавить
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Удалил метод, так как он остался от моего шага
Он больше не используется
No description provided.