Currently, I am utilizing Karma for conducting an e2e test in AngularJS.
I have noticed that, within a describe()
block, the it()
blocks always seem to be executed after any nested describe()
blocks, regardless of their sequence in the test. Why is this so?
For instance:
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' ...
// Setting up a nested describe specifically for the 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' ...
} );
});
The order of execution will look like this:
* Hello Page Nav Bar
* Nav Bar Menu Items
* should have 12
* should be on the hello page
It seems logical to want to first test "should be on the hello page", before proceeding with anything else.