test: Update deauthenticate test data-test attribute

This commit is contained in:
Susmitha Girumala committed 2020-08-11 19:00:01 -04:00
1 parent 518ce7c199
commit aa783e4d5a
2 files changed
+7 -15

No files matched your search

-13
View File
@@ -7,18 +7,6 @@
<Rose::Header as |header|>
<header.brand @logo="logo-hashi" @text={{app-name}} />
{{!--
<header.nav as |nav|>
<nav.dropdown @text={{t 'dev.default-org'}} as |dropdown|>
<dropdown.link @route="index">{{t 'dev.menu-item'}}</dropdown.link>
<dropdown.link @route="orgs">{{t 'dev.menu-item'}}</dropdown.link>
<dropdown.button>{{t 'dev.button-menu-item'}}</dropdown.button>
</nav.dropdown>
<nav.link @route="index">{{t 'dev.section'}}</nav.link>
<nav.link @route="index">{{t 'dev.section'}}</nav.link>
</header.nav>
--}}
{{#if this.session.isAuthenticated}}
<header.utilities as |utilities|>
<utilities.dropdown
@@ -27,7 +15,6 @@
@icon="user-square-fill" as |dropdown|
>
<dropdown.button
data-test-deauthenticate
{{on "click" (route-action "invalidateSession")}}
>
{{t 'actions.deauthenticate'}}
@@ -1,5 +1,5 @@
import { module, test } from 'qunit';
import { visit, currentURL, fillIn, click, find } from '@ember/test-helpers';
import { visit, currentURL, fillIn, click, find, findAll } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { Response } from 'miragejs';
@@ -158,13 +158,18 @@ module('Acceptance | authentication', function (hooks) {
});
test('deauthentication redirects to first authenticate method', async function (assert) {
// TODO: Identify deauthenticate in menu through data-test attributes in non-production env only
assert.expect(3);
await visit(authMethodAuthenticateURL);
await fillIn('[name="identification"]', 'test');
await fillIn('[name="password"]', 'test');
await click('[type="submit"]');
assert.ok(currentSession().isAuthenticated);
await click('[data-test-deauthenticate]');
// Open header utilities dropdown
await click('.rose-header-utilities .rose-dropdown summary');
// Find and click on last element in dropdown - should be deauthenticate button
const menu = findAll('.rose-header-utilities .rose-dropdown .rose-dropdown-content button');
await click(menu[menu.length - 1]);
assert.notOk(currentSession().isAuthenticated);
assert.equal(currentURL(), authMethodAuthenticateURL);
});