Skip to content

Commit b5bf43a

Browse files
authored
test: address ag-grid-storybook-e2 visual regressions (#516)
* test: address ag-grid-storybook-e2 visual regressions * Update ready logic * Update ready logic
1 parent ceda4b0 commit b5bf43a

File tree

4 files changed

+24
-10
lines changed

4 files changed

+24
-10
lines changed

apps/ag-grid-storybook-e2e/src/integration/ag-grid-stories.component.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ describe(`ag-grid-storybook`, () => {
1818
.should('exist')
1919
.should('be.visible')
2020
.screenshot(
21-
`aggridstoriescomponent-aggridstories--ag-grid-stories-${theme}`
21+
`aggridstoriescomponent-aggridstories--ag-grid-stories-${theme}`,
22+
{
23+
clip: { x: 0, y: 0, width: 1300, height: 600 },
24+
}
2225
)
2326
.percySnapshot(
2427
`aggridstoriescomponent-aggridstories--ag-grid-stories-${theme}`,
@@ -27,8 +30,8 @@ describe(`ag-grid-storybook`, () => {
2730
scope: '#root',
2831
percyCSS: `
2932
/* Avoid "virtual rows" in the screenshot. */
30-
:root {
31-
--viewport-height: 600px;
33+
#root {
34+
height: 600px;
3235
}
3336
`,
3437
}

apps/ag-grid-storybook-e2e/src/integration/data-manager.component.spec.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ describe(`ag-grid-storybook data manager`, () => {
2525
.should('exist')
2626
.should('be.visible')
2727
.screenshot(
28-
`datamanagercomponent-datamanager--data-manager-${domLayout}-${theme}`
28+
`datamanagercomponent-datamanager--data-manager-${domLayout}-${theme}`,
29+
{
30+
clip: { x: 0, y: 0, width: 1300, height: 600 },
31+
}
2932
)
3033
.percySnapshot(
3134
`datamanagercomponent-datamanager--data-manager-${domLayout}-${theme}`,
@@ -34,8 +37,8 @@ describe(`ag-grid-storybook data manager`, () => {
3437
scope: '#root',
3538
percyCSS: `
3639
/* Avoid "virtual rows" in the screenshot. */
37-
:root {
38-
--viewport-height: 600px;
40+
#root {
41+
height: 600px;
3942
}
4043
`,
4144
}

apps/ag-grid-storybook/src/app/ag-grid/ag-grid-stories.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import {
88
import { SkyAgGridService, SkyCellType } from '@skyux/ag-grid';
99

1010
import { GridOptions } from 'ag-grid-community';
11-
import { BehaviorSubject } from 'rxjs';
11+
import { BehaviorSubject, timer } from 'rxjs';
12+
import { first } from 'rxjs/operators';
1213

1314
import { columnDefinitions, data } from '../shared/baseball-players-data';
1415

@@ -67,7 +68,10 @@ export class AgGridStoriesComponent implements OnInit {
6768
},
6869
domLayout: this.domLayout,
6970
onGridReady: () => {
70-
this.ready.next(true);
71+
// Delay to allow the grid to render before capturing the screenshot.
72+
timer(800)
73+
.pipe(first())
74+
.subscribe(() => this.ready.next(true));
7175
},
7276
},
7377
});

apps/ag-grid-storybook/src/app/data-manager/data-manager.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import {
1414
} from '@skyux/data-manager';
1515

1616
import { GridOptions } from 'ag-grid-community';
17-
import { BehaviorSubject } from 'rxjs';
17+
import { BehaviorSubject, timer } from 'rxjs';
18+
import { first } from 'rxjs/operators';
1819

1920
import { columnDefinitions, data } from '../shared/baseball-players-data';
2021

@@ -152,7 +153,10 @@ export class DataManagerComponent implements OnInit {
152153
},
153154
domLayout: this.domLayout,
154155
onGridReady: () => {
155-
this.ready.next(true);
156+
// Delay to allow the grid to render before capturing the screenshot.
157+
timer(800)
158+
.pipe(first())
159+
.subscribe(() => this.ready.next(true));
156160
},
157161
},
158162
});

0 commit comments

Comments
 (0)