From aa783e4d5a8c98690943b487f111ceb18c2ea131 Mon Sep 17 00:00:00 2001 From: Susmitha Girumala Date: Tue, 11 Aug 2020 19:00:01 -0400 Subject: [PATCH] test: Update deauthenticate test data-test attribute --- ui/core/app/templates/application.hbs | 13 ------------- ui/core/tests/acceptance/authentication-test.js | 9 +++++++-- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/ui/core/app/templates/application.hbs b/ui/core/app/templates/application.hbs index 8a88d8271..2422a624e 100644 --- a/ui/core/app/templates/application.hbs +++ b/ui/core/app/templates/application.hbs @@ -7,18 +7,6 @@ - {{!-- - - - {{t 'dev.menu-item'}} - {{t 'dev.menu-item'}} - {{t 'dev.button-menu-item'}} - - {{t 'dev.section'}} - {{t 'dev.section'}} - - --}} - {{#if this.session.isAuthenticated}} {{t 'actions.deauthenticate'}} diff --git a/ui/core/tests/acceptance/authentication-test.js b/ui/core/tests/acceptance/authentication-test.js index ca997453c..65d57018f 100644 --- a/ui/core/tests/acceptance/authentication-test.js +++ b/ui/core/tests/acceptance/authentication-test.js @@ -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); });