Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI/database mssql #11231

Merged
merged 21 commits into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8a5f949
Add ember-promise-helpers dep
chelshaw Mar 16, 2021
3546d42
database plugin is passed to role edit component based on fetched con…
chelshaw Mar 16, 2021
8afd8a2
Connection form updates dynamically based on plugin type
chelshaw Mar 29, 2021
b09c74e
Simplify role setting form logic and add other statement types
chelshaw Mar 29, 2021
ab67f88
Use subtext as helperText on TTL picker form
chelshaw Mar 29, 2021
9f8c998
remove unused connection fields, fix styling on fieldset
chelshaw Mar 29, 2021
2425869
Organize connection model attrs by docs
chelshaw Mar 29, 2021
ab5626f
Fix tests for db
chelshaw Mar 31, 2021
0390cf5
remove pause in test
chelshaw Mar 31, 2021
28bc560
WIP add test for new databases
chelshaw Apr 2, 2021
60fa68e
Merge branch 'master' into ui/database-mssql
chelshaw Apr 2, 2021
1bbb277
Replace happy path single connection test with test for all connectio…
chelshaw Apr 2, 2021
9c0de54
Add dynamic test cases to database-role-setting-form test
chelshaw Apr 2, 2021
faebbb0
clean up lint
chelshaw Apr 2, 2021
b27d2fe
Add rotate root back to connection toolbar
chelshaw Apr 13, 2021
400bba5
Add label to all readonly form fields
chelshaw Apr 13, 2021
dae70a3
Adjust stringArray label sizing to match other labels
chelshaw Apr 13, 2021
1d33604
Optional text will be enabled on edit if value exists
chelshaw Apr 13, 2021
abd10da
Add username template to connection fields, and docLink attr for form…
chelshaw Apr 14, 2021
6783fea
Add changelog
chelshaw Apr 14, 2021
d5f447a
Safeguard no attr options in form field
chelshaw Apr 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Replace happy path single connection test with test for all connectio…
…n types
  • Loading branch information
chelshaw committed Apr 2, 2021
commit 1bbb2778f40aebac66790f97a3afa18ce32eb22c
80 changes: 9 additions & 71 deletions ui/tests/acceptance/secrets/backend/database/secret-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const connectionTests = [
assert.dom('[data-test-input="write_concern').exists(`Write concern field exists for ${name}`);
assert.dom('[data-test-toggle-group="TLS options"]').exists('TLS options toggle exists');
},
showFields: async name => {},
},
{
name: 'mssql-connection',
Expand All @@ -71,7 +70,6 @@ const connectionTests = [
.dom('[data-test-input="max_connection_lifetime"]')
.exists(`Max connection lifetime exists for ${name}`);
},
showFields: async name => {},
},
];

Expand Down Expand Up @@ -128,23 +126,27 @@ module('Acceptance | secrets/database/*', function(hooks) {
currentURL().startsWith(`/vault/secrets/${backend}/show/${testCase.name}`),
`Saves connection and takes you to show page for ${testCase.name}`
);
testCase.showFields(testCase.name);
assert
.dom(`[data-test-row-value="Password"]`)
.doesNotExist(`Does not show Password value on show page for ${testCase.name}`);
await connectionPage.edit();
assert.ok(
currentURL().startsWith(`/vault/secrets/${backend}/edit/${testCase.name}`),
`Edit connection button and takes you to edit page for ${testCase.name}`
);
assert.dom(`[data-test-input="name"]`).hasAttribute('readonly');
assert.dom(`[data-test-input="plugin_name"]`).hasAttribute('readonly');
assert.dom('[data-test-input="password"]').doesNotExist('Password is not available for edit');
assert.dom('[data-test-input="password"]').doesNotExist('Password is not displayed on edit form');
assert.dom('[data-test-toggle-input="show-password"]').exists('Update password toggle exists');
await connectionPage.toggleVerify();
await connectionPage.save();
// click "Add Role"
await connectionPage.addRole();
await settled();
assert.equal(
currentURL(),
`/vault/secrets/${backend}/create?itemType=role`,
'Add role links to new role page'
searchSelectComponent.selectedOptions[0].text,
testCase.name,
'Database connection is pre-selected on the form'
);
}
});
Expand Down Expand Up @@ -212,70 +214,6 @@ module('Acceptance | secrets/database/*', function(hooks) {
.hasText('No connections in this backend', 'No connections listed because it was deleted');
});

