Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/398.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Cypress chrome未在调试器语句处暂停_Javascript_Cypress - Fatal编程技术网

Javascript Cypress chrome未在调试器语句处暂停

Javascript Cypress chrome未在调试器语句处暂停,javascript,cypress,Javascript,Cypress,我在测试中有以下代码: it('shows correct language', () => { cy.visit('/product/my product'); cy.changeLanguage('English'); cy.get('[data-test=attribute-name]').should( (elements) => { console.log('this shows in console', elements); a

我在测试中有以下代码:

it('shows correct language', () => {
  cy.visit('/product/my product');
  cy.changeLanguage('English');
  cy.get('[data-test=attribute-name]').should(
    (elements) => {
      console.log('this shows in console', elements);
      alert('But it wont break!!!!!!!!!!');//this alert shows
      debugger;//never breaks here
    },
  );
});
/node\u modules/.bin/cypress open
启动cypress,然后我在cypress窗口中运行测试,该窗口打开chrome,我手动打开开发工具(不知道如何告诉cypress在开发工具打开时打开chrome)

它在控制台中显示消息并显示警报,但从未实际中断。在
sources
选项卡中,未设置“停用断点”,因此断点处于活动状态


手动设置断点,然后单击“运行所有测试”按钮。第一次运行后,将在手动设置的断点上暂停,但忽略
调试器
语句。

我想我已经设法解决了您遇到的问题

您可以使用
cy.debug()
,而不是使用
debugger
。但是为了让它工作,您需要在运行测试时打开调试器/控制台


查看此页面了解更多信息:

它现在暂停,但在
http://localhost:8080/__cypress/runner/cypress_runner.js
而这离我希望它在测试中暂停的位置还差得远。尝试退出,但25次之后,我仍然使用cypress代码,而不在测试中。代码中的正常调试语句和断点仍然被完全忽略。这是否与cypress必须重建代码和/或使用源代码映射有关?如果我将console.log语句放在那里,我会在控制台中看到它们,单击它会将我带到日志所在的确切行(原始代码,而不是传输版本)@HMR你找到了吗?