From 8d66c178eb0eafaef556124240aa611d3e701685 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Tue, 16 Jun 2020 10:18:10 -0400 Subject: [PATCH] =?UTF-8?q?test:=20=F0=9F=92=8D=20add=20current=20crumb=20?= =?UTF-8?q?path=20checks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/core/tests/acceptance/bread-crumbs-test.js | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/ui/core/tests/acceptance/bread-crumbs-test.js b/ui/core/tests/acceptance/bread-crumbs-test.js index 4cb61733e..acdd9e736 100644 --- a/ui/core/tests/acceptance/bread-crumbs-test.js +++ b/ui/core/tests/acceptance/bread-crumbs-test.js @@ -16,6 +16,8 @@ module('Acceptance | breadcrumbs', function (hooks) { let newHostCatalogURL; let hostCatalogURL; + let crumbPath; + hooks.beforeEach(function () { project = this.server.create('project'); hostCatalog = this.server.create('host-catalog'); @@ -28,41 +30,51 @@ module('Acceptance | breadcrumbs', function (hooks) { }); test('can navigate via breadcrumbs to projects from project', async function (assert) { - assert.expect(2); + assert.expect(3); await visit(projectURL); assert.equal(currentURL(), projectURL, 'We begin on th expected page.'); + crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname; + assert.equal(crumbPath, projectURL, 'Last crumb has expected URL.'); await click(find('.rose-nav-breadcrumbs-link:first-child')); assert.equal(currentURL(), '/orgs/1/projects', 'After navigating via breadcrumbs, we are one level up.'); }); test('can navigate via breadcrumbs to projects from new project', async function (assert) { - assert.expect(2); + assert.expect(3); await visit(newProjectURL); assert.equal(currentURL(), newProjectURL, 'We begin on th expected page.'); + crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname; + assert.equal(crumbPath, newProjectURL, 'Last crumb has expected URL.'); await click(find('.rose-nav-breadcrumbs-link:first-child')); assert.equal(currentURL(), '/orgs/1/projects', 'After navigating via breadcrumbs, we are one level up.'); }); test('can navigate via breadcrumbs to project from host catalogs', async function (assert) { - assert.expect(2); + assert.expect(3); await visit(hostCatalogsURL); assert.equal(currentURL(), hostCatalogsURL, 'We begin on th expected page.'); + crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname; + assert.equal(crumbPath, hostCatalogsURL, 'Last crumb has expected URL.'); await click(findAll('.rose-nav-breadcrumbs-link')[1]); assert.equal(currentURL(), projectURL, 'After navigating via breadcrumbs, we are one level up.'); }); test('can navigate via breadcrumbs to host catalogs from host catalog', async function (assert) { - assert.expect(2); + assert.expect(3); await visit(hostCatalogURL); assert.equal(currentURL(), hostCatalogURL, 'We begin on th expected page.'); + crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname; + assert.equal(crumbPath, hostCatalogURL, 'Last crumb has expected URL.'); await click(findAll('.rose-nav-breadcrumbs-link')[2]); assert.equal(currentURL(), hostCatalogsURL, 'After navigating via breadcrumbs, we are one level up.'); }); test('can navigate via breadcrumbs to host catalogs from new host catalog', async function (assert) { - assert.expect(2); + assert.expect(3); await visit(newHostCatalogURL); assert.equal(currentURL(), newHostCatalogURL, 'We begin on th expected page.'); + crumbPath = new URL(find('.rose-nav-breadcrumbs-link:last-child').href).pathname; + assert.equal(crumbPath, newHostCatalogURL, 'Last crumb has expected URL.'); await click(findAll('.rose-nav-breadcrumbs-link')[2]); assert.equal(currentURL(), hostCatalogsURL, 'After navigating via breadcrumbs, we are one level up.'); });