How do I use resume() in Angular JS e2e testing?

柔情痞子 提交于 2019-12-11 06:16:44

问题


I am going through step three of this angular js tutorial. http://docs.angularjs.org/tutorial/step_03

The very last task is to "Add a pause() statement inside of an end-to-end test and rerun it."

I was able to add pause() and the test paused as it should. The question is, how to resume?

The documentation for pause() here indicates calling resume() in the console or clicking the resume link in the Runner UI, but I can't seem to figure out how to call resume from the console, nor can I find the resume link in the Runner UI.

How do you call resume()?


回答1:


My guess is you put the pause() function call in the wrong place in your test\e2e\scenarios.js file. I did this same thing - the test doesn't pause, it finishes the first or both or neither, depending on where you put the pause() call.

Put the pause() call in your beforeEach(...) call like so

beforeEach(function() {
    browser().navigateTo('app/index.html');

    pause();
});

Then add the new it(...) method given in the tutorial directly after the closing parenthesis of the it('should filter the phone...) function.

Now the e2e test page will pause before executing each it(...) section and let you change the DOM contents before the test runs. For example, if you click 'resume' without searching for anything the first test passes because there are 3 phone entries in the list. But if you search for xyz it will fail because there will not be any phone entries in the list.

You can also place the pause() call before each expect(repeater(...)) or input('...') call to have the test pause before each sub test. By placing a pause() before each expect(...) call you can edit the DOM after the input('...') call has changed it but before the assertion is made so you can see how the input changes the content and why changing that content yourself might cause an asssertion (expect(...)) to fail or succeed.



来源:https://stackoverflow.com/questions/20911771/how-do-i-use-resume-in-angular-js-e2e-testing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!