-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
💣 453 adding integration tests for the trace view (#457)
- Loading branch information
Showing
19 changed files
with
235 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 1 addition & 21 deletions
22
web/cypress/integration/TestDetails/ShowTestDetails.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import {createTest, deleteTest, testId} from '../utils/common'; | ||
|
||
describe('Create Assertion', () => { | ||
before(() => { | ||
createTest(); | ||
}); | ||
|
||
after(() => { | ||
deleteTest(); | ||
}); | ||
|
||
it('should create a basic assertion', () => { | ||
cy.get(`[data-cy=test-url-${testId}]`).first().click(); | ||
cy.location('href').should('match', /\/test\/.*/i); | ||
|
||
cy.get(`[data-cy^=test-run-result-]`).first().click(); | ||
cy.location('href').should('match', /resultId=.*/i); | ||
|
||
cy.get('[data-cy=add-assertion-button]').click(); | ||
cy.get('[data-cy=create-assertion-form]', {timeout: 10000}).should('be.visible'); | ||
|
||
cy.get('[data-cy=item-selector-tag] + [role=img]').first().click(); | ||
cy.get('[data-cy=affected-spans-count]') | ||
.invoke('text') | ||
.should('match', /Affects \d+ spans/); | ||
|
||
cy.get('[data-cy=assertion-check-key]').type('http'); | ||
cy.get('.ant-select-item-option-content').first().click(); | ||
cy.get('[data-cy=assertion-check-key]').should('have.text', 'http.status_code'); | ||
cy.get('[data-cy=assertion-check-value] input').should('have.attr', 'value', '200'); | ||
|
||
cy.get('[data-cy=assertion-check-operator]').click(); | ||
cy.get('.ant-select-item-option-content').last().click(); | ||
|
||
cy.get('[data-cy=assertion-check-operator] .ant-select-selection-item').should('have.text', 'contains'); | ||
cy.get('#add-assertion-modal-ok-button').click(); | ||
|
||
cy.get('[data-cy=assertion-table]').should('be.visible'); | ||
}); | ||
|
||
it('should create an assertion with multiple checks', () => { | ||
cy.get('[data-cy=add-assertion-button]').click(); | ||
cy.get('[data-cy=create-assertion-form]').should('be.visible'); | ||
|
||
cy.get('[data-cy=assertion-check-key]').first().type('http'); | ||
cy.get('.ant-select-item-option-content').first().click(); | ||
cy.get('[data-cy=assertion-check-key]').first().should('have.text', 'http.status_code'); | ||
cy.get('[data-cy=assertion-check-value] input').first().should('have.attr', 'value', '200'); | ||
cy.get('[data-cy=assertion-check-operator]').first().click(); | ||
cy.get('.ant-select-item-option-content').last().click(); | ||
cy.get('[data-cy=assertion-check-operator] .ant-select-selection-item').first().should('have.text', 'contains'); | ||
|
||
cy.get('[data-cy=add-assertion-form-add-check]').click(); | ||
|
||
cy.get('[data-cy=assertion-check-key]').last().type('service'); | ||
cy.get('.ant-select-item-option-content').last().click(); | ||
cy.get('[data-cy=assertion-check-key]').last().should('have.text', 'service.name'); | ||
cy.get('[data-cy=assertion-check-value] input').last().should('have.attr', 'value', 'pokeshop'); | ||
|
||
cy.get('[data-cy=assertion-check-operator] .ant-select-selection-item').last().should('have.text', 'eq'); | ||
cy.get('#add-assertion-modal-ok-button').click(); | ||
|
||
cy.get('[data-cy=assertion-table]').should('have.lengthOf', 2); | ||
cy.get('[data-cy=assertion-check-property]').should('have.lengthOf', 3); | ||
}); | ||
|
||
it('should update an assertion', () => { | ||
cy.get('[data-cy=edit-assertion-button]').last().click(); | ||
cy.get('[data-cy=create-assertion-form]').should('be.visible'); | ||
|
||
cy.get('[data-cy=assertion-check-operator]').first().click(); | ||
cy.get('.ant-select-item-option-content').first().click(); | ||
cy.get('[data-cy=assertion-check-operator] .ant-select-selection-item').first().should('have.text', 'eq'); | ||
|
||
cy.get('[data-cy=add-assertion-form-add-check]').click(); | ||
|
||
cy.get('[data-cy=assertion-check-key]').last().type('service'); | ||
cy.get('.ant-select-item-option-content').last().click(); | ||
cy.get('[data-cy=assertion-check-key]').last().should('have.text', 'service.name'); | ||
cy.get('[data-cy=assertion-check-value] input').last().should('have.attr', 'value', 'pokeshop'); | ||
|
||
cy.get('[data-cy=assertion-check-operator] .ant-select-selection-item').last().should('have.text', 'eq'); | ||
cy.get('#add-assertion-modal-ok-button').click(); | ||
|
||
cy.get('[data-cy=assertion-table]').should('have.lengthOf', 2); | ||
cy.get('[data-cy=assertion-check-property]').should('have.lengthOf', 4); | ||
|
||
cy.get('#rc-tabs-1-tab-test-results').click(); | ||
cy.get('[data-cy=test-results-assertion-table]').should('have.lengthOf', 2); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import {createTest, deleteTest, testId} from '../utils/common'; | ||
|
||
describe('Show Trace', () => { | ||
beforeEach(() => { | ||
createTest(); | ||
}); | ||
|
||
afterEach(() => { | ||
deleteTest(); | ||
}); | ||
|
||
it('should show the trace components', () => { | ||
cy.get(`[data-cy=test-url-${testId}]`).first().click(); | ||
cy.location('href').should('match', /\/test\/.*/i); | ||
|
||
cy.get(`[data-cy^=test-run-result-]`).first().click(); | ||
cy.location('href').should('match', /resultId=.*/i); | ||
|
||
cy.get('[data-cy=diagram-dag]', {timeout: 6000}).should('be.visible'); | ||
cy.get('[data-cy^=trace-node-]', {timeout: 6000}).should('be.visible'); | ||
cy.get('[data-cy=span-details-attributes]').should('be.visible'); | ||
cy.get('[data-cy=empty-assertion-table]').should('be.visible'); | ||
|
||
cy.get('#rc-tabs-1-tab-test-results').click(); | ||
cy.get('[data-cy=test-results]').should('be.visible'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import {camelCase} from 'lodash'; | ||
import {DemoTestExampleList} from '../../../src/constants/Test.constants'; | ||
|
||
Cypress.on('uncaught:exception', err => !err.message.includes('ResizeObserver loop limit exceeded')); | ||
|
||
export const [, {name, description}] = DemoTestExampleList; | ||
|
||
// eslint-disable-next-line import/no-mutable-exports | ||
export let testId = ''; | ||
|
||
export const createTest = () => { | ||
cy.visit('http://localhost:3000/'); | ||
const $form = openCreateTestModal(); | ||
|
||
$form.get('[data-cy=example-button]').click(); | ||
$form.get(`[data-cy=demo-example-${camelCase(name)}]`).click(); | ||
$form.get('[data-cy=create-test-submit]').click(); | ||
|
||
cy.location('pathname').should('match', /\/test\/.*/i); | ||
cy.location().then(({pathname}) => { | ||
testId = pathname.split('/').pop(); | ||
}); | ||
cy.visit('http://localhost:3000/'); | ||
}; | ||
|
||
export const openCreateTestModal = () => { | ||
cy.get('[data-cy=create-test-button]').click(); | ||
|
||
const $form = cy.get('[data-cy=create-test-modal] form'); | ||
$form.should('be.visible'); | ||
|
||
return $form; | ||
}; | ||
|
||
export const deleteTest = () => { | ||
cy.location().then(({pathname}) => { | ||
const testId = pathname.split('/').pop(); | ||
cy.visit('http://localhost:3000/'); | ||
|
||
cy.get(`[data-cy=test-actions-button-${testId}]`).click(); | ||
cy.get('[data-cy=test-delete-button]').click(); | ||
|
||
cy.get(`[data-cy=test-actions-button-${testId}]`).should('not.exist'); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ import styled from 'styled-components'; | |
|
||
export const Container = styled.div` | ||
position: relative; | ||
height: 100%; | ||
`; |
Oops, something went wrong.