test: 💍 add current crumb path checks
This commit is contained in:
1 file changed
+17
-5
@@ -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.');
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user