При выполнении теста Cucumber выдает ошибку и неопределенное орудие со следующим фрагментом - PullRequest
0 голосов
/ 06 ноября 2018

При выполнении теста веб-драйвера Cucumber / javascript / selenium я получаю Undefined. Implement with the following snippet: this.Then(/^I should display "([^"]*)" under the search area$/, function (arg1, callback){ callback(null, 'pending');..... При наборе текста в области поиска система отобразит список результатов в поле ввода поиска. Из результатов поиска я ищу элемент с текстом «Проектировщики зданий». Любая идея, почему это выбрасывает как неопределенный?

Feature: Test search 
   Scenario: List all the items based on input text provide in search
        When I typed the following "Building" text in input
        Then I should display "Building Designers" under the search area

// search-steps.js

this.When(/^I typed the following "([^"]*)" text in input$/, (text) =>{
      return helpers.loadPage('https://www.sometestsite.com')    
      .then(()=>{
          driver.findElement(By.id('search')).sendKeys(text);
      })
    })



this.Then(/^I should display "([^"]*)"under the search area&/, function (mytxt){
        return driver.wait(until.elementsLocated(By.cssSelector("div.SearchResults--result.button")), 50000).getText().then(el => {
        console.log("print text here:"+el);
        const displayTxt = el;  
        expect(displayTxt).to.be.eql(mytxt);        
        });     
    })

enter image description here

1 Ответ

0 голосов
/ 06 ноября 2018
this.Then(/^I should display "([^"]*)"under the search area&/, function (mytxt){

У вас есть & вместо $ в конце

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...