[英]Ordering of Angular e2e describe and it blocks
I'm using Karma to run an e2e test in AngularJS. 我正在使用Karma在AngularJS中运行e2e测试。
Within a describe()
block, why are it()
blocks always executed after any nested describe()
blocks regardless of their order in the test? 在describe()
块中,为什么it()
块总是在嵌套的describe()
块之后始终执行,而不管它们在测试中的顺序如何?
For example: 例如:
describe( 'Hello Page Nav Bar', function()
{
it( 'should be on the hello page', function()
{
expect( browser().location().url() ).toBe( '/hello' );
} );
// ... many other it() blocks relating to 'Nav Bar' ...
// Create nested describe specifically for menu items within the nav bar
describe( 'Nav Bar Menu Items', function()
{
it( 'should have 12', function()
{
expect( element( '.menu-items div' ).count() ).toBe( 12 );
} );
// ... many other it() blocks relating to 'Nav Bar Menu Items' ...
} );
});
Will end up executing in this order: 最终将按以下顺序执行:
* Hello Page Nav Bar
* Nav Bar Menu Items
* should have 12
* should be on the hello page
It would make sense that I'd want to test "should be on the hello page" before anything else. 我想先测试“应该在问候页面上” ,这才有意义。
I agree. 我同意。
A workaround is to always keep the describe block containing only other "describe blocks" or only "it blocks". 一种解决方法是始终使describe块仅包含其他“ describe块”或“ it块”。 This way, the order is kept coherent. 这样,顺序保持连贯。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.