Skip to content

Commit c9bfa10

Browse files
authored
e2e: unskip & fix pinning with sorted data test (#9651)
### Summary Re-enabling the e2e test for verifying behavior of copy/paste on sorted data. ### QA Notes @:data-explorer @:web
1 parent 15a82da commit c9bfa10

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

test/e2e/pages/dataExplorer.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export class Filters {
210210
export class DataGrid {
211211
grid: Locator;
212212
private statusBar: Locator;
213-
private rowHeaders = this.code.driver.page.locator('.data-grid-row-headers');
213+
private rowHeader = this.code.driver.page.locator('.data-grid-row-header');
214214
private columnHeaders = this.code.driver.page.locator(HEADER_TITLES);
215215
private rows = this.code.driver.page.locator(`${DATA_GRID_ROWS} ${DATA_GRID_ROW}`);
216216
private cellByPosition = (rowIndex: number, columnIndex: number) => this.code.driver.page.locator(
@@ -326,10 +326,7 @@ export class DataGrid {
326326
*/
327327
async pinRow(rowPosition: number) {
328328
await test.step(`Pin row at 0-based position: ${rowPosition}`, async () => {
329-
await this.code.driver.page
330-
// rowPosition is 0-based, nth-child is 1-based
331-
.locator(`.data-grid-row-headers > div:nth-child(${rowPosition + 1})`)
332-
.click({ button: 'right' });
329+
await this.rowHeader.nth(rowPosition).click({ button: 'right' });
333330
await this.code.driver.page.getByRole('button', { name: 'Pin Row' }).click();
334331
});
335332
}
@@ -371,12 +368,12 @@ export class DataGrid {
371368
}
372369

373370
/**
374-
* Click a row header by its visual position
371+
* Click a row header by its position
375372
* Index is 1-based to match UI
376373
**/
377374
async clickRowHeader(rowIndex: number) {
378375
await test.step(`Click row header: ${rowIndex}`, async () => {
379-
await this.rowHeaders.getByText(rowIndex.toString(), { exact: true }).click();
376+
await this.rowHeader.nth(rowIndex).click();
380377
});
381378
}
382379

test/e2e/tests/data-explorer/data-explorer-clipboard.test.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ test.use({
3737
for (const { env, data, rowIndexOffset: indexOffset, tags: testTags = [] } of testCases) {
3838
test.describe('Data Explorer: Copy/Paste', { tag: [tags.WEB, tags.DATA_EXPLORER, ...testTags] }, () => {
3939

40-
4140
test.beforeEach(async function ({ app, openDataFile, hotKeys }) {
4241
const { dataExplorer, console, sessions, variables } = app.workbench;
4342

@@ -68,7 +67,7 @@ for (const { env, data, rowIndexOffset: indexOffset, tags: testTags = [] } of te
6867
await clipboard.expectClipboardTextToBe(expectedData['col3'], '\n');
6968

7069
// verify copy and paste on rows
71-
await dataExplorer.grid.clickRowHeader(9 + indexOffset);
70+
await dataExplorer.grid.clickRowHeader(9);
7271
await clipboard.copy();
7372
await clipboard.expectClipboardTextToBe(expectedData['row9'], '\n');
7473

@@ -83,21 +82,19 @@ for (const { env, data, rowIndexOffset: indexOffset, tags: testTags = [] } of te
8382
await clipboard.expectClipboardTextToBe(expectedData['col0_col1'], '\n');
8483
});
8584

86-
test.skip(`${env} - Copy and paste works on cells, rows, columns, and ranges of sorted data`, {
87-
annotation: [{ type: 'issue', description: 'https://github.com/posit-dev/positron/issues/9344' }]
88-
}, async function ({ app }) {
85+
test(`${env} - Copy and paste works on cells, rows, columns, and ranges of sorted data`, async function ({ app }) {
8986
const { dataExplorer, clipboard } = app.workbench;
9087

9188
// verify copy and paste on columns
9289
await dataExplorer.grid.selectColumnAction(4, 'Sort Descending');
9390
await dataExplorer.grid.clickColumnHeader('column3');
9491
await clipboard.copy();
95-
await clipboard.expectClipboardTextToBe(expectedData['col3']);
92+
await clipboard.expectClipboardTextToBe(expectedData['col3_sorted_desc'], '\n');
9693

97-
// verify copy and paste on rows - issue 9344
98-
await dataExplorer.grid.clickRowHeader(4 + indexOffset);
94+
// verify copy and paste on rows
95+
await dataExplorer.grid.clickRowHeader(4);
9996
await clipboard.copy();
100-
await clipboard.expectClipboardTextToBe(expectedData['row4']);
97+
await clipboard.expectClipboardTextToBe(expectedData['row4'], '\n');
10198

10299
// verify copy and paste on cell
103100
await dataExplorer.grid.clickCell(6, 4);
@@ -107,7 +104,7 @@ for (const { env, data, rowIndexOffset: indexOffset, tags: testTags = [] } of te
107104
// verify copy and paste on range
108105
await dataExplorer.grid.selectRange({ start: { row: 0, col: 2 }, end: { row: 1, col: 3 } });
109106
await clipboard.copy();
110-
await clipboard.expectClipboardTextToBe('column2\tcolumn3\n47\t99\n8\t89');
107+
await clipboard.expectClipboardTextToBe('column2\tcolumn3\n47\t99\n8\t89', '\n');
111108
});
112109

113110
test(`${env} - Copy and paste of ranges works with pinned data`, async function ({ app }) {

0 commit comments

Comments
 (0)