Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add e2e test for custom columns #1349

Merged
merged 32 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
12eafd5
test: add e2e test for select distinct values
ethanalvizo May 18, 2023
ddd5ed4
add missing Linux snapshots
ethanalvizo May 18, 2023
3e7a6d8
delete firefox tests
ethanalvizo May 18, 2023
3ed9396
regenerate firefox snapshots
ethanalvizo May 18, 2023
fb8443c
Merge branch 'main' into 1305-select-distinct-e2e
ethanalvizo May 19, 2023
c447ced
test: add e2e test for search bar
ethanalvizo May 23, 2023
b056e6b
test: add e2e test for organize columns
ethanalvizo May 24, 2023
e4baa90
Merge branch 'main' into 1315-organize-columns-e2e
ethanalvizo May 25, 2023
c76bc7f
Merge branch 'main' into 1315-organize-columns-e2e
ethanalvizo May 25, 2023
5706146
test: add e2e test for organize columns
ethanalvizo May 25, 2023
c7c5edc
Merge branch 'main' into 1313-search-bar-e2e
ethanalvizo May 25, 2023
1fc7232
Fix/add missing snapshots
ethanalvizo May 25, 2023
99106d1
Fix/add missing snapshots
ethanalvizo May 25, 2023
61aa13d
Another snapshot fix
ethanalvizo May 25, 2023
f029445
Merge branch 'main' into 1315-organize-columns-e2e
ethanalvizo May 30, 2023
3964bce
wip PR feedback
ethanalvizo May 30, 2023
70db50c
test: refactor and adjust search bar test
ethanalvizo May 31, 2023
494f743
Merge branch 'main' into 1313-search-bar-e2e
ethanalvizo May 31, 2023
984f9c1
updated linux snapshots
ethanalvizo May 31, 2023
b900a50
Revert "updated linux snapshots"
ethanalvizo May 31, 2023
4e326ec
wip - missing firefox snapshots
ethanalvizo Jun 1, 2023
d66deb6
Merge branch 'main' into 1332-custom-columns-e2e
ethanalvizo Jun 1, 2023
f627aac
Merge branch 'main' into 1315-organize-columns-e2e
ethanalvizo Jun 1, 2023
24a14ca
Switched to table with more columns
ethanalvizo Jun 1, 2023
a98e605
Merge branch 'main' into 1315-organize-columns-e2e
ethanalvizo Jun 1, 2023
2eaf6bc
Merge branch 'main' into 1315-organize-columns-e2e
ethanalvizo Jun 1, 2023
9f921b4
resolved firefox locator issue
ethanalvizo Jun 1, 2023
15235c0
Bring changes from organize columns
ethanalvizo Jun 1, 2023
9cc9c12
regenerated linux and firefox snapshots
ethanalvizo Jun 1, 2023
0474437
Merge branch 'main' into 1332-custom-columns-e2e
ethanalvizo Jun 5, 2023
9ab2f25
PR feedback
ethanalvizo Jun 5, 2023
be4fd07
split test into steps
ethanalvizo Jun 5, 2023
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
1 change: 1 addition & 0 deletions packages/iris-grid/src/sidebar/InputEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export default class InputEditor extends Component<
ref={editorContainer => {
this.editorContainer = editorContainer;
}}
data-testid="custom-column-formula"
/>
{isEditorEmpty && !value && (
<div className="editor-placeholder text-muted">Column Formula</div>
Expand Down
78 changes: 78 additions & 0 deletions tests/table.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,84 @@ test.describe('tests complex table operations', () => {
await expect(page.locator('.iris-grid-column')).toHaveScreenshot();
});
});

test('can custom column', async () => {
// open Custom Columns panel
await page.locator('data-testid=menu-item-Custom Columns').click();

await test.step('Create custom column', async () => {
const columnName = page.getByPlaceholder('Column Name');
await expect(columnName).toHaveCount(1);
await columnName.click();
await page.keyboard.type('Test');

const columnFormula = page.locator('.editor-container');
await expect(columnFormula).toHaveCount(1);
await columnFormula.click({ force: true });
await page.keyboard.type('Double * 2');
});

const addColumnButton = page.getByRole('button', {
name: 'Add Another Column',
});
const saveButton = page.getByRole('button', { name: 'Save Column' });

await test.step('Create 2nd custom columns from 1st', async () => {
await addColumnButton.click();

const newColumnName = page.getByPlaceholder('Column Name').nth(1);
await newColumnName.click();
await page.keyboard.type('Test2');

const newColumnFormula = page.locator('.editor-container').nth(1);
await newColumnFormula.click();
await page.keyboard.type('Test * 2');

await saveButton.click();

await waitForLoadingDone(page);
await expect(page.locator('.iris-grid-column')).toHaveScreenshot();
});

await test.step('Drag', async () => {
await addColumnButton.click();

const dragColumn = page.getByPlaceholder('Column Name').nth(2);
await dragColumn.click();
await page.keyboard.type('Drag');

const dragColumnFormula = page.locator('.editor-container').nth(2);
await dragColumnFormula.click();
await page.keyboard.type('String');

const reorderButton = page
.getByRole('button', { name: 'Drag column to re-order' })
.nth(2);
const [x, y] = await reorderButton
.boundingBox()
.then(pos => (pos && pos.x && pos.y ? [pos.x, pos.y - 100] : [0, 0]));
await reorderButton.hover();
await page.mouse.down();
await page.mouse.move(x, y, { steps: 500 });
await page.mouse.up();

await saveButton.click();

await waitForLoadingDone(page);
await expect(page.locator('.iris-grid-column')).toHaveScreenshot();
});

await test.step('Delete', async () => {
const deleteLastColumnButton = page
.getByRole('button', { name: 'Delete custom column' })
.nth(1);
await deleteLastColumnButton.click();
await saveButton.click();

await waitForLoadingDone(page);
await expect(page.locator('.iris-grid-column')).toHaveScreenshot();
});
});
});

test.describe('tests simple table operations', () => {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 8 additions & 4 deletions tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import shortid from 'shortid';
export enum TableTypes {
Number,
StringAndNumber,
AllTypes
AllTypes,
}

/**
Expand All @@ -30,13 +30,16 @@ export function makeTableCommand(
tableName = generateVarName('t'),
type = TableTypes.Number
): string {
switch (type) {
switch (type) {
case TableTypes.AllTypes:
return `from deephaven import empty_table, time_table
return (
`from deephaven import empty_table, time_table
size = 20
scale = 999
${tableName} = empty_table(size).update([
"String=(i%11==0? null : ` + '`a`' +`+(int)(scale*(i%2==0? i+1 : 1)))",
"String=(i%11==0? null : ` +
'`a`' +
`+(int)(scale*(i%2==0? i+1 : 1)))",
"Int=(i%12==0 ? null : (int)(scale*(i*2-1)))",
"Long=(i%13==0 ? null : (long)(scale*(i*2-1)))",
"Float=(float)(i%14==0 ? null : i%10==0 ? 1.0F/0.0F: i%5==0 ? -1.0F/0.0F : (float) scale*(i*2-1))",
Expand All @@ -48,6 +51,7 @@ ${tableName} = empty_table(size).update([
"BigInt=(i%22==0 ? null : new java.math.BigInteger(Integer.toString((int)(scale*(i*2-1)))))",
"Byte=(Byte)(i%19==0 ? null : new Byte( Integer.toString((int)(i))))",
])`
);
case TableTypes.StringAndNumber:
return `from deephaven import new_table
from deephaven.column import string_col, double_col
Expand Down