test: trace test is updated

This commit is contained in:
Palash gupta 2022-02-16 14:20:48 +05:30
parent a07b8999c0
commit 0514c5035e
No known key found for this signature in database
GPG Key ID: 8FD05AE6F9150AD6

View File

@ -30,97 +30,125 @@ describe('Trace', () => {
cy.visit(Cypress.env('baseUrl') + `${ROUTES.TRACE}`); cy.visit(Cypress.env('baseUrl') + `${ROUTES.TRACE}`);
}); });
// it('First Initial Load should go with 3 AJAX request', () => { it('First Initial Load should go with 3 AJAX request', () => {
// cy.wait(['@Filters', '@Graph', '@Table']).then((e) => { cy.wait(['@Filters', '@Graph', '@Table']).then((e) => {
// const [filter, graph, table] = e; const [filter, graph, table] = e;
// const { body: filterBody } = filter.request; const { body: filterBody } = filter.request;
// const { body: graphBody } = graph.request; const { body: graphBody } = graph.request;
// const { body: tableBody } = table.request; const { body: tableBody } = table.request;
// expect(filterBody.exclude.length).to.equal(0); expect(filterBody.exclude.length).to.equal(0);
// expect(filterBody.getFilters.length).to.equal(3); expect(filterBody.getFilters.length).to.equal(3);
// filterBody.getFilters.forEach((filter: TraceFilterEnum) => { filterBody.getFilters.forEach((filter: TraceFilterEnum) => {
// expect(filter).to.be.oneOf(['duration', 'status', 'serviceName']); expect(filter).to.be.oneOf(['duration', 'status', 'serviceName']);
// }); });
// expect(graphBody.function).to.be.equal('count'); expect(graphBody.function).to.be.equal('count');
// expect(graphBody.exclude.length).to.be.equal(0); expect(graphBody.exclude.length).to.be.equal(0);
// expect(typeof graphBody.exclude).to.be.equal('object'); expect(typeof graphBody.exclude).to.be.equal('object');
// expect(tableBody.tags.length).to.be.equal(0); expect(tableBody.tags.length).to.be.equal(0);
// expect(typeof tableBody.tags).equal('object'); expect(typeof tableBody.tags).equal('object');
// expect(tableBody.exclude.length).equals(0); expect(tableBody.exclude.length).equals(0);
// }); });
// }); });
// it('Render Time Request Response In All 3 Request', () => { it('Render Time Request Response In All 3 Request', () => {
// cy.wait(['@Filters', '@Graph', '@Table']).then((e) => { cy.wait(['@Filters', '@Graph', '@Table']).then((e) => {
// const [filter, graph, table] = e; const [filter, graph, table] = e;
// expect(filter.response?.body).to.be.not.undefined; expect(filter.response?.body).to.be.not.undefined;
// expect(filter.response?.body).to.be.not.NaN; expect(filter.response?.body).to.be.not.NaN;
// expect(JSON.stringify(filter.response?.body)).to.be.equals( expect(JSON.stringify(filter.response?.body)).to.be.equals(
// JSON.stringify(FilterInitialResponse), JSON.stringify(FilterInitialResponse),
// ); );
// expect(JSON.stringify(graph.response?.body)).to.be.equals( expect(JSON.stringify(graph.response?.body)).to.be.equals(
// JSON.stringify(GraphInitialResponse), JSON.stringify(GraphInitialResponse),
// ); );
// expect(JSON.stringify(table.response?.body)).to.be.equals( expect(JSON.stringify(table.response?.body)).to.be.equals(
// JSON.stringify(TableInitialResponse), JSON.stringify(TableInitialResponse),
// ); );
// }); });
// cy.get('@Filters.all').should('have.length', 1); cy.get('@Filters.all').should('have.length', 1);
// cy.get('@Graph.all').should('have.length', 1); cy.get('@Graph.all').should('have.length', 1);
// cy.get('@Table.all').should('have.length', 1); cy.get('@Table.all').should('have.length', 1);
// }); });
// it('Clear All', () => { it('Clear All', () => {
// cy.wait(['@Filters', '@Graph', '@Table']); cy.wait(['@Filters', '@Graph', '@Table']);
// expect(cy.findAllByText('Clear All')).not.to.be.undefined; expect(cy.findAllByText('Clear All')).not.to.be.undefined;
// cy cy
// .window() .window()
// .its('store') .its('store')
// .invoke('getState') .invoke('getState')
// .then((e: AppState) => { .then((e: AppState) => {
// const { traces } = e; const { traces } = e;
// expect(traces.isFilterExclude.get('status')).to.be.undefined; expect(traces.isFilterExclude.get('status')).to.be.undefined;
// expect(traces.selectedFilter.size).to.be.equals(0); expect(traces.selectedFilter.size).to.be.equals(0);
// }); });
// cy.findAllByText('Clear All').then((e) => { cy.findAllByText('Clear All').then((e) => {
// const [firstStatusClear] = e; const [firstStatusClear] = e;
// firstStatusClear.click(); firstStatusClear.click();
// cy.wait(['@Filters', '@Graph', '@Table']); cy.wait(['@Filters', '@Graph', '@Table']);
// // insuring the api get call // insuring the api get call
// cy.get('@Filters.all').should('have.length', 2); cy.get('@Filters.all').should('have.length', 2);
// cy.get('@Graph.all').should('have.length', 2); cy.get('@Graph.all').should('have.length', 2);
// cy.get('@Table.all').should('have.length', 2); cy.get('@Table.all').should('have.length', 2);
// cy cy
// .window() .window()
// .its('store') .its('store')
// .invoke('getState') .invoke('getState')
// .then((e: AppState) => { .then((e: AppState) => {
// const { traces } = e; const { traces } = e;
// expect(traces.isFilterExclude.get('status')).to.be.equals(false); expect(traces.isFilterExclude.get('status')).to.be.equals(false);
// expect(traces.userSelectedFilter.get('status')).to.be.undefined; expect(traces.userSelectedFilter.get('status')).to.be.undefined;
// expect(traces.selectedFilter.size).to.be.equals(0); expect(traces.selectedFilter.size).to.be.equals(0);
// }); });
// }); });
// }); });
it('Un Selecting one option from status', () => { it('Un Selecting one option from status', () => {
cy.wait(['@Filters', '@Graph', '@Table']); cy.wait(['@Filters', '@Graph', '@Table']);
cy.get('input[type="checkbox"]').then((e) => {
const [errorCheckbox] = e;
errorCheckbox.click();
cy.wait(['@Filters', '@Graph', '@Table']).then((e) => {
const [filter, graph, table] = e;
const filterBody = filter.request.body;
const graphBody = graph.request.body;
const tableBody = table.request.body;
expect(filterBody.exclude).not.to.be.undefined;
expect(filterBody.exclude.length).not.to.be.equal(0);
expect(filterBody.exclude[0] === 'status').to.be.true;
expect(graphBody.exclude).not.to.be.undefined;
expect(graphBody.exclude.length).not.to.be.equal(0);
expect(graphBody.exclude[0] === 'status').to.be.true;
expect(tableBody.exclude).not.to.be.undefined;
expect(tableBody.exclude.length).not.to.be.equal(0);
expect(tableBody.exclude[0] === 'status').to.be.true;
});
cy.get('@Filters.all').should('have.length', 2);
cy.get('@Graph.all').should('have.length', 2);
cy.get('@Table.all').should('have.length', 2);
});
}); });
}); });