Skip to content

Commit

Permalink
test: Add render tests for dialog (deephaven#1031)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgodinez-dh authored Nov 22, 2024
1 parent cfd6410 commit 1d5eec9
Show file tree
Hide file tree
Showing 18 changed files with 110 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/app.d/tests.app
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ file_2=ui.py
file_3=ui_render_all.py
file_4=ui_flex.py
file_5=ui_table.py
file_6=ui_panel_loading.py
file_6=ui_panel_loading.py
file_7=ui_dialog.py
83 changes: 83 additions & 0 deletions tests/app.d/ui_dialog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
from deephaven import ui

my_modal = ui.panel(
ui.dialog_trigger(
ui.action_button(
"Trigger Modal",
),
ui.dialog(
ui.heading("Modal"),
ui.content("This is a modal."),
),
is_dismissable=True,
type="modal",
default_open=True,
)
)

my_popover = ui.panel(
ui.dialog_trigger(
ui.action_button(
"Trigger Popover",
),
ui.dialog(
ui.heading("Popover"),
ui.content("This is a popover."),
),
type="popover",
default_open=True,
)
)

my_tray = ui.panel(
ui.dialog_trigger(
ui.action_button(
"Trigger Tray",
),
ui.dialog(
ui.heading("Tray"),
ui.content("This is a tray."),
),
type="tray",
default_open=True,
)
)

my_fullscreen = ui.panel(
ui.dialog_trigger(
ui.action_button("Trigger Fullscreen"),
ui.dialog(
ui.heading("Fullscreen"),
ui.content(
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sit\
amet tristique risus. In sit amet suscipit lorem. Orci varius\
natoque penatibus et magnis dis parturient montes, nascetur\
ridiculus mus. In condimentum imperdiet metus non condimentum. Duis\
eu velit et quam accumsan tempus at id velit. Duis elementum\
elementum purus, id tempus mauris posuere a. Nunc vestibulum sapien\
pellentesque lectus commodo ornare."
),
),
type="fullscreen",
default_open=True,
)
)


my_fullscreen_takeover = ui.panel(
ui.dialog_trigger(
ui.action_button("Trigger Fullscreen"),
ui.dialog(
ui.heading("Fullscreen"),
ui.content(
ui.form(
ui.text_field(label="Name"),
ui.text_field(label="Email address"),
ui.checkbox("Make profile private"),
)
),
),
type="fullscreenTakeover",
default_open=True,
)
)
25 changes: 25 additions & 0 deletions tests/ui_dialog.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { expect, test } from '@playwright/test';
import { openPanel, gotoPage, SELECTORS } from './utils';

// Tests dialog components render as expected
test.describe('UI dialog components', () => {
['my_popover', 'my_tray'].forEach(name => {
test(name, async ({ page }) => {
await gotoPage(page, '');
await openPanel(page, name, SELECTORS.REACT_PANEL_VISIBLE);

await expect(
page.locator(SELECTORS.REACT_PANEL_VISIBLE)
).toHaveScreenshot();
});
});

['my_modal', 'my_fullscreen', 'my_fullscreen_takeover'].forEach(name => {
test(name, async ({ page }) => {
await gotoPage(page, '');
await openPanel(page, name, SELECTORS.REACT_PANEL_VISIBLE);

await expect(page).toHaveScreenshot();
});
});
});
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.

0 comments on commit 1d5eec9

Please sign in to comment.