test('Connection edit form happy path works as expected', async function(assert) {
await mount();
const connectionDetails = {
plugin: 'mongodb-database-plugin',
id: 'horses-db',
fields: [
{ label: 'Connection Name', name: 'name', value: 'horses-db' },
{ label: 'Connection url', name: 'connection_url', value: 'mongodb://127.0.0.1:235/horses' },
{ label: 'Username', name: 'username', value: 'user', hideOnShow: true },
{ label: 'Password', name: 'password', password: 'so-secure', hideOnShow: true },
{ label: 'Write concern', name: 'write_concern' },
],
};
await connectionPage.createLink();
await connectionPage.dbPlugin(connectionDetails.plugin);
connectionDetails.fields.forEach(async ({ name, value }) => {
assert
.dom(`[data-test-input="${name}"]`)
.exists(`Field ${name} exists for ${connectionDetails.plugin}`);
if (value) {
await fillIn(`[data-test-input="${name}"]`, value);
}
});
// uncheck verify for the save step to work
await connectionPage.toggleVerify();
await connectionPage.save();
assert
.dom('[data-test-modal-title]')
.hasText('Rotate your root credentials?', 'Modal appears asking to ');
await connectionPage.enable();
connectionDetails.fields.forEach(({ label, name, value, hideOnShow }) => {
if (hideOnShow) {
assert
.dom(`[data-test-row-value="${label}"]`)
.doesNotExist(`Does not show ${name} value on show page for ${connectionDetails.plugin}`);
} else if (!value) {
assert.dom(`[data-test-row-value="${label}"]`).hasText('Default');
} else {
assert.dom(`[data-test-row-value="${label}"]`).hasText(value);
}
});
// go back and edit write_concern
await connectionPage.edit();
assert.dom(`[data-test-input="name"]`).hasAttribute('readonly');
assert.dom(`[data-test-input="plugin_name"]`).hasAttribute('readonly');
// assert password is hidden
assert.dom('[data-test-input="password"]').doesNotExist('Password field is not shown on edit');
findAll('.CodeMirror')[0].CodeMirror.setValue(JSON.stringify({ wtimeout: 5000 }));
// uncheck verify for the save step to work
await connectionPage.toggleVerify();
await connectionPage.save();
assert
.dom(`[data-test-row-value="Write concern"]`)
.hasText('{ "wtimeout": 5000 }', 'Write concern is now showing on the table');
// click "Add Role"
await click('[data-test-secret-create="true"]');
await settled();
assert.equal(
searchSelectComponent.selectedOptions[0].text,
connectionDetails.id,
'Database connection is pre-selected on the form'
);
});

test('buttons show up for managing connection', async function(assert) {
const backend = await mount();
const connection = await newConnection(backend);
Expand Down
2 changes: 1 addition & 1 deletion ui/tests/pages/secrets/backend/database/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default create({
toggleVerify: clickable('[data-test-input="verify_connection"]'),
url: fillable('[data-test-input="connection_url"'),
save: clickable('[data-test-secret-save=""]'),
addRole: clickable('[data-test-secret-create="true"]'),
addRole: clickable('[data-test-secret-create="true"]'), // only from connection show
enable: clickable('[data-test-enable-connection=""]'),
edit: clickable('[data-test-edit-link="true"]'),
delete: clickable('[data-test-database-connection-delete]'),
Expand Down