Skip to content

Commit

Permalink
fix: use aria to test for expand button state
Browse files Browse the repository at this point in the history
  • Loading branch information
diegopamio committed Oct 29, 2020
1 parent a7414d6 commit 8c3bcbd
Showing 1 changed file with 12 additions and 17 deletions.
29 changes: 12 additions & 17 deletions cypress/integration/log-analysis-panel.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const comparisonAnalysisText = ' Analysis';
let panel;
let analysisTree;

describe('The comparison analysis panel', () => {
beforeEach(() => {
Expand Down Expand Up @@ -37,8 +36,8 @@ describe('The comparison analysis panel', () => {
});
it('should be facing down', () => {
// assert
cy.contains('.MuiCardHeader-root', comparisonAnalysisText).find('button')
.should('have.css', 'transform', 'matrix(1, 0, 0, 1, 0, 0)');
cy.contains('.MuiCardHeader-root', comparisonAnalysisText)
.find('button[aria-expanded=false]').should('exist');
});
describe('when clicked', () => {
let panelHeader;
Expand All @@ -48,34 +47,30 @@ describe('The comparison analysis panel', () => {
});
it('should be facing up', () => {
// assert
panelHeader.find('button')
.should('have.css', 'transform', 'matrix(-1, 1.22465e-16, -1.22465e-16, -1, 0, 0)');
panelHeader.get('button[aria-expanded=true]').should('exist');
});
it('should make the analysis log panel visible', () => {
// assert
cy.contains('PARTIALLY EQUAL').should('be.visible');
});
describe('the analysis tree', () => {
beforeEach(() => {
analysisTree = panel.find(/^\/$/);
});
it('should be visible', () => {
analysisTree.should('be.visible');
cy.contains('is PARTIALLY EQUAL (5 / 14)').should('be.visible');
});
});
});
});
describe('the root element', () => {
beforeEach(() => {
analysisTree = panel.find(/^\/$/);
});
describe('when clicked', () => {
beforeEach(() => {
analysisTree.click();
});
it('should show its child nodes', async () => {
it('should show its child nodes', () => {
// arrange
cy.contains('.MuiCardHeader-root', comparisonAnalysisText).find('button').click();

// act
cy.contains('is PARTIALLY EQUAL (5 / 14)').click();

// assert
analysisTree.contains('breweries');
cy.contains('breweries');
});
});
});
Expand Down

1 comment on commit 8c3bcbd

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit 8c3bcbd is built and deployed to Vercel.

Preview: https://json-similarity-score-rhngdybcz.vercel.app

This commit has been automatically deployed with vercel-deployment

Please sign in to comment.