Skip to content

Commit

Permalink
[OSD][Tests] add test subject to app title for app analytics (#686)
Browse files Browse the repository at this point in the history
* [OSD][Tests] add test subject to app title for app analytics

Using a test subject we can find the specific element instead
of trying to search the DOM for the class and hope the class
is the right class that contains the element we are looking for.

We can search the dom for this specific test subject and actually
make the test runner wait until this test subject exists before
executing the tests.

Issue related:
#679

Signed-off-by: Kawika Avilla <[email protected]>

* update one example for cypress tests

Signed-off-by: Kawika Avilla <[email protected]>
  • Loading branch information
kavilla authored Apr 28, 2022
1 parent 79613cd commit f3b6598
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ describe('Viewing application', () => {
it('Has working breadcrumbs', () => {
cy.get('.euiBreadcrumb').contains('Cypress').click();
cy.wait(delay);
cy.get('.euiTitle').contains(nameOne).should('exist');
cy.get('[data-test-subj="appAnalyticsAppName"]').contains(nameOne).should('exist');
cy.get('.euiBreadcrumb').contains('Application analytics').click();
cy.wait(delay);
cy.get('.euiTitle').contains('Applications').should('exist');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ export function Application(props: AppDetailProps) {
<EuiPageHeader>
<EuiPageHeaderSection>
<EuiTitle size="l">
<h1>{application.name}</h1>
<h1 data-test-subj={'appAnalyticsAppName'}>{application.name}</h1>
</EuiTitle>
<EuiText>
<p>{application.description}</p>
Expand Down

0 comments on commit f3b6598

Please sign in to comment.