Skip to content

Commit

Permalink
chore: Fixes flakiness in resizable columns integ test (#2880)
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-kot authored Oct 16, 2024
1 parent 780d6b5 commit ce7dff3
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/table/__integ__/resizable-columns.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import { BasePageObject } from '@cloudscape-design/browser-test-tools/page-objects';
import useBrowser from '@cloudscape-design/browser-test-tools/use-browser';

Expand All @@ -19,7 +20,6 @@ const wrapper = createWrapper();
const tableWrapper = wrapper.findTable();
// All the columns fit in the viewport, which make it easier to test the columns' widths
const defaultScreen = { width: 1680, height: 800 };
const prepareCoordinate = (num: number) => Math.round(num);

class TablePage extends BasePageObject {
async resizeColumn(columnIndex: number, xOffset: number) {
Expand Down Expand Up @@ -99,18 +99,13 @@ class TablePage extends BasePageObject {
parameters: { pointerType: 'mouse' },
actions: [
// hover over resizer
{
type: 'pointerMove',
duration: 0,
x: prepareCoordinate(resizerBox.left),
y: prepareCoordinate(resizerBox.top),
},
{ type: 'pointerMove', x: Math.round(resizerBox.left), y: Math.round(resizerBox.top) },
{ type: 'pointerDown', button: 0 },
{ type: 'pause', duration: 30 },
{ type: 'pause', duration: 50 },
// move cursor to screen edge to activate auto-growing behavior
{ type: 'pointerMove', duration: 0, x: windowWidth, y: 0 },
{ type: 'pointerMove', duration: 10, x: windowWidth, y: Math.round(resizerBox.top) },
// pause to let resizing interval fire a few times
{ type: 'pause', duration: 500 },
{ type: 'pause', duration: 2000 },
{ type: 'pointerUp', button: 0 },
],
},
Expand Down

0 comments on commit ce7dff3

Please sign in to comment.