Skip to content

Commit

Permalink
Update/fix cell popover Cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Nov 15, 2023
1 parent b0f2396 commit 93fdea7
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions src/components/datagrid/body/data_grid_cell_popover.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('EuiDataGridCellPopover', () => {
'[data-gridcell-row-index="0"][data-gridcell-column-index="0"]'
).realClick();

cy.get('[data-test-subj="euiDataGridCellExpandButton"]').realClick();
cy.get('[data-test-subj="euiDataGridCellExpandButton"]').click();
cy.focused().should(
'have.attr',
'data-test-subj',
Expand All @@ -73,7 +73,7 @@ describe('EuiDataGridCellPopover', () => {
'[data-gridcell-row-index="1"][data-gridcell-column-index="1"]'
).realClick();

cy.get('[data-test-subj="euiDataGridCellExpandButton"]').realClick();
cy.get('[data-test-subj="euiDataGridCellExpandButton"]').click();
cy.focused().should(
'have.attr',
'data-test-subj',
Expand All @@ -93,12 +93,12 @@ describe('EuiDataGridCellPopover', () => {
'[data-gridcell-row-index="0"][data-gridcell-column-index="0"]'
).realClick();

cy.get('[data-test-subj="euiDataGridCellExpandButton"]').realClick();
cy.get('[data-test-subj="euiDataGridCellExpandButton"]').click();
cy.get('[data-test-subj="euiDataGridExpansionPopover"]').should('exist');

cy.get(
'[data-gridcell-row-index="0"][data-gridcell-column-index="0"]'
).realClick();
).realClick({ position: 'right' });
cy.get('[data-test-subj="euiDataGridExpansionPopover"]').should(
'not.exist'
);
Expand Down Expand Up @@ -126,7 +126,7 @@ describe('EuiDataGridCellPopover', () => {
cy.get(
'[data-gridcell-row-index="0"][data-gridcell-column-index="0"]'
).realClick();
cy.get('[data-test-subj="euiDataGridCellExpandButton"]').realClick();
cy.get('[data-test-subj="euiDataGridCellExpandButton"]').click();

cy.get('.euiDataGridRowCell__popover.hello.world').should('exist');
});
Expand All @@ -147,7 +147,7 @@ describe('EuiDataGridCellPopover', () => {
const openCellPopover = (id: string) => {
cy.get(
`[data-gridcell-row-index="0"][data-gridcell-column-id="${id}"]`
).realClick();
).click();
cy.realPress('Enter');
};

Expand All @@ -156,9 +156,8 @@ describe('EuiDataGridCellPopover', () => {

openCellPopover('B');
cy.get('[data-test-subj="euiDataGridExpansionPopover"]')
.should('have.css', 'left', '24.5px')
.should('have.css', 'top')
.and('match', /^(104|103)px/); // CI is off by 1 px
.should('have.css', 'left', '109px')
.should('have.css', 'top', '73px');
});

it('lineCount row height', () => {
Expand All @@ -171,9 +170,8 @@ describe('EuiDataGridCellPopover', () => {
openCellPopover('B');

cy.get('[data-test-subj="euiDataGridExpansionPopover"]')
.should('have.css', 'left', '24.5px')
.should('have.css', 'top')
.and('match', /^(127|126)px/); // CI is off by 1 px
.should('have.css', 'left', '109px')
.should('have.css', 'top', '73px');
});

it('numerical row height', () => {
Expand All @@ -184,9 +182,8 @@ describe('EuiDataGridCellPopover', () => {

// Should not be anchored to the bottom of the overflowing text
cy.get('[data-test-subj="euiDataGridExpansionPopover"]')
.should('have.css', 'left', '24.5px')
.should('have.css', 'top')
.and('match', /^(106|105)px/); // CI is off by 1 px
.should('have.css', 'left', '109px')
.should('have.css', 'top', '73px');
});

it('auto row height', () => {
Expand All @@ -196,16 +193,14 @@ describe('EuiDataGridCellPopover', () => {

openCellPopover('B');
cy.get('[data-test-subj="euiDataGridExpansionPopover"]')
.should('have.css', 'left', '24.5px')
.should('have.css', 'top')
.and('match', /^(151|150)px/); // CI is off by 1 px
.should('have.css', 'left', '109px')
.should('have.css', 'top', '73px');

// The shorter cell content should not have the same top position
openCellPopover('A');
cy.get('[data-test-subj="euiDataGridExpansionPopover"]')
.should('have.css', 'left', '19px')
.should('have.css', 'top')
.and('match', /^(103|102)px/); // CI is off by 1 px
.should('have.css', 'left', '109px')
.should('have.css', 'top', '73px');
});
});
});

0 comments on commit 93fdea7

Please sign in to comment.