Skip to content

Commit

Permalink
add tests to assert that configuration tabs show on supported auth me…
Browse files Browse the repository at this point in the history
…thods
  • Loading branch information
meirish committed Jun 14, 2018
1 parent d97deaa commit 9b91394
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ui/app/templates/components/section-tabs.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<nav class="tabs sub-nav">
<ul>
{{#each tabs as |tab|}}
{{#link-to params=tab.routeParams tagName="li"}}
{{#link-to params=tab.routeParams tagName="li" data-test-auth-section-tab=true}}
<a href={{href-to params=tab.routeParams}}>
{{tab.label}}
</a>
Expand Down
18 changes: 18 additions & 0 deletions ui/tests/acceptance/settings/auth/configure/section-test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { test } from 'qunit';
import { create } from 'ember-cli-page-object';
import moduleForAcceptance from 'vault/tests/helpers/module-for-acceptance';
import enablePage from 'vault/tests/pages/settings/auth/enable';
import page from 'vault/tests/pages/settings/auth/configure/section';
import indexPage from 'vault/tests/pages/settings/auth/configure/index';
import apiStub from 'vault/tests/helpers/noop-all-api-requests';
import consolePanel from 'vault/tests/pages/components/console/ui-panel';

const cli = create(consolePanel);

moduleForAcceptance('Acceptance | settings/auth/configure/section', {
beforeEach() {
Expand Down Expand Up @@ -37,3 +42,16 @@ test('it can save options', function(assert) {
);
});
});

['aws', 'azure', 'gcp', 'github', 'kubernetes', 'ldap', 'okta', 'radius'].forEach(function(type) {
test(`it shows tabs for auth method: ${type}`, assert => {
let path = `${type}-${Date.now()}`;
cli.consoleInput(`write sys/auth/${path} type=${type}`);
cli.enter();
indexPage.visit({ path });
andThen(() => {
let numTabs = type === 'aws' ? 4 : 2;
assert.equal(page.tabs.length, numTabs, 'shows correct number of tabs');
});
});
});
3 changes: 2 additions & 1 deletion ui/tests/pages/settings/auth/configure/section.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { create, clickable, visitable } from 'ember-cli-page-object';
import { create, clickable, visitable, collection } from 'ember-cli-page-object';
import fields from '../../../components/form-field';
import flashMessage from '../../../components/flash-message';

export default create({
...fields,
tabs: collection('[data-test-auth-section-tab]'),
visit: visitable('/vault/settings/auth/configure/:path/:section'),
flash: flashMessage,
save: clickable('[data-test-save-config]'),
Expand Down

0 comments on commit 9b91394

Please sign in to comment.