猿问

测试期间弹出消息框

我有一个通过 test cafe studio 运行的测试,该测试进入网站,点击页面并暂停。在暂停期间,我希望弹出一个消息框并显示一条评论(用作解释网站上发生的事情的教学工具)。我已经尝试了几种选择,但它们都不起作用。我对此很陌生,可能会遗漏一些东西?


提前致谢!这是我的简单测试代码


import { Selector, ClientFunction } from 'testcafe'; 从“弹出窗口”导入{弹出窗口};夹具svdemo manager cockpit 。第http://localhost/SvManagerCockpit/home .httpAuth({用户名: 'myusernamehere',密码: 'mypasswordhere',域: 'mydomainhere'});


test('Pause', async t => { await t .click(Selector('span').withText('Machine OEE Dashboard')) .wait(10000); popup.alert({ content: 'Hello!' } ); 返回 1; });


await t

 .expect(alert()).eql(1);

}); 我希望在 .js 测试中插入一些代码以在浏览器中生成一个消息框/对话框。


精慕HU
浏览 171回答 2
2回答

慕盖茨4494581

只是快速浏览一下,您的警报末尾没有分号吗?也许尝试添加这些,看看会发生什么。如果这不起作用,请发布您的完整代码,以便我们查看!
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答