Then(/^the primary nav is rendered$/, function (done) { const $ = cheerio.load(this.getResponseBody()); const $primaryNav = $('#wrap').find('ul.navbar-nav'); const expectedLinkCount = this.availableResourceTypes.length + Object.keys(this.apiResponseLinks).length; assert.equals($primaryNav.length, 1); assert.greater(expectedLinkCount, 0); assert.equals(expectedLinkCount, $primaryNav.find('> li').length); done(); });