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 kmip acceptance #7129

Merged
merged 9 commits into from
Aug 1, 2019
Merged

UI kmip acceptance #7129

merged 9 commits into from
Aug 1, 2019

Conversation

meirish
Copy link
Contributor

@meirish meirish commented Jul 16, 2019

Adds acceptance tests for the new KMIP secrets engine.

These won’t run here because of the !enterprise filter on the test in Circle, but here is a screencap of them passing locally:

Screen Shot 2019-07-16 at 4 12 59 PM

Additionally, this changes the story blueprint and the gen-story-md script to write markdown files and story files to the folder in lib/{addon}/stories/ and updates storybooks’ config to look for stories in the lib directory as well.

@meirish meirish requested a review from a team July 16, 2019 21:53
// yarn gen-story-md some-component
//
// or if the story is for a component in an in-repo-addon or an engine:
// yarn gen-story-md some-component name-of-engine
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this note should be added to the Storybook instructions in the README as well!

import notes from './list-view.md';
import ArrayProxy from '@ember/array/proxy';

let filtered = ArrayProxy.create({ content: [] });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

out of curiosity, why'd you have to use ArrayProxy here?

Copy link
Contributor Author

@meirish meirish Jul 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The component usually takes a ember data model array which can have meta information on it and we use that meta information to know if we should show pagination, but also to be able to tell the difference between an empty list and a list that is empty because of an overly-specific filter. Maybe this should change to use RecordArrary from ember-data instead 🤔

Copy link
Contributor Author

@meirish meirish Jul 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into it and using RecordArray directly is kinda a pain, but ArrayProxy is the base class of RecordArray so this is probably good enough.

total: 100,
});

let items = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i noticed in the JSDoc comments that items was supposed to be an array, though this is an object. can the component handle either type? or will items always be an object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the items options for the storybook select knob, I'll rename it so that's more apparent. The component usually takes an array though, but RecordArray can have meta items associated to on it.


assert.equal(credentialsPage.listItemLinks.length, 1, 'renders a single credential');

// revoke the credentials
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just a style preference, but is it possible to separate the create and delete tests for scopes, roles, and credentials into separate tests (i.e. testing create and delete separately for each entity)? the tests are starting to look pretty long which can be harder to debug later. if it's too much work to set up each test though then i don't think it' a big deal at all though. 🤷‍♀

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I'll look at divvying these up more.

import { create, clickable, fillable, visitable } from 'ember-cli-page-object';
import ListView from 'vault/tests/pages/components/list-view';

export default create({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whew, setting up all of these page objects is a lot of work. props to you for adding them + all these tests!

@meirish meirish force-pushed the ui-kmip-acceptance branch from 11455fe to 786add6 Compare July 18, 2019 21:36
Copy link
Contributor

@madalynrose madalynrose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small questions but looks great! I echo Noelle's praise of the tests and all of those page objects!

return {
__path__: function(options) {
if (options.inRepoAddon) {
let addon = findAddonByName(project, options.inRepoAddon);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't there a possibility that the addon wouldn't be found, findAddonByName would return -1 and it wouldn't have a .root? How does this handle that case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure so I tried this out, and got this message:

ember g story flash-message -ir foo 
installing story
You specified the 'in-repo-addon' flag, but the in-repo-addon 'foo' does not exist. Please check the name and try again.

* @param items=null {Array} - An array of items to render as a list
* @param [itemNoun=null {String}] - A noun to use in the empty state of message and title.
* @param [message=null {String}] - The message to display within the banner.
* @yields Object with `item` that is the current item in the loop.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooh how does jsdom2md handle @yields? does it make it into the story file? We have a custom template for md and I'm not sure it includes these. If it's just for actually documenting in the code here that makes sense too, but I don't think it would make it to the md file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this was for documentation, but I think it could make sense to pull into a separate table maybe? https://github.com/hashicorp/vault/pull/7129/files/786add6b8b28b4cd84706f73609cf1d2c609b902#diff-db4113d4519f04b3176ff85e5de7e1b4R11 is the param table. Maybe we should look at how ember-cli-addon-docs does it's api doc too because it's 👌 https://ember-learn.github.io/ember-cli-addon-docs/docs/api/components/docs-demo

@jefferai jefferai added this to the 1.2 milestone Jul 24, 2019
@meirish meirish modified the milestones: 1.2, 1.2.1 Jul 24, 2019
@meirish meirish merged commit 783bb2b into master Aug 1, 2019
@meirish meirish deleted the ui-kmip-acceptance branch August 1, 2019 21:05
@jefferai jefferai removed this from the 1.2.1 milestone Aug 5, 2019
@meirish meirish added this to the 1.3 milestone Aug 5, 2019
@meirish meirish removed the backport label Aug 5, 2019
@andaley andaley mentioned this pull request Jan 10, 2020
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants