Search code examples
selenium-webdriverautomationkarateui-automation

Call a login feature from test feature


I am trying to login to my application using a common feature file. I cannot get this to work. I am not able to run any commands after my common feature file runs.

I get an error like this: org.graalvm.polyglot.PolyglotException: ReferenceError: "waitForEnabled" is not defined

Here is an example of my feature file:

    Feature: Transaction Admin

    Background:
        # Transaction Admin Page
        * def parameters = read('configs.json')
        * def test = read('Login.feature@login-chrome')
        
    @transactionadmin-workflow-updatename
    @test
    Scenario: Search
        # Open Transaction Admin Page
        * test.waitForEnabled(administrationButtonXpath).click()
        And delay(2000).screenshot()

I am trying to call my 'Login.feature' file which will set the driver and login to my application. That runs successfully but the next step that tries to run always fails. In this case it is 'waitForEnabled'.

I have been looking at the documentation and I am not sure what I am missing. https://github.com/karatelabs/karate/tree/develop/karate-core#code-reuse https://github.com/karatelabs/karate/blob/master/karate-demo/src/test/java/demo/headers/call-updates-config.feature https://github.com/karatelabs/karate#shared-scope


Solution

  • What ended up working for me was not having my 2nd file refer to another file. I guess three levels deep is too deep...