从测试功能调用登录功能

问题描述 投票:0回答:1

我正在尝试使用通用功能文件登录我的应用程序。我无法让它发挥作用。我的公共功能文件运行后,我无法运行任何命令。

我收到这样的错误: org.graalvm.polyglot.PolyglotException:ReferenceError:“waitForEnabled”未定义

这是我的功能文件的示例:

    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()

我正在尝试调用我的“Login.feature”文件,该文件将设置驱动程序并登录到我的应用程序。运行成功,但尝试运行的下一步总是失败。在本例中,它是“waitForEnabled”。

我一直在查看文档,但不确定我错过了什么。 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

selenium-webdriver automation karate ui-automation
1个回答
0
投票

您可以像这样替换您的功能文件并重试吗

Feature: Transaction Admin

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

空手道官方文档:https://karatelabs.github.io/karate/karate-core/#code-reuse

© www.soinside.com 2019 - 2024. All rights reserved.