\在其中创建了一个 Cypress Testscript 并设置为在循环中执行,因为想要在夹具 json 中使用多组测试数据执行。如果您向下并看到 cy.fixture 仅适用于第一个条目,并且测试使用 json 中的第一个条目执行两次(测试数据文件)关于如何包含数组迭代和夹具的任何帮助都会有所帮助
var Launchindex = 0;
for (Launchindex = 0; Launchindex < 2; Launchindex ++) {
describe('Launch testsite',() => {
it('try login using testdata', () => {
cy.visit('https://xyzz')
cy.title().should('contain','title check')
})
it('check url', () => {
cy.url().should('contain','xyz')
})
it('enter details and submit', () => {
//Fixture loads the testdata setup in fixtures folder , so setup testdata required before executing test script
cy.fixture('testdata').then(testdata => {
const ModuleID = testdata[0].ModuleID
const LoginName = …Run Code Online (Sandbox Code Playgroud) cypress ×1