标签: e2e-testing

我们如何在量角器中获得失败规格列表?

我正在使用Protractor进行e2e测试,在afterLaunch函数中的量角器配置文件中我试图获取所有失败规范的列表,以便我可以在松弛的相应通道上发送松弛消息,有没有办法做到这一点?

protractor slack-api e2e-testing slack

1
推荐指数
1
解决办法
471
查看次数

在生产中运行端到端测试是否值得?

如何在生产中实施e2e而又不破坏数据库的一致性?想象一下,我们需要测试的场景是一个用户注册。如果我们在生产中运行此测试,它将每次创建一个假用户。

难题在于端到端测试非常重要,我们有更大的灵活性在分阶段环境中运行它们。但是,在生产中,我们遭受数据一致性低的困扰,并且无法检测到特定于生产的错误。因此,是否有一种方法可以在生产中正确实施端到端测试,还是应该在阶段进行测试?提前致谢

testing automated-tests production-environment e2e-testing devops

1
推荐指数
1
解决办法
695
查看次数

如果 NightwatchJS 中不存在元素如何停止测试而不会出错

在我的 Nightwatch 测试中,我有一个 before 每个运行并从 Facebook 中删除一个应用程序。如果应用程序不存在,我只想停止之前的测试。

.waitForElementPresent('#root div.touchable a', 2000, false, function (result) {
  if (result.value === false) {
    browser.saveScreenshot('./test/e2e/img/element-not-there.png')
    browser.end()
  }
})
.doSomethingIfElementIsThere() // not real ;)
Run Code Online (Sandbox Code Playgroud)

即使设置了false参数,这似乎也不起作用。我收到此错误:

ERROR: Unable to locate element: "#root div.touchable a" using: css selector
    at Object.before (/Users/user/projects/project/test/e2e/specs/testy-mc-test-face.js:30:8)
 ? Timed out while waiting for element <#root div.touchable a> to be present for 2500 milliseconds.  - expected "found" but got: "not found"
    at Object.before (/Users/user/projects/project/test/e2e/specs/testy-mc-test-face.js:30:8)
Run Code Online (Sandbox Code Playgroud)

只是想知道如何检查某些东西而不是错误。或者如果元素存在,则继续断言?

谢谢水桶

javascript nightwatch.js vue.js e2e-testing

1
推荐指数
1
解决办法
2743
查看次数

TestCafe 团队是否计划正式支持 Gherkin (BDD)?如果不是,目前将 TestCafe 与 Gherkins 集成的最佳方式是什么?

我的团队有点像 TestCafe,但对采用它有一些保留意见。主要是支持 Gherkin 集成。gherkin-testcafe npm 包和示例https://github.com/helen-dikareva/testcafe-cucumber-demo似乎还没有准备好迎接黄金时段。

这是目前支持 BDD 的更可靠方式吗?

testing bdd gherkin e2e-testing testcafe

1
推荐指数
1
解决办法
1620
查看次数

Cypress.io如何构建复杂的测试

我想把我的公司从黄瓜切换到柏树.原因是我们正在慢慢采用SPA方法,我们遇到很多问题,黄瓜(严重定制)不知道如何正确测试(不知道何时加载应用程序)我们花了很多时间只是为每个测试修复该问题.应用程序真的很大,现在我们用黄瓜写了数千个测试.

所以我们的用例在我们实际测试之前需要多个动作.示例路径

1)注册新用户(唯一用户需要有电子邮件,名字和姓氏)

2)创建新的报价(多步骤报价创建机制,上传图像等)

3)我们实际上可以开始做某事

因此,需要在每个文件之前执行此提供和用户创建(在某些情况下,我们需要超过1个用户和多于1个提供,具体取决于测试)

在黄瓜中,我们已经编写了所有这些机制.但是如何在柏树中构建这个呢?

我们应该创建单独的文件夹吗 我们可以称之为的行动?(这意味着我们将这些行为作为功能).

我不是e2e测试员(我是JS开发人员),但由于所有QA都已消失,因此我有责任维护和支持e2e测试.

tdd cucumber e2e-testing cypress

1
推荐指数
1
解决办法
2559
查看次数

TestCafe与Cucumber集成-github项目超时的测试用例

我一直在尝试使用JavaScript框架进行自动化测试,其中之一就是testCafe。我已经能够建立一个简单的TestCafe项目并为我的应用程序运行一些测试用例。但是,现在的要求是内置一些BDD支持。我在GitHub上查找了一些testCafe-cucumber集成项目,但无法运行它们。这是我尝试过的一些方法:

1)https://github.com/rquellh/testcafe-cucumber- 我克隆了存储库,-安装了npm,-使用“ npm test”运行测试用例,-启动空白浏览器,但测试未运行。我在VS代码控制台中看到此错误:

× Before # features\support\hooks.js:46
           Error: function timed out, ensure the promise resolves within 20000 milliseconds
               at Timeout._onTimeout (C:\Users\Mo\Desktop\TestCafe\github\testCafeBDD\testcafe-cucumber\node_modules\cucumber\src\user_code_runner.js:61:18)
               at ontimeout (timers.js:482:11)
               at tryOnTimeout (timers.js:317:5)
               at Timer.listOnTimeout (timers.js:277:5)



× After # features\support\hooks.js:60
       ReferenceError: testController is not defined
Run Code Online (Sandbox Code Playgroud)

然后我尝试了另一个gitHub项目,即这个项目:https : //github.com/kiwigrid/gherkin-testcafe

自述文件中的运行命令对我不起作用,甚至无法识别“ gherkin-testcafe”。

当我运行没有黄瓜的TestCafe测试用例时,我的package.json中有这一行

"scripts": {
    "test": "testcafe chrome Tests/ -e --proxy https.proxy.mycompany.com:8000"
  },
Run Code Online (Sandbox Code Playgroud)

之所以提到该代理,是因为我位于代理之后,没有该代理,浏览器将启动,但不会运行任何测试用例。我在testCafe网站上找到此修复程序

我猜(不确定)这可能也是黄瓜整合的问题。这些框架都不起作用,因为它们没有在任何地方设置代理。有人可以指出我正确的方向吗?如果需要设置代理,那么它需要在框架中的哪个位置进行操作-一个示例会有所帮助吗?

bdd automated-tests cucumber e2e-testing testcafe

1
推荐指数
1
解决办法
468
查看次数

如何等待加载时间较长的页面加载testcafe?

从这些文档:https: //devexpress.github.io/testcafe/documentation/test-api/actions/navigate.html

看起来我们只能等待15秒才能加载页面.

我们开发了一个NextJS应用程序,它的首次加载需要40秒,因为它在第一次加载时构建应用程序.

我似乎无法使TestCafe在初始页面加载时没有超时.

我试过了

fixture('Restaurant List')
  .page('http://localhost:3000/something')
  .beforeEach(async () => {
    await waitForReact(120000);
  });
Run Code Online (Sandbox Code Playgroud)

例如没有成功.

automated-tests e2e-testing testcafe next.js

1
推荐指数
1
解决办法
458
查看次数

如何重用现有赛普拉斯测试中的功能,并在新测试中调用它?

我有以下函数,它在父函数中。

        function generate_random_string(string_length) { // A function that creates a random string and will later pass this to a variable
            let random_string = '';
            let random_ascii;
            for(let i = 0; i < string_length; i++) {
                random_ascii = Math.floor((Math.random() * 25) + 97);
                random_string += String.fromCharCode(random_ascii)
            }
            return random_string
        }

        var random_string = generate_random_string(6)
Run Code Online (Sandbox Code Playgroud)

对于不同情况的其他测试文件,此随机字符串生成器有很多用途。无需每次都复制和粘贴此函数,我想重用此函数并在另一个测试文件中调用它。

我应该如何设置?

我试图在commands.js文件中创建一个自定义命令,如下所示:

Cypress.Commands.add("random_string_gen", 
    function generate_random_string(string_length) {
      let random_string = '';
      let random_ascii;
      for(let i = 0; i < string_length; i++) {
          random_ascii = Math.floor((Math.random() …
Run Code Online (Sandbox Code Playgroud)

javascript e2e-testing cypress

1
推荐指数
1
解决办法
1047
查看次数

失败:脚本超时:在11秒内未收到结果来自:任务:Protractor.waitForAngular()-定位器:作者(css选择器,#my-btn)

我正在尝试使用Protractor为我的Angular应用程序编写一些e2e测试。

我有一个id=my-btn想要单击的简单html按钮,使用:

$('#my-btn').click();
Run Code Online (Sandbox Code Playgroud)

不幸的是我遇到以下错误:

失败:脚本超时:11秒内未收到结果

来自:任务:Protractor.waitForAngular()-定位器:通过(css选择器,#my-btn)

(Session info: chrome=73.0.3683.75)
(Driver info: chromedriver=2.46.628411 (3324f4c8be9ff2f70a05a30ebc72ffb013e1a71e),platform=Mac OS X 10.14.3 x86_64)
Run Code Online (Sandbox Code Playgroud)

如果在点击之前我设置了:

browser.waitForAngularEnabled(false);
Run Code Online (Sandbox Code Playgroud)

那我就没有任何错误 问题在于这样做意味着:

 * If set to false, Protractor will not wait for Angular $http and $timeout
 * tasks to complete before interacting with the browser. This can cause
 * flaky tests, but should be used if, for instance, your app continuously
 * polls an API with $timeout.
Run Code Online (Sandbox Code Playgroud)

所以我想什么导致waitForAngular操作超时。

有没有办法检查仍然挂起的HTTP或超时? …

typescript protractor e2e-testing angular angular-e2e

1
推荐指数
1
解决办法
2185
查看次数

Is there any way to click the "Sign In" link on github page using javascript for testcafe?

I want to click the "Sign In" on the GitHub page for testcafe using javascript. From inspecting part I found that "Sign in" part has a class name. So I was trying to use "Selector" to select that particular class. But it is giving me this error. "The specified selector does not match any element in the DOM tree.

   Selector('HeaderMenu-link no-underline mr-3').withText('Sign&nbsp;in')
Run Code Online (Sandbox Code Playgroud)

javascript automated-tests github e2e-testing testcafe

1
推荐指数
1
解决办法
77
查看次数