Я использую Karma для запуска теста e2e в AngularJS.
Почему внутри блока describe()
блоки it()
всегда выполняются после любых вложенных блоков describe()
независимо от их порядка в тесте?
Например:
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' ...
} );
});
В конечном итоге выполнение будет выполнено в следующем порядке:
* Hello Page Nav Bar
* Nav Bar Menu Items
* should have 12
* should be on the hello page
Было бы логично, если бы я хотел протестировать "должен быть на странице приветствия" перед чем-либо еще.