Merge pull request #134 from hashicorp/feat-ICU-8419-session-recordings-list

feat: 🎸 Session recordings list
This commit is contained in:
Carlos Alcaide Corvo authored and GitHub committed 2023-03-21 10:59:20 -07:00
commit 06af1a9fc4
7 files changed
+181 -10

No files matched your search

@@ -0,0 +1,62 @@
import { module, test } from 'qunit';
import { visit, currentURL, click } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | session recordings | list', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
// Selectors
const LIST_SESSION_RECORDING_BUTTON =
'table > tbody > tr > td:last-child > a';
const instances = {
scopes: {
global: null,
org: null,
},
sessionRecording: null,
};
const urls = {
globalScope: null,
sessionRecordings: null,
sessionRecording: null,
};
hooks.beforeEach(function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
});
instances.sessionRecording = this.server.create('session-recording', {
scope: instances.scopes.global,
});
urls.globalScope = `/scopes/global`;
urls.sessionRecordings = `${urls.globalScope}/session-recordings`;
urls.sessionRecording = `${urls.sessionRecordings}/${instances.sessionRecording.id}`;
authenticateSession({});
});
// TODO: When we add abilities to session-recordings this test will be refactor to account for it.
test('users can navigate to session-recordings', async function (assert) {
assert.expect(1);
// Visit session recordings
await visit(urls.sessionRecordings);
assert.strictEqual(currentURL(), urls.sessionRecordings);
});
// TODO: When we add abilities to session-recordings this test will be refactor to account for it.
test('user can navigate to a session recording', async function (assert) {
assert.expect(2);
// Visit session recordings
await visit(urls.sessionRecordings);
assert.dom('table').hasClass('hds-table');
// Click a session recording and check it navigates properly
await click(LIST_SESSION_RECORDING_BUTTON);
assert.strictEqual(currentURL(), urls.sessionRecording);
});
});
@@ -0,0 +1,13 @@
import { module, test } from 'qunit';
import { setupTest } from 'admin/tests/helpers';
module('Unit | Controller | scopes/scope/session-recordings', function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
let controller = this.owner.lookup(
'controller:scopes/scope/session-recordings'
);
assert.ok(controller);
});
});