[APM UI] Rephrase BDD steps for RUM scenarios#72492
[APM UI] Rephrase BDD steps for RUM scenarios#72492mdelapenya merged 6 commits intoelastic:masterfrom
Conversation
This will reduce the time it takes to execute the tests
I noticed that the method: Then(`should have correct client metrics`, () => {
const clientMetrics = '[data-cy=client-metrics] .euiStat__title';
// wait for all loading to finish
cy.get('kbnLoadingIndicator').should('not.be.visible');
cy.get('.euiStat__title', { timeout: DEFAULT_TIMEOUT }).should('be.visible');
cy.get('.euiSelect-isLoading').should('not.be.visible');
cy.get('.euiStat__title-isLoading').should('not.be.visible');
cy.get(clientMetrics).eq(2).should('have.text', '55 ');
cy.get(clientMetrics).eq(1).should('have.text', '0.08 sec');
cy.get(clientMetrics).eq(0).should('have.text', '0.01 sec');
});which relates to the BDD step: Then should have correct client metricsis almost the same as: Then(`it displays relevant client metrics`, () => {
const clientMetrics = '[data-cy=client-metrics] .euiStat__title';
// wait for all loading to finish
cy.get('kbnLoadingIndicator').should('not.be.visible');
cy.get('.euiStat__title-isLoading').should('not.be.visible');
cy.get(clientMetrics).eq(2).should('have.text', '7 ');
cy.get(clientMetrics).eq(1).should('have.text', '0.07 sec');
cy.get(clientMetrics).eq(0).should('have.text', '0.01 sec');
});which relates to the BDD step: Then it displays relevant client metricsI wonder if both methods and scenarios could be refactored into one, or in a helper method with parameters. |
|
Another question that I have: cy.get(clientMetrics).eq(2).should('have.text', '7 ');I noticed there is a whitespace after the value. Is this on purpose and needed? |
|
Hey @shahzad31, any feedback here? I'd like to make progress with these scenarios Thanks! |
i think space was part of text fetch from component, maybe we can avoid this by using trim string method. |
@mdelapenya i am fine with merging both of these methods. |
You mean at the plugin code? or in the tests? I'd prefer the 1st one |
|
Hey @shahzad31 I'd love a pair of 👀 reviewing the typescript code after refactor: I had to skip presubmit checks when creating the commit because not sure how to fix them. |
|
Pinging @elastic/uptime (Team:uptime) |
|
Pinging @elastic/apm-ui (Team:apm) |
smith
left a comment
There was a problem hiding this comment.
This looks fine to me as long as everything is still relevant and passing.
|
@elasticmachine merge upstream |
💚 Build SucceededBuild metricsdistributable file count
History
To update your PR or re-run it, just comment with: |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
* chore: group tests doing the same This will reduce the time it takes to execute the tests * chore: rephrase step * chore: extract common code to a function Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* chore: group tests doing the same This will reduce the time it takes to execute the tests * chore: rephrase step * chore: extract common code to a function Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
* chore: group tests doing the same This will reduce the time it takes to execute the tests * chore: rephrase step * chore: extract common code to a function Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
This PR simplifies three scenarios, merging them into just one, which will reduce the build time because we will be running just one scenario instead of three doing exactly the same: we will run the tests and check for the three components in different steps of the same scenario.
Besides that, we are rephrasing the existing scenarios, willing to open a discussion about refining them.