-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[RAC] create functional tests for add to case #114075
[RAC] create functional tests for add to case #114075
Conversation
8b78bda
to
5b1d489
Compare
Pinging @elastic/logs-metrics-ui (Team:logs-metrics-ui) |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cases changes LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good 👍 I left only a few minor questions below.
const CREATE_CASE_FLYOUT = 'create-case-flyout'; | ||
const SELECT_CASE_MODAL = 'all-cases-modal'; | ||
|
||
export function ObservabilityAlertsAddToCaseProvider({ getService }: FtrProviderContext) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want to access functions from common
in here you could just inject them as an additional parameter. As you discovered, getService('observability')
doesn't work here because this code is executed in order to construct that exact service.
|
||
it('opens a flyout when Add to new case is clicked', async () => { | ||
await retry.try(async () => { | ||
await observability.alerts.common.openActionsMenuForRow(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the menu already open from the previous step?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Actually removing this line of code also fixed the issue you mentioned below (click being part of the retry). Now I moved click outside of the retry and everything works like a charm!
it('opens a flyout when Add to new case is clicked', async () => { | ||
await retry.try(async () => { | ||
await observability.alerts.common.openActionsMenuForRow(0); | ||
await observability.alerts.addToCase.addToNewCaseButtonClick(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this click be part of the retry? Do we want to try clicking repeatedly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the beginning I didn't have it as part of the retry and the test was failing. By moving it inside the retry, test stopped failing, but what I noticed in the browser is a long delay between clicking on the menu item and opening the flyout. I will try one more time to move it outside of the retry and see what happens
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested again and if click is in not part of the retry test fails. I get debg finding element 'By(css selector, [data-test-subj="add-new-case-item"])' again, 2 attempts left │ debg --- retry.try error: no such element: Unable to locate element: {"method":"css selector","selector":"[data-test-subj="add-new-case-item"]"}
, because the overflow closes immediately and it can not find the element. I will leave it here for now and I could investigate again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: I moved it out of the retry. See my comment above
x-pack/test/observability_functional/apps/observability/alerts/add_to_case.ts
Outdated
Show resolved
Hide resolved
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: cc @mgiota |
* [RAC] create functional tests for add to case * use observability test helpers for user creation * basic tests for add to case options * add two more cases * test case for clicking on add to new case button * remove unused expect statement * clicking on add to existing case should open a modal * move add to case functionality in a separate file * address comments in the PR review Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
💚 Backport successful
This backport PR will be merged automatically after passing CI. |
* [RAC] create functional tests for add to case * use observability test helpers for user creation * basic tests for add to case options * add two more cases * test case for clicking on add to new case button * remove unused expect statement * clicking on add to existing case should open a modal * move add to case functionality in a separate file * address comments in the PR review Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: mgiota <giota85@gmail.com>
## Summary Fixes flake cypress test Fixes #115245 See also: #114075, #115245 ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
## Summary Fixes flake cypress test Fixes elastic#115245 See also: elastic#114075, elastic#115245 ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
## Summary Fixes flake cypress test Fixes #115245 See also: #114075, #115245 ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios Co-authored-by: Frank Hassanabad <frank.hassanabad@elastic.co>
Fixes #110642
Notes for the reviewer
This PR doesn't include tests for checking that rules behave the same when created from either within the solution or from the central rule management screen. I had a few ideas/questions there, we could further discuss if we want to include this in this PR cc @weltenwort
This is not part of this PR, but if time allows I would like a comment regarding an issue I faced and how we could fix this in the future. I was trying to refactor observability service and move workflowStatus related stuff to another file. Apparently what I tried to do is not possible, because I ended up getting a Circular reference to Service(observability). Example code and the error I got can be found here mgiota@d8405f9#r57919232