Skip to content

Add new steps #63

Merged
merged 11 commits into from
May 25, 2018
Merged

Conversation

snfrolov
Copy link
Contributor

@snfrolov snfrolov commented May 4, 2018

No description provided.

public void checkIfListContainsCounterFromVariable(String listName, String variableName) {
List<SelenideElement> list = akitaScenario.getCurrentPage().getElementsList(listName);
int expectedListSize = getCounterFromString(variableName);
assertEquals("Количество записей в списке " + listName + " должно быть " + expectedListSize,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

есть уже шаг: @Тогда("^в списке "([^\"]*)" содержится (\d+) (?:элемент|элементов|элемента)")
кажется, лучше его немного подправить, чтоб переменные можно было передавать, чем новый шаг добавлять. есть метод getPropertyOrStringVariableOrValue, который как раз переменные резолвить умеет

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

на шаг
@Тогда("^в списке "([^"]*)" содержится (\d+) (?:элемент|элементов|элемента)")
повесил @deprecated
добавил новый шаг и тесты к нему

* Проверка, что список не содержит количество элементов,
* равное сохраненному ранее значению из переменной
*/
@Тогда("^список \"([^\"]*)\" не содержит количество элементов, равное значению в переменной \"([^\"]*)\"$")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а когда эта проверка может быть полезна? есть уже шаги с проверками на больше - меньше чем n
вот на то, что не равно, сразу вопрос, а сколько ожидалось?

Copy link
Contributor Author

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)));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше equalToIgnoringCase()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Поправил тут и в шаге ниже

@snfrolov snfrolov closed this May 11, 2018
@snfrolov snfrolov reopened this May 11, 2018

/**
* Производится проверка соответствия числа элементов списка значению, указанному в шаге или в переменной
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Производится проверка соответствия числа элементов списка значению из property файла, или из переменной сценария или указанному в шаге

Copy link
Contributor Author

@snfrolov snfrolov May 15, 2018

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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getStringMatching

Copy link
Contributor Author

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

с IllegalArgumentException излишние проверки. они уже реализованы для akitaScenario и в PropertyLoaderTests

Copy link
Contributor Author

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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тоже излишни

Copy link
Contributor Author

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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

хотелось бы на проверку этого метода тест для шага listContainsNumberOfElementsOrContainsFromVariable добавить

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Удалил метод, так как он остался от моего шага
Он больше не используется

@GannaChernyshova GannaChernyshova merged commit 80d8377 into alfa-laboratory:master May 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants