Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- предлагаю чуть подравнять сообщения в toString() для кондишенов
- */
- public static ExpectedCondition<WebElement> listElementHasText(final By elementsLocator, final String expectedText) {
- ...
- public String toString() {
- return format("\n list by locator '%s' should contain element with text '%s'\n while actual list of elements contain texts:%s ",
- elementsLocator, expectedText, elementTexts);
- }
- /*
- for list located by [elementsLocator]
- should contain element with text contains [expectedText]
- while actual elements texts is [elementTexts]
- */
- ****************************************************************
- public static ExpectedCondition<WebElement> listElementHasExactText(final By elementsLocator, final String expectedText) {
- ...
- public String toString() {
- return format("\n list by locator '%s' should contain element with exact text '%s'\n while actual list of elements contain texts:%s ",
- elementsLocator, expectedText, elementTexts);
- }
- /*
- for list located by [elementsLocator]
- should contain element with text equals [expectedText]
- while actual elements texts is [elementTexts]
- */
- ************************************************
- public static ExpectedCondition<WebElement> listElementHasClass(final By elementsLocator, final String cssClass) {
- ...
- public String toString() {
- //return format("\n element with class %s should exist. While actual classes are: %s ",
- //cssClass, elementClasses);
- //получилось еще страннее сообщение
- return format("\nelement of list located by '%s' in list located by %s should exist.\nwhile there are actual elements with locator by %s:",
- cssClass, elementsLocator, elementClasses);
- }
- /*
- list located by [elementsLocator]
- should contain element with class [cssClass]
- while actual elements classes is [elementClasses]
- */
- ***********************************
- public static ExpectedCondition<Boolean> sizeOf(final By elementsLocator, final int expectedSize) {
- ...
- public String toString() {
- return format("\nsize of list: %s\n to be %s\n while actual size is %s\n", elements, expectedSize, listSize);
- }
- /*
- size of list located by [elementsLocator]
- should be [expectedSize]
- while actual size is [listSize]
- */
- *****************************************
- public static ExpectedCondition<Boolean> sizeOfVisible(final By elementsLocator, final int expectedSize) {
- ....
- public String toString() {
- return format("\n list of visible elements located by'%s'should have size '%s', " +
- "but actual size of visible elements is '%s'\n texts of visible elements:'%s'",
- elementsLocator, expectedSize, listSize, elementTexts);
- }
- /*
- нас тут вообще не волнуют тексты элементов
- потому не надо переменной elementTexts и работы с ней
- size of list of visible elements located by [elementsLocator]
- should be [expectedSize]
- while actual size is [listSize]
- */
- ************************************************************************
- public static ExpectedCondition<Boolean> minimumSizeOf(final By elementsLocator, final int expectedSize) {
- ...
- public String toString() {
- return format("\nsize of list %s\n minimum size should be %s\n while actual size is %s\n",
- elements, expectedSize, currentSize);
- }
- /*
- size of list located by [elementsLocator]
- should be at least [expectedSize]
- while actual size is [listSize]
- */
- ******************************************************
- public static WebElement $(ExpectedCondition<WebElement> conditionToWaitParentElement, String innerElementCssSelector) {
- public static WebElement $(ExpectedCondition<WebElement> conditionToWaitParentElement, By innerElementLocator) {
- /*
- реализация методов - ок
- единственное - что стоит подправить -
- в методе $(ExpectedCondition<WebElement> conditionToWaitParentElement, String innerElementCssSelector)
- вызывать
- $(ExpectedCondition<WebElement> conditionToWaitParentElement, By innerElementLocator)
- по сравнению с твоим вариантом - выигрыша в лаконичности практически не будет
- но - так мы лучше обеспечим - что оба этих метода реализованы одинаково
- */
- **********************************************************
- doubleClick($(listElementHasExactText(tasks, oldTaskText), ("label")));
- return setValue($(listElementHasClass(tasks, "editing"), byCss(".edit")), newTaskText);
- или
- doubleClick($(listElementHasExactText(tasks, oldTaskText), "label"));
- return setValue($(listElementHasClass(tasks, "editing"), ".edit"), newTaskText);
- /*
- технически - одно и то же
- но - чуть меньше скобок
- */
- **************************************************************************
- $("#new-todo")
- /*
- используется в 2-ух разных методах
- https://docs.google.com/document/d/13dNyFGbI7mV22UUhH8E0LJ7SzabAmX7Bw7VCHScYfiU/edit#heading=h.pk1xvngaj4rk
- аналогично переменной By tasks
- объяви и инициализируй переменную By newToDo
- и далее ее используй
- */
- **********************************************
- $(listElementHasExactText(tasks, taskText), (".destroy")).click();
- $(listElementHasExactText(tasks, taskText), (".toggle")).click();
- /*
- тут тоже на скобочках можно чуть сэкономить)
- (".destroy") или ".destroy"
- (".toggle") или ".toggle"
- */
- ************************************************
- if ((getDriver().getCurrentUrl() != "https://todomvc4tasj.herokuapp.com"))
- /*
- реализуй в ConciseAPI метод url() с реализацией
- getDriver().getCurrentUrl()
- а в пейдже - вызывай его
- напоминаю - строки сравнивать с помощью знака != или == - бесполезно
- http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java
- http://www.javatpoint.com/string-comparison-in-java
- http://alvinalexander.com/java/edu/qanda/pjqa00001.shtml
- */
- ***************************
- getDriver().navigate().refresh();
- /*
- реализуй в ConciseAPI метод refresh()
- с такой реализацией
- а в пейдже - вызывай его
- */
Advertisement
Add Comment
Please, Sign In to add comment