【发布时间】:2020-03-06 13:47:44
【问题描述】:
我有一个带有两个输入的表单
context('Include contains from json file', function () {
beforeEach(() => {
cy.server()
cy.fixture("example.json")
.as('data')
.then((data) => {
cy.route('GET', 'example.json', data)
})
})
it('Výběr klienta', function () {
cy.visit('/info')
cy.get('[data-cy=username]').type(JSON.stringify(this.data)
cy.get('[data-cy=surname]').type(JSON.stringify(this.data)
})
})
如何为来自外部文件 .json 的两个或多个输入键入包含
我的 .json 文件
{
"name": "Jane"
"surname": "Doe"
}
【问题讨论】:
-
您可能想使用
this.data.name而不是JSON.stringify(this.data)