【问题标题】:Can't import from fixtures folder a file with simple variables无法从夹具文件夹中导入具有简单变量的文件
【发布时间】:2021-06-23 06:06:51
【问题描述】:

我正在学习 Cypress,遇到一个简单的问题:

在fixtures文件夹中有tags.json文件。

这行得通:

cy.intercept('GET', '**/tags', {
    "tags": [
        "cypress‌",
        "‌‌automation",
        "‌‌‌testing"
    ]
})

但这无法加载标签:

cy.intercept('GET', '**/tags', 'fixture:tags.json')

【问题讨论】:

    标签: javascript json cypress


    【解决方案1】:

    如果你是stubbing a response,你必须这样写:

    cy.intercept('GET', '**/tags', { fixture: 'tags.json' })
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-02-10
      • 1970-01-01
      • 2011-03-16
      • 2021-10-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-19
      相关资源
      最近更新 更多