1

I use Karate software and I want include some scenarios into one features - run it in non parallel state, scenarios needed to be run in order from to the top to the down.

I have following code:

@parallel=false
Feature: TC_C - Component detail check

Scenario: Check component detail

    # Login (prerequisity)
    * call read('classpath:ui/common/login.feature')
    * waitForUrl('/applications')
    * match driver.url == baseUrl + 'applications'

    # Step 0 (Create an application and a component inside)
    * call read('classpath:ui/common/applicationCreation.feature')
    * call read('classpath:ui/common/componentCreation.feature')

Scenario: Step1

    # Step 1
    When retry(20, 3000).click('//*[normalize-space(text()) = \'' + compName + '\']/../td/a/span[2][normalize-space(text()) = \'Detail\']/..')
    Then waitForText('.card-header', 'Component Detail')

"Scenario: Check component detail" passes successfully.

Problem is with first row of second scenario where an error occurs:

com.intuit.karate.exception.KarateException: TC_C.feature:18 - javascript evaluation failed: retry(20, 3000).click('//*[normalize-space(text()) = \'' + compName + '\']/../td/a/span[2][normalize-space(text()) = \'Detail\']/..'), ReferenceError: "retry" is not defined in <eval> at line number 1

It seems to be trouble with retry and I have no idea how to run it without the error...

I have tried it in different places but trouble with retry occurs evenif without separation to more Scenarios it works properly.. If there is no split into two scenarios and only one scenario exists everything works ok.

Why I am doing it is that I want to have feature including Multiple scenatios (outline scenario(s) or standard scenario(s))

If you have any idea I will be pleased. Thank you.

Radim Bukovský
  • 337
  • 2
  • 11

1 Answers1

0

The argument to click() seems to be really complicated and I'm sure it has got the nesting of quotes wrong. So please try and fix that.

For example wouldn't this work:

* retry(20, 3000).click('{}Detail')

If you are still stuck, please follow this process: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • Hello, the code works fine when it is all in one scenario. But when I separete it into more scenarios there are these troubles with retry() and I do not know the reason why (Scenarios are run in sequential order). I have tried in few different tests, but there is still the same problem - ReferenceError: "retry" is not defined in . – Radim Bukovský May 21 '20 at 15:29
  • @RadimBukovský looks like you fell into a common trap: https://stackoverflow.com/a/46080568/143475 – Peter Thomas May 21 '20 at 15:34