当使用 shardTestFiles 配置测试时,Protractor toContain 失败:true
Protractor toContain failing when tests configured with shardTestFiles: true
我正在 运行使用量角器进行一些 angular 端到端测试,结果期望失败。
expect: Expected [ 'Integration Test Acquirer Automatically
generated EUR,GBP,USD activated' ] to contain 'Integration
Test Acquirer Automatically generated EUR'.
我在这个期望中使用的代码是:
expect(processingPathListElement.count()).toEqual(1);
expect(processingPathListElement.getText()).toContain('Integration Test Acquirer Automatically generated EUR');
所以文本 "Integration Test Acquirer Automatically generated EUR" 实际上包含在 "Integration Test Acquirer Automatically generated EUR,GBP,USD" 中。
我应该提一下,只有当我使用测试分片时,这个测试才会失败(运行浏览器的多个实例而不是一个,并将测试分配给它们)。测试 运行ning 在 5 个 Firefox 实例中进行。另一件事是我使用 contain 而不是查看整个字符串并使用匹配器 "toEqual" 因为当我 运行 测试在货币之间切分 space (应该是 "EUR, GBP, USD" 最终被 "EUR,GBP,USD") 删除。我不太关心第二个问题,但我确实关心第一个问题。当我 运行 使用配置进行测试时,这个问题再次出现:
capabilities: {
'browserName': 'firefox',
shardTestFiles: true,
maxInstances: 5
},
如果我删除 shardTestFiles: true
测试通过。
以下是失败测试的全部信息:
expect: Expected [ 'Integration Test Acquirer Automatically
generated EUR,GBP,USD activated' ] to contain 'Integration
Test Acquirer Automatically generated EUR'.
Error: Failed expectation
at null.<anonymous> (/Users/bamboo/bamboo-home/xml-data/build-dir/IOG-TESTFE61-JOB1/test/e2e/merchants/merchant/merchantMPOSSpec.js:177:69)
at /usr/local/lib/node_modules/protractor/node_modules/jasminewd/index.js:94:14
at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1640:20)
at webdriver.promise.ControlFlow.runEventLoop_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1505:8)
at wrapper [as _onTimeout] (timers.js:252:14)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)expect: Expected [ 'Integration Test Acquirer
Automatically generated EUR,GBP,USD activated' ] to contain
'GBP'.
Error: Failed expectation
at null.<anonymous> (/Users/bamboo/bamboo-home/xml-data/build-dir/IOG-TESTFE61-JOB1/test/e2e/merchants/merchant/merchantMPOSSpec.js:178:69)
at /usr/local/lib/node_modules/protractor/node_modules/jasminewd/index.js:94:14
at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1640:20)
at webdriver.promise.ControlFlow.runEventLoop_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1505:8)
at wrapper [as _onTimeout] (timers.js:252:14)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)expect: Expected [ 'Integration Test Acquirer
Automatically generated EUR,GBP,USD activated' ] to contain
'USD activated'.
Error: Failed expectation
at null.<anonymous> (/Users/bamboo/bamboo-home/xml-data/build-dir/IOG-TESTFE61-JOB1/test/e2e/merchants/merchant/merchantMPOSSpec.js:179:69)
at /usr/local/lib/node_modules/protractor/node_modules/jasminewd/index.js:94:14
at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1640:20)
at webdriver.promise.ControlFlow.runEventLoop_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1505:8)
at wrapper [as _onTimeout] (timers.js:252:14)
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
您的选择器 (processingPathListElement) returns 不止一个元素,这就是期望失败的原因。这不是 "toContain" 问题。
我想这应该是评论,但我没有权利。
我正在 运行使用量角器进行一些 angular 端到端测试,结果期望失败。
expect: Expected [ 'Integration Test Acquirer Automatically generated EUR,GBP,USD activated' ] to contain 'Integration Test Acquirer Automatically generated EUR'.
我在这个期望中使用的代码是:
expect(processingPathListElement.count()).toEqual(1);
expect(processingPathListElement.getText()).toContain('Integration Test Acquirer Automatically generated EUR');
所以文本 "Integration Test Acquirer Automatically generated EUR" 实际上包含在 "Integration Test Acquirer Automatically generated EUR,GBP,USD" 中。
我应该提一下,只有当我使用测试分片时,这个测试才会失败(运行浏览器的多个实例而不是一个,并将测试分配给它们)。测试 运行ning 在 5 个 Firefox 实例中进行。另一件事是我使用 contain 而不是查看整个字符串并使用匹配器 "toEqual" 因为当我 运行 测试在货币之间切分 space (应该是 "EUR, GBP, USD" 最终被 "EUR,GBP,USD") 删除。我不太关心第二个问题,但我确实关心第一个问题。当我 运行 使用配置进行测试时,这个问题再次出现:
capabilities: {
'browserName': 'firefox',
shardTestFiles: true,
maxInstances: 5
},
如果我删除 shardTestFiles: true
测试通过。
以下是失败测试的全部信息:
expect: Expected [ 'Integration Test Acquirer Automatically generated EUR,GBP,USD activated' ] to contain 'Integration Test Acquirer Automatically generated EUR'. Error: Failed expectation at null.<anonymous> (/Users/bamboo/bamboo-home/xml-data/build-dir/IOG-TESTFE61-JOB1/test/e2e/merchants/merchant/merchantMPOSSpec.js:177:69) at /usr/local/lib/node_modules/protractor/node_modules/jasminewd/index.js:94:14 at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1640:20) at webdriver.promise.ControlFlow.runEventLoop_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1505:8) at wrapper [as _onTimeout] (timers.js:252:14) at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)expect: Expected [ 'Integration Test Acquirer Automatically generated EUR,GBP,USD activated' ] to contain 'GBP'. Error: Failed expectation at null.<anonymous> (/Users/bamboo/bamboo-home/xml-data/build-dir/IOG-TESTFE61-JOB1/test/e2e/merchants/merchant/merchantMPOSSpec.js:178:69) at /usr/local/lib/node_modules/protractor/node_modules/jasminewd/index.js:94:14 at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1640:20) at webdriver.promise.ControlFlow.runEventLoop_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1505:8) at wrapper [as _onTimeout] (timers.js:252:14) at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)expect: Expected [ 'Integration Test Acquirer Automatically generated EUR,GBP,USD activated' ] to contain 'USD activated'. Error: Failed expectation at null.<anonymous> (/Users/bamboo/bamboo-home/xml-data/build-dir/IOG-TESTFE61-JOB1/test/e2e/merchants/merchant/merchantMPOSSpec.js:179:69) at /usr/local/lib/node_modules/protractor/node_modules/jasminewd/index.js:94:14 at webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1640:20) at webdriver.promise.ControlFlow.runEventLoop_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1505:8) at wrapper [as _onTimeout] (timers.js:252:14) at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)
您的选择器 (processingPathListElement) returns 不止一个元素,这就是期望失败的原因。这不是 "toContain" 问题。
我想这应该是评论,但我没有权利。