kubernetes-sigs / kui

A hybrid command-line/UI development experience for cloud-native development
Apache License 2.0
2.82k stars 183 forks source link

Please support value attribute for bottom command input bar element #3484

Closed showeimer closed 3 years ago

showeimer commented 4 years ago

We would like the value attribute added to the input element for the bottom command input bar; this will help make writing tests easier for our custom client; seems the text value is hidden in a shadow dom div currently that can't be accessed by E2E test frameworks.

starpit commented 4 years ago

at least in the core, the bottom input is a plain <input> element.

https://github.com/IBM/kui/blob/master/packages/core/templates/index.html#L402

is it possible that your override does something here?

showeimer commented 4 years ago

@starpit

We actually have a dependency on the override to make the tests run in a more stable/efficient manner. While working on the KUI upgrade to 5.7.x, I was making changes to our test suite to be less dependent on the overriding plugin but was running into an issue where the native KUI input bar did not include the value attribute on the input element. We have a need to stabilize our tests by waiting for the test framework to finish "typing" and verify the text before the command gets executed with something like this:

Nightwatch.js

  this.waitForElementPresent('.kui--input-stripe input[value="clear"]')
  this.enter()

Running something like document.querySelector(''.kui--input-stripe input').value in the browser console will yield the the value of the input element, but since the test framework utilizes this kind of CSS selector targeting strategy; the code will break here and we start having stability issues with our tests. I concede that there are probably issues with the test framework itself; but I think it would be good to have this available for other persons writing custom clients and their own tests.

I can force the test framework to pause/hold for X amount of seconds, but the time required is a bit arbitrary and I think for optimization/performance reasons it's better to just ask the test framework to work with the code above.


Other things that might help tests:

  1. id tag on the command input bar and all other interact-able components (buttons, etc).
  2. REPL results should also have the value attribute on those input elements; for example execute any kubectl command and inspect that text in the REPL; there's no attribute on that corresponding input element that says what the command was.
  3. Similar to #2, it would be nice if the container divs for REPL results also had some data attribute that indicates what the command executed was. The divs just have this information: <div class="repl-block valid-response" data-base-class="repl-block" data-input-count="0">.

Native KUI:

Screen Shot 2020-01-16 at 11 04 54 AM

With our hijack:

Screen Shot 2020-01-16 at 10 50 13 AM
fejta-bot commented 3 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale

fejta-bot commented 3 years ago

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community. /lifecycle rotten

fejta-bot commented 3 years ago

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-contributor-experience at kubernetes/community. /close

k8s-ci-robot commented 3 years ago

@fejta-bot: Closing this issue.

In response to [this](https://github.com/kubernetes-sigs/kui/issues/3484#issuecomment-846519654): >Rotten issues close after 30d of inactivity. >Reopen the issue with `/reopen`. >Mark the issue as fresh with `/remove-lifecycle rotten`. > >Send feedback to sig-contributor-experience at [kubernetes/community](https://github.com/kubernetes/community). >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.