我已经VS代码配置了这样的量角器调试调试任务:如何用VS代码调试器记录量角器文本元素?
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Debug Tests (Local)",
"program": "${workspaceRoot}/node_modules/protractor/bin/protractor",
"args": [
"${workspaceRoot}/config/protractor/protractor.conf.override.js"
]
}
]
}
说我有这个测试:
it('description', function() {
expect(this.myPageObject.title.getText()).toEqual('My PO Title');
})
这一切工作正常,但现在我特林调试这与VS代码。我给自己定的expect
线断点和调试工作本身就好了。但是现在我想打印(到调试控制台)this.myPageObject.title.getText()
的值。
我知道getText
和大多数其他量角器方法返回的承诺,我需要解决这些问题,但我不知道怎么样。以下是我所尝试的:
this.myPageObject.title.getText()
ElementFinder {browser_: ProtractorBrowser, then: (fn, errorFn) => { … }, parentElementArrayFinder: ElementArrayFinder …}
this.myPageObject.title.getText().then(console.log)
ManagedPromise {flow_: ControlFlow, stack_: null, parent_: ManagedPromise …}
我错过了什么?
1)IMO是违背了使用调试器,如果我不得不改变我的代码,所有的时间只是为了调试的全部目的。 2)我似乎没有这种方式访问我的测试环境。 3)没有工作,“等待”没有定义。 –