def test_widgets_on_dashboard(request, dashboard, default_widgets, custom_widgets, soft_assert): with update(dashboard): dashboard.widgets = map(lambda w: w.title, custom_widgets) def _finalize(): with update(dashboard): dashboard.widgets = default_widgets request.addfinalizer(_finalize) dashboard.reset_widgets() soft_assert(len(Widget.all()) == len(custom_widgets), "Count of the widgets differ") for custom_w in custom_widgets: try: Widget.by_name(custom_w.title) except NameError: soft_assert(False, "Widget {} not found on dashboard".format(custom_w.title))
def test_widgets_on_dashboard(request, dashboard, default_widgets, custom_widgets, soft_assert): with update(dashboard): dashboard.widgets = map(lambda w: w.title, custom_widgets) def _finalize(): with update(dashboard): dashboard.widgets = default_widgets request.addfinalizer(_finalize) view = navigate_to(Server, "Dashboard") view.reset_widgets() soft_assert(len(Widget.all()) == len(custom_widgets), "Count of the widgets differ") for custom_w in custom_widgets: try: Widget.by_name(custom_w.title) except NameError: soft_assert(False, "Widget {} not found on dashboard".format(custom_w.title))
def test_widgets_on_dashboard(request, dashboard, default_widgets, custom_widgets, soft_assert): with update(dashboard): dashboard.widgets = map(lambda w: w.title, custom_widgets) def _finalize(): with update(dashboard): dashboard.widgets = default_widgets request.addfinalizer(_finalize) sel.force_navigate("dashboard") toolbar.select("Reset Dashboard Widgets to the defaults", invokes_alert=True) sel.handle_alert(False) soft_assert(len(Widget.all()) == len(custom_widgets), "Count of the widgets differ") for custom_w in custom_widgets: try: Widget.by_name(custom_w.title) except NameError: soft_assert(False, "Widget {} not found on dashboard".format(custom_w.title))