Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ test('Edge drop prevents further handling of event', async ({ page }) => {
)
await page.mouse.click(outputPort.x, outputPort.y - 25)
await expect(page.getByTestId('mouse-edited-edge')).toExist()
await page.waitForTimeout(300) // Avoid double clicks
await page.mouse.click(outputPort.x, outputPort.y - 25)
await expect(page.getByTestId('mouse-edited-edge')).not.toExist()
await expect(locate.componentBrowser(page)).toExist()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ test('Selecting nodes by click', async ({ page }) => {
await expect(node2).toBeSelected()
await expect(selectionMenu).toBeHidden()

await page.waitForTimeout(300) // Avoid double clicks
await locate.graphNodeIcon(node1).click({ modifiers: ['Shift'] })
await expect(node1).toBeSelected()
await expect(node2).toBeSelected()
Expand Down
73 changes: 36 additions & 37 deletions app/gui/integration-test/project-view/tableVisualisation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ test('Load Table Visualisation', async ({ page }) => {
const aggregatedNode = graphNodeByBinding(page, 'aggregated')
await aggregatedNode.click()
await page.keyboard.press('Space')
await page.waitForTimeout(1000)
const tableVisualization = locate.tableVisualization(page)
await expect(tableVisualization).toExist()
await expect(tableVisualization).toContainText('10 rows.')
Expand All @@ -44,7 +43,6 @@ test('Column size can be set and is retained', async ({ page }) => {
const aggregatedNode = graphNodeByBinding(page, 'aggregated')
await aggregatedNode.click()
await page.keyboard.press('Space')
await page.waitForTimeout(1000)
const tableVisualization = locate.tableVisualization(page)
await expect(tableVisualization).toExist()
await expect(tableVisualization).toContainText('10 rows.')
Expand Down Expand Up @@ -177,7 +175,6 @@ test('Single Column Of Actions Table Visualisation Test', async ({ page }) => {
const aggregatedNode = graphNodeByBinding(page, 'aggregated')
await aggregatedNode.click()
await page.keyboard.press('Space')
await page.waitForTimeout(1000)
const tableVisualization = locate.tableVisualization(page)
await expect(tableVisualization).toExist()

Expand Down Expand Up @@ -211,7 +208,6 @@ test('Error Visualisation Test', async ({ page }) => {
const aggregatedNode = graphNodeByBinding(page, 'aggregated')
await aggregatedNode.click()
await page.keyboard.press('Space')
await page.waitForTimeout(1000)
const tableVisualization = locate.tableVisualization(page)
await expect(tableVisualization).toExist()

Expand All @@ -232,7 +228,6 @@ test('get_child_node_action temmplate Test as number', async ({ page }) => {
const aggregatedNode = graphNodeByBinding(page, 'aggregated')
await aggregatedNode.click()
await page.keyboard.press('Space')
await page.waitForTimeout(1000)
const tableVisualization = locate.tableVisualization(page)
await expect(tableVisualization).toExist()

Expand Down Expand Up @@ -272,7 +267,6 @@ test('get_child_node_action temmplate Test as text', async ({ page }) => {
const aggregatedNode = graphNodeByBinding(page, 'aggregated')
await aggregatedNode.click()
await page.keyboard.press('Space')
await page.waitForTimeout(1000)
const tableVisualization = locate.tableVisualization(page)
await expect(tableVisualization).toExist()

Expand Down Expand Up @@ -311,7 +305,6 @@ test('GenericGrid Table Visualisation Test - single column - no links', async ({
const aggregatedNode = graphNodeByBinding(page, 'aggregated')
await aggregatedNode.click()
await page.keyboard.press('Space')
await page.waitForTimeout(1000)
const tableVisualization = locate.tableVisualization(page)
await expect(tableVisualization).toExist()

Expand All @@ -338,7 +331,6 @@ test('GenericGrid Table Visualisation Test - two column - link on second', async
const aggregatedNode = graphNodeByBinding(page, 'aggregated')
await aggregatedNode.click()
await page.keyboard.press('Space')
await page.waitForTimeout(1000)
const tableVisualization = locate.tableVisualization(page)
await expect(tableVisualization).toExist()

Expand Down Expand Up @@ -391,43 +383,34 @@ test('GenericGrid Table Visualisation Test - two column - link on second', async
Then run the js prettier
Remember to comment the write back out
*/

test.describe('Table_Visualisation_Integration_Spec and clipboard', () => {
test('Datetime test - sorting and copying', async ({ page, context }) => {
await addMockClipboardInitScript(page)
await loadData(page, singleColumnDatetimes)
await expectCellDataToBe(
page,
'Value',
await expectCellDataToBe(page, 'Value', [
'2025-01-02 12:13:14.123[MET]',
'2025-01-01 12:13:14.123[MET]',
'2025-01-03 12:13:14.123[MET]',
)
])
const value = getHeaderLocator(page, { colHeaderName: 'Value' })
await value.click() // Sort ascending
await expectCellDataToBe(
page,
'Value',
await expectCellDataToBe(page, 'Value', [
'2025-01-01 12:13:14.123[MET]',
'2025-01-02 12:13:14.123[MET]',
'2025-01-03 12:13:14.123[MET]',
)
])
await value.click() // Sort descending
await expectCellDataToBe(
page,
'Value',
await expectCellDataToBe(page, 'Value', [
'2025-01-03 12:13:14.123[MET]',
'2025-01-02 12:13:14.123[MET]',
'2025-01-01 12:13:14.123[MET]',
)
])
await value.click() // remove sort
await expectCellDataToBe(
page,
'Value',
await expectCellDataToBe(page, 'Value', [
'2025-01-02 12:13:14.123[MET]',
'2025-01-01 12:13:14.123[MET]',
'2025-01-03 12:13:14.123[MET]',
)
])
await expectCopyingColumnClipboardToBe(
page,
context,
Expand All @@ -441,28 +424,44 @@ test.describe('Table_Visualisation_Integration_Spec and clipboard', () => {
test('Date test - sorting and copying', async ({ page, context }) => {
await addMockClipboardInitScript(page)
await loadData(page, singleColumnDates)
await expectCellDataToBe(page, 'Value', '2025-01-02', '2025-01-01', '2025-01-03')
await expectCellDataToBe(page, 'Value', ['2025-01-02', '2025-01-01', '2025-01-03'])
const value = getHeaderLocator(page, { colHeaderName: 'Value' })
await value.click({ position: { x: 10, y: 10 } }) // Sort ascending
await expectCellDataToBe(page, 'Value', '2025-01-01', '2025-01-02', '2025-01-03')
await expectCellDataToBe(page, 'Value', ['2025-01-01', '2025-01-02', '2025-01-03'])
await value.click({ position: { x: 10, y: 10 } }) // Sort descending
await expectCellDataToBe(page, 'Value', '2025-01-03', '2025-01-02', '2025-01-01')
await expectCellDataToBe(page, 'Value', ['2025-01-03', '2025-01-02', '2025-01-01'])
await value.click({ position: { x: 10, y: 10 } }) // remove sort
await expectCellDataToBe(page, 'Value', '2025-01-02', '2025-01-01', '2025-01-03')
await expectCellDataToBe(page, 'Value', ['2025-01-02', '2025-01-01', '2025-01-03'])
await expectCopyingColumnClipboardToBe(page, context, 'Value', 0, 1, '2025-01-02\r\n2025-01-01')
})

test('Time test - sorting and copying', async ({ page, context }) => {
await addMockClipboardInitScript(page)
await loadData(page, singleColumnTimes)
await expectCellDataToBe(page, 'Value', '12:14:14.123004', '12:13:14.123004', '12:15:14.123004')
await expectCellDataToBe(page, 'Value', [
'12:14:14.123004',
'12:13:14.123004',
'12:15:14.123004',
])
const value = getHeaderLocator(page, { colHeaderName: 'Value' })
await value.click({ position: { x: 10, y: 10 } }) // Sort ascending
await expectCellDataToBe(page, 'Value', '12:13:14.123004', '12:14:14.123004', '12:15:14.123004')
await expectCellDataToBe(page, 'Value', [
'12:13:14.123004',
'12:14:14.123004',
'12:15:14.123004',
])
await value.click({ position: { x: 10, y: 10 } }) // Sort descending
await expectCellDataToBe(page, 'Value', '12:15:14.123004', '12:14:14.123004', '12:13:14.123004')
await expectCellDataToBe(page, 'Value', [
'12:15:14.123004',
'12:14:14.123004',
'12:13:14.123004',
])
await value.click({ position: { x: 10, y: 10 } }) // remove sort
await expectCellDataToBe(page, 'Value', '12:14:14.123004', '12:13:14.123004', '12:15:14.123004')
await expectCellDataToBe(page, 'Value', [
'12:14:14.123004',
'12:13:14.123004',
'12:15:14.123004',
])
await expectCopyingColumnClipboardToBe(
page,
context,
Expand Down Expand Up @@ -509,15 +508,15 @@ async function loadData(page: Page, data: any) {
)
}

export type ColumnLocatorOptions = {
type ColumnLocatorOptions = {
colId?: string
colHeaderName?: string
}

/**
* Returns a locator for the header cell
*/
export function getHeaderLocator(page: Page, options: ColumnLocatorOptions) {
function getHeaderLocator(page: Page, options: ColumnLocatorOptions) {
if (options.colHeaderName) {
return page.getByRole('columnheader', { name: options.colHeaderName })
}
Expand All @@ -527,13 +526,13 @@ export function getHeaderLocator(page: Page, options: ColumnLocatorOptions) {
/**
* Returns a locator for the cell based off colId and rowIndex
*/
export function getCellLocator(page: Page, colId: string, rowIndex: number) {
function getCellLocator(page: Page, colId: string, rowIndex: number) {
const locatorString = `[row-index="${rowIndex}"] [col-id="${colId}"]`
return page.locator(locatorString)
}

// Helper function to check cell values in a column
async function expectCellDataToBe(page: Page, colId: string, ...expectedValues: string[]) {
async function expectCellDataToBe(page: Page, colId: string, expectedValues: string[]) {
for (let i = 0; i < expectedValues.length; i++) {
expect(await getCellLocator(page, colId, i).textContent()).toBe(expectedValues[i])
}
Expand Down
Loading