Bug: Fix namespace test (#10662)

* cannot do full refresh of page, so set the current URL instead of using the toggle

* add comment remove pauseTest

* remove

* check for namespace in toggle
This commit is contained in:
Angel Garbarino 2021-01-06 14:33:43 -07:00 committed by GitHub
parent 9064097c5d
commit ad42d8f6ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 16 deletions

View File

@ -1,4 +1,3 @@
import Ember from 'ember';
import { inject as service } from '@ember/service';
import { alias } from '@ember/object/computed';
import Component from '@ember/component';
@ -33,13 +32,6 @@ export default Component.extend({
}),
get namespaceLink() {
if (Ember.testing) {
if (this.normalizedNamespace) {
return `/ui/vault/secrets?namespace=${this.normalizedNamespace}`;
}
return `/ui/vault/secrets`;
}
let origin =
window.location.protocol +
'//' +

View File

@ -1,4 +1,4 @@
import { click, settled } from '@ember/test-helpers';
import { click, settled, visit } from '@ember/test-helpers';
import { module, test } from 'qunit';
import { setupApplicationTest } from 'ember-qunit';
import { create } from 'ember-cli-page-object';
@ -13,12 +13,6 @@ const createNS = async name => {
await shell.runCommands(`write sys/namespaces/${name} -force`);
};
const switchToNS = async name => {
await click('[data-test-namespace-toggle]');
await click(`[data-test-namespace-link="${name}"]`);
await click('[data-test-namespace-toggle]');
};
module('Acceptance | Enterprise | namespaces', function(hooks) {
setupApplicationTest(hooks);
@ -50,7 +44,18 @@ module('Acceptance | Enterprise | namespaces', function(hooks) {
}
// the namespace path will include all of the namespaces up to this point
let targetNamespace = nses.slice(0, i + 1).join('/');
await switchToNS(targetNamespace);
let url = `/vault/secrets?namespace=${targetNamespace}`;
// check if namespace is in the toggle
await click('[data-test-namespace-toggle]');
await settled();
// check that the single namespace "beep" or "boop" not "beep/boop" shows in the toggle display
assert
.dom(`[data-test-namespace-link="${targetNamespace}"]`)
.hasText(ns, 'shows the namespace in the toggle component');
// close toggle
await click('[data-test-namespace-toggle]');
// because quint does not like page reloads, visiting url directing instead of clicking on namespace in toggle
await visit(url);
await settled();
}
await logout.visit();