From 774d9a8bff02fe3e8abb55831eb832d9c14bfae6 Mon Sep 17 00:00:00 2001 From: Carlos Alcaide Date: Tue, 21 Mar 2023 10:38:19 -0700 Subject: [PATCH] Add acceptance test --- .../session-recordings/list-test.js | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 ui/admin/tests/acceptance/session-recordings/list-test.js diff --git a/ui/admin/tests/acceptance/session-recordings/list-test.js b/ui/admin/tests/acceptance/session-recordings/list-test.js new file mode 100644 index 000000000..b7c23f02b --- /dev/null +++ b/ui/admin/tests/acceptance/session-recordings/list-test.js @@ -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 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); + }); +});