Asp.net core 为什么我的cypress e2e测试从未完成?

Asp.net core 为什么我的cypress e2e测试从未完成?,asp.net-core,cypress,blazor-client-side,Asp.net Core,Cypress,Blazor Client Side,我有这个赛普拉斯e2e测试 /// <reference types="Cypress" /> describe('Toss Full Test', function () { let polyfill; const uuid = Cypress._.random(0, 1e6) before(() => { const polyfillUrl = 'https://unpkg.com/whatwg-fetch@3.0.0/dist/fetch.umd.js';

我有这个赛普拉斯e2e测试

/// <reference types="Cypress" />

describe('Toss Full Test', function () {
let polyfill;
const uuid = Cypress._.random(0, 1e6)

before(() => {
    const polyfillUrl = 'https://unpkg.com/whatwg-fetch@3.0.0/dist/fetch.umd.js';
    cy.request(polyfillUrl).then(response => {
        polyfill = response.body;
    });
});
Cypress.on('window:before:load', win => {
    delete win.fetch;
    win.eval(polyfill);
});
const SubscribeEmail = "tosstests" + uuid + "@yopmail.com";
const SubscribePassword = "tossTests123456!!";
const SubscribeLogin = "tosstests" + uuid;

it('Full process', function (win) {
    cy.server();
    cy.visit("/");



    cy.route('POST', '/api/account/register').as('register');
    //this could be lagging as ravendb is starting
    cy.get("#LinkLogin", { timeout: 20000 }).click();
    //register
    cy.get("#LinkRegister").click();
    cy.get("#NewEmail").type(SubscribeEmail);
    cy.get("#NewName").type(SubscribeLogin);
    cy.get("#NewPassword").type(SubscribePassword);
    cy.get("#NewConfirmPassword").type(SubscribePassword);

    cy.window()
        .then(win => {
            // disables runCaptcha
            win.runCaptcha = new win.Function(['action'], 'return Promise.resolve(action)');
        })
        .then(
            () => {
                cy.get("#BtnRegister").click();
                cy.wait('@register');
                cy.get('@register').then(function (xhr) {
                    expect(xhr.status).to.eq(200);
                });

            }
        );
    })
})

代码运行良好,断言“expect(xhr.status).to.eq(200);”返回true,但测试执行从未停止。为什么会这样?

经过大量的尝试和错误之后,我只需要从“if”调用中的方法中删除“win”参数,这是一个获取窗口引用的测试。事实上,这个参数是您需要在测试结束时调用的回调,我找不到任何关于它的文档。

传递给
it
done
回调由提供,它是cypress使用的测试运行程序。您不必调用它,只需不将其声明为参数即可。
docker-compose up -V ravendb web
./node_modules/.bin/cypress open