[FIX] *: adapt QUnit tests and tours
[FIX] *: selectors in tours [FIX][TMP] account: CogMenu selector in tours [FIX][TMP] web*: Breadcrumb targetting in tours Adds a `o_breadcrumb` class to target the whole breadcrumb, no matter how much elements it contains (collapsed parts, visible path, single name...). add classname on last breadcrumb item [FIX][TMP] project: View buttons selector in tours (moved away from CP) [FIX][TMP] project: Kanban selectors in tours (quick create) [FIX][TMP] *: SearchBar selectors in tours (toggle menu) [FIX][TMP] *: ButtonBox selector in tours [WIP][IMP] web: add toggleSearchBarMenu in search helpers adapt and unskip 3 list tests adapt and unskip calendar tests unskip web_tour test that actually pass post rebase fix allow to lose cell focus after multi edition (given to searchbar) - bug reported, to check later post rebase fixes fix Part-of: odoo/odoo#116641
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { click, getFixture, triggerEvent, nextTick } from "@web/../tests/helpers/utils";
|
||||
import { getFixture, nextTick } from "@web/../tests/helpers/utils";
|
||||
import { ControlPanel } from "@web/search/control_panel/control_panel";
|
||||
import {
|
||||
editSearch,
|
||||
makeWithSearch,
|
||||
setupControlPanelServiceRegistry,
|
||||
} from "@web/../tests/search/helpers";
|
||||
import { makeWithSearch, setupControlPanelServiceRegistry } from "@web/../tests/search/helpers";
|
||||
import { registry } from "@web/core/registry";
|
||||
import { uiService } from "@web/core/ui/ui_service";
|
||||
|
||||
@@ -42,86 +38,6 @@ QUnit.module("Search", (hooks) => {
|
||||
|
||||
QUnit.module("Control Panel (mobile)");
|
||||
|
||||
QUnit.test("Display control panel mobile", async (assert) => {
|
||||
await makeWithSearch({
|
||||
serverData,
|
||||
resModel: "foo",
|
||||
Component: ControlPanel,
|
||||
searchMenuTypes: ["filter"],
|
||||
searchViewId: false,
|
||||
});
|
||||
|
||||
assert.containsOnce(target, ".breadcrumb");
|
||||
assert.containsOnce(target, ".o_enable_searchview");
|
||||
assert.containsNone(target, ".o_searchview");
|
||||
assert.containsNone(target, ".o_toggle_searchview_full");
|
||||
|
||||
await click(target, ".o_enable_searchview");
|
||||
|
||||
assert.containsNone(target, ".breadcrumb");
|
||||
assert.containsOnce(target, ".o_enable_searchview");
|
||||
assert.containsOnce(target, ".o_searchview");
|
||||
assert.containsOnce(target, ".o_toggle_searchview_full");
|
||||
|
||||
await click(target, ".o_toggle_searchview_full");
|
||||
|
||||
assert.containsOnce(document.body, ".o_searchview.o_mobile_search");
|
||||
assert.containsN(document.body, ".o_mobile_search .o_mobile_search_button", 2);
|
||||
assert.strictEqual(
|
||||
document.body.querySelector(".o_mobile_search_header").textContent.trim(),
|
||||
"FILTER CLEAR"
|
||||
);
|
||||
assert.containsOnce(document.body, ".o_searchview.o_mobile_search .o_cp_searchview");
|
||||
assert.containsOnce(document.body, ".o_searchview.o_mobile_search .o_mobile_search_footer");
|
||||
|
||||
await click(document.body.querySelector(".o_mobile_search_button"));
|
||||
|
||||
assert.containsNone(target, ".breadcrumb");
|
||||
assert.containsOnce(target, ".o_enable_searchview");
|
||||
assert.containsOnce(target, ".o_searchview");
|
||||
assert.containsOnce(target, ".o_toggle_searchview_full");
|
||||
|
||||
await click(target, ".o_enable_searchview");
|
||||
|
||||
assert.containsOnce(target, ".breadcrumb");
|
||||
assert.containsOnce(target, ".o_enable_searchview");
|
||||
assert.containsNone(target, ".o_searchview");
|
||||
assert.containsNone(target, ".o_toggle_searchview_full");
|
||||
});
|
||||
|
||||
QUnit.test("Make a simple search in mobile mode", async (assert) => {
|
||||
await makeWithSearch({
|
||||
serverData,
|
||||
resModel: "foo",
|
||||
Component: ControlPanel,
|
||||
searchMenuTypes: ["filter"],
|
||||
searchViewFields: {
|
||||
birthday: { string: "Birthday", type: "date", store: true, sortable: true },
|
||||
},
|
||||
searchViewArch: `
|
||||
<search>
|
||||
<field name="birthday"/>
|
||||
</search>
|
||||
`,
|
||||
});
|
||||
assert.containsNone(target, ".o_searchview");
|
||||
|
||||
await click(target, ".o_enable_searchview");
|
||||
assert.containsOnce(target, ".o_searchview");
|
||||
const input = target.querySelector(".o_searchview input");
|
||||
assert.containsNone(target, ".o_searchview_autocomplete");
|
||||
|
||||
await editSearch(target, "2022-02-14");
|
||||
assert.strictEqual(input.value, "2022-02-14", "input value should be updated");
|
||||
assert.containsOnce(target, ".o_searchview_autocomplete");
|
||||
|
||||
await triggerEvent(input, null, "keydown", { key: "Escape" });
|
||||
assert.containsNone(target, ".o_searchview_autocomplete");
|
||||
|
||||
await click(target, ".o_enable_searchview");
|
||||
assert.containsNone(target, ".o_searchview");
|
||||
});
|
||||
|
||||
QUnit.test("Control panel is shown/hide on top when scrolling", async (assert) => {
|
||||
await makeWithSearch({
|
||||
serverData,
|
||||
|
||||
@@ -92,63 +92,59 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
|
||||
assert.containsNone(target, ".o_calendar_button_prev", "prev button should be hidden");
|
||||
assert.containsNone(target, ".o_calendar_button_next", "next button should be hidden");
|
||||
await click(target, ".o_calendar_container .o_other_calendar_panel");
|
||||
assert.isVisible(
|
||||
target.querySelector(
|
||||
".o_cp_bottom_left .o_calendar_buttons .o_view_scale_selector + button.o_cp_today_button"
|
||||
".o_calendar_container .o_calendar_sidebar_container button.o_calendar_button_today"
|
||||
),
|
||||
"today button should be visible near the calendar buttons (bottom left corner)"
|
||||
"today button should be visible"
|
||||
);
|
||||
|
||||
// Test all views
|
||||
// displays month mode by default
|
||||
assert.containsOnce(
|
||||
target,
|
||||
".fc-view-container > .fc-timeGridWeek-view",
|
||||
"should display the current week"
|
||||
);
|
||||
assert.equal(
|
||||
target.querySelector(".breadcrumb-item").textContent,
|
||||
"undefined (Dec 11 – 17, 2016)"
|
||||
target.querySelector(
|
||||
".o_calendar_container .o_calendar_sidebar_container .dropdown-toggle"
|
||||
).textContent,
|
||||
"Week",
|
||||
"should display the current week"
|
||||
);
|
||||
|
||||
// switch to day mode
|
||||
await click(target, ".o_control_panel .scale_button_selection");
|
||||
await click(target, ".o_control_panel .o_scale_button_day");
|
||||
await click(target, ".o_calendar_sidebar_container .dropdown-toggle");
|
||||
await click(target, ".o_calendar_sidebar_container .o_scale_button_day");
|
||||
await nextTick();
|
||||
assert.containsOnce(
|
||||
target,
|
||||
".fc-view-container > .fc-timeGridDay-view",
|
||||
"should display the current day"
|
||||
);
|
||||
assert.equal(
|
||||
target.querySelector(".breadcrumb-item").textContent,
|
||||
"undefined (December 12, 2016)"
|
||||
target.querySelector(
|
||||
".o_calendar_container .o_calendar_sidebar_container .dropdown-toggle"
|
||||
).textContent,
|
||||
"Day",
|
||||
"should display the current day"
|
||||
);
|
||||
|
||||
// switch to month mode
|
||||
await click(target, ".o_control_panel .scale_button_selection");
|
||||
await click(target, ".o_control_panel .o_scale_button_month");
|
||||
await click(target, ".o_calendar_sidebar_container .dropdown-toggle");
|
||||
await click(target, ".o_calendar_sidebar_container .o_scale_button_month");
|
||||
await nextTick();
|
||||
assert.containsOnce(
|
||||
target,
|
||||
".fc-view-container > .fc-dayGridMonth-view",
|
||||
"should display the current month"
|
||||
);
|
||||
assert.equal(
|
||||
target.querySelector(".breadcrumb-item").textContent,
|
||||
"undefined (December 2016)"
|
||||
target.querySelector(
|
||||
".o_calendar_container .o_calendar_sidebar_container .dropdown-toggle"
|
||||
).textContent,
|
||||
"Month",
|
||||
"should display the current month"
|
||||
);
|
||||
|
||||
// switch to year mode
|
||||
await click(target, ".o_control_panel .scale_button_selection");
|
||||
await click(target, ".o_control_panel .o_scale_button_year");
|
||||
await click(target, ".o_calendar_sidebar_container .dropdown-toggle");
|
||||
await click(target, ".o_calendar_sidebar_container .o_scale_button_year");
|
||||
await nextTick();
|
||||
assert.containsOnce(
|
||||
target,
|
||||
".fc-view-container > .fc-dayGridYear-view",
|
||||
assert.equal(
|
||||
target.querySelector(
|
||||
".o_calendar_container .o_calendar_sidebar_container .dropdown-toggle"
|
||||
).textContent,
|
||||
"Year",
|
||||
"should display the current year"
|
||||
);
|
||||
assert.equal(target.querySelector(".breadcrumb-item").textContent, "undefined (2016)");
|
||||
});
|
||||
|
||||
QUnit.test("calendar: popover is rendered as dialog in mobile", async function (assert) {
|
||||
@@ -186,7 +182,9 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
await swipeRight(target, ".o_calendar_widget");
|
||||
assert.equal(target.querySelector(".fc-day-header[data-date]").dataset.date, "2016-12-11");
|
||||
|
||||
await click(target, ".o_other_calendar_panel");
|
||||
await click(target, ".o_calendar_button_today");
|
||||
await click(target, ".o_other_calendar_panel");
|
||||
assert.equal(target.querySelector(".fc-day-header[data-date]").dataset.date, "2016-12-12");
|
||||
});
|
||||
|
||||
@@ -358,7 +356,6 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
// Should display year view
|
||||
assert.containsOnce(target, ".fc-dayGridYear-view");
|
||||
assert.containsN(target, ".fc-month-container", 12);
|
||||
assert.equal(target.querySelector(".breadcrumb-item").textContent, "undefined (2016)");
|
||||
|
||||
// Tap on a date
|
||||
await tap(target, ".fc-day-top[data-date='2016-02-05']");
|
||||
@@ -368,19 +365,14 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
// Should display day view
|
||||
assert.containsNone(target, ".fc-dayGridYear-view");
|
||||
assert.containsOnce(target, ".fc-timeGridDay-view");
|
||||
assert.equal(
|
||||
target.querySelector(".breadcrumb-item").textContent,
|
||||
"undefined (February 5, 2016)"
|
||||
);
|
||||
assert.equal(target.querySelector(".fc-day-header[data-date]").dataset.date, "2016-02-05");
|
||||
|
||||
// Change scale to month
|
||||
await click(target, ".o_calendar_container .o_other_calendar_panel");
|
||||
await changeScale(target, "month");
|
||||
await click(target, ".o_calendar_container .o_other_calendar_panel");
|
||||
assert.containsNone(target, ".fc-timeGridDay-view");
|
||||
assert.containsOnce(target, ".fc-dayGridMonth-view");
|
||||
assert.equal(
|
||||
target.querySelector(".breadcrumb-item").textContent,
|
||||
"undefined (February 2016)"
|
||||
);
|
||||
|
||||
// Tap on a date
|
||||
await tap(target, ".fc-day-top[data-date='2016-02-10']");
|
||||
@@ -389,9 +381,6 @@ QUnit.module("Views", ({ beforeEach }) => {
|
||||
|
||||
assert.containsNone(target, ".fc-dayGridMonth-view");
|
||||
assert.containsOnce(target, ".fc-timeGridDay-view");
|
||||
assert.equal(
|
||||
target.querySelector(".breadcrumb-item").textContent,
|
||||
"undefined (February 10, 2016)"
|
||||
);
|
||||
assert.equal(target.querySelector(".fc-day-header[data-date]").dataset.date, "2016-02-10");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ QUnit.module("Mobile Fields", ({ beforeEach }) => {
|
||||
|
||||
QUnit.module("StatusBarField");
|
||||
|
||||
QUnit.test("statusbar is rendered correclty on small devices", async (assert) => {
|
||||
QUnit.test("statusbar is rendered correctly on small devices", async (assert) => {
|
||||
await makeView({
|
||||
type: "form",
|
||||
resModel: "partner",
|
||||
@@ -75,20 +75,20 @@ QUnit.module("Mobile Fields", ({ beforeEach }) => {
|
||||
);
|
||||
assert.containsN(
|
||||
fixture,
|
||||
".o_statusbar_status .dropdown-menu .btn",
|
||||
".o_statusbar_status .dropdown-menu .dropdown-item",
|
||||
3,
|
||||
"should have 3 status"
|
||||
);
|
||||
assert.containsN(
|
||||
fixture,
|
||||
".o_statusbar_status .btn.disabled",
|
||||
".o_statusbar_status .dropdown-item.disabled",
|
||||
3,
|
||||
"all status should be disabled"
|
||||
);
|
||||
assert.hasClass(
|
||||
fixture.querySelector(".o_statusbar_status .btn:nth-child(3)"),
|
||||
"btn-primary",
|
||||
"active status should be btn-primary"
|
||||
fixture.querySelector(".o_statusbar_status .dropdown-item:nth-child(3)"),
|
||||
"active",
|
||||
"active status should be set"
|
||||
);
|
||||
});
|
||||
|
||||
@@ -131,30 +131,30 @@ QUnit.module("Mobile Fields", ({ beforeEach }) => {
|
||||
);
|
||||
assert.containsN(
|
||||
fixture,
|
||||
".o_statusbar_status .dropdown-menu .btn",
|
||||
".o_statusbar_status .dropdown-menu .dropdown-item",
|
||||
3,
|
||||
"statusbar widget dropdown menu should have 3 buttons"
|
||||
"statusbar widget dropdown menu should have 3 items"
|
||||
);
|
||||
assert.strictEqual(
|
||||
fixture
|
||||
.querySelectorAll(".o_statusbar_status .dropdown-menu .btn")[0]
|
||||
.querySelectorAll(".o_statusbar_status .dropdown-menu .dropdown-item")[0]
|
||||
.textContent.trim(),
|
||||
"first record",
|
||||
"statusbar widget dropdown first button should display the first record display_name"
|
||||
"statusbar widget dropdown first item should display the first record display_name"
|
||||
);
|
||||
assert.strictEqual(
|
||||
fixture
|
||||
.querySelectorAll(".o_statusbar_status .dropdown-menu .btn")[1]
|
||||
.querySelectorAll(".o_statusbar_status .dropdown-menu .dropdown-item")[1]
|
||||
.textContent.trim(),
|
||||
"second record",
|
||||
"statusbar widget dropdown second button should display the second record display_name"
|
||||
"statusbar widget dropdown second item should display the second record display_name"
|
||||
);
|
||||
assert.strictEqual(
|
||||
fixture
|
||||
.querySelectorAll(".o_statusbar_status .dropdown-menu .btn")[2]
|
||||
.querySelectorAll(".o_statusbar_status .dropdown-menu .dropdown-item")[2]
|
||||
.textContent.trim(),
|
||||
"aaa",
|
||||
"statusbar widget dropdown third button should display the third record display_name"
|
||||
"statusbar widget dropdown third item should display the third record display_name"
|
||||
);
|
||||
});
|
||||
|
||||
@@ -175,34 +175,34 @@ QUnit.module("Mobile Fields", ({ beforeEach }) => {
|
||||
|
||||
await click(fixture, ".o_statusbar_status .dropdown-toggle");
|
||||
assert.hasClass(
|
||||
fixture.querySelector(".o_statusbar_status .dropdown-menu .btn:nth-child(3)"),
|
||||
"btn-primary"
|
||||
fixture.querySelector(".o_statusbar_status .dropdown-menu .dropdown-item:nth-child(3)"),
|
||||
"active"
|
||||
);
|
||||
assert.hasClass(
|
||||
fixture.querySelector(".o_statusbar_status .dropdown-menu .btn:nth-child(3)"),
|
||||
fixture.querySelector(".o_statusbar_status .dropdown-menu .dropdown-item:nth-child(3)"),
|
||||
"disabled"
|
||||
);
|
||||
|
||||
assert.containsN(
|
||||
fixture,
|
||||
".o_statusbar_status .btn-secondary:not(.dropdown-toggle):not(.disabled)",
|
||||
".o_statusbar_status .dropdown-item:not(.dropdown-toggle):not(.disabled):not(.active)",
|
||||
2,
|
||||
"other status should be btn-secondary and not disabled"
|
||||
"other status should be active and not disabled"
|
||||
);
|
||||
|
||||
await click(
|
||||
fixture.querySelector(
|
||||
".o_statusbar_status .btn-secondary:not(.dropdown-toggle):not(.disabled)"
|
||||
".o_statusbar_status .dropdown-item:not(.dropdown-toggle):not(.disabled):not(.active)"
|
||||
)
|
||||
);
|
||||
|
||||
await click(fixture, ".o_statusbar_status .dropdown-toggle");
|
||||
assert.hasClass(
|
||||
fixture.querySelector(".o_statusbar_status .dropdown-menu .btn:nth-child(1)"),
|
||||
"btn-primary"
|
||||
fixture.querySelector(".o_statusbar_status .dropdown-menu .dropdown-item:nth-child(1)"),
|
||||
"active"
|
||||
);
|
||||
assert.hasClass(
|
||||
fixture.querySelector(".o_statusbar_status .dropdown-menu .btn:nth-child(1)"),
|
||||
fixture.querySelector(".o_statusbar_status .dropdown-menu .dropdown-item:nth-child(1)"),
|
||||
"disabled"
|
||||
);
|
||||
});
|
||||
|
||||
@@ -61,13 +61,13 @@ QUnit.module("Mobile Views", ({ beforeEach }) => {
|
||||
|
||||
assert.containsN(fixture, ".o_data_row", 4);
|
||||
assert.containsNone(fixture, ".o_list_selection_box");
|
||||
assert.containsOnce(fixture, ".o_control_panel .o_cp_bottom_right");
|
||||
assert.containsOnce(fixture, ".o_control_panel .fa-search");
|
||||
|
||||
// select a record
|
||||
await triggerEvents(fixture, ".o_data_row:nth-child(1)", ["touchstart", "touchend"]);
|
||||
assert.containsOnce(fixture, ".o_list_selection_box");
|
||||
assert.containsNone(fixture, ".o_list_selection_box .o_list_select_domain");
|
||||
assert.containsNone(fixture, ".o_control_panel .o_cp_bottom_right");
|
||||
assert.containsNone(fixture, ".o_control_panel .fa-search");
|
||||
assert.ok(
|
||||
fixture.querySelector(".o_list_selection_box").textContent.includes("1 selected")
|
||||
);
|
||||
@@ -94,7 +94,7 @@ QUnit.module("Mobile Views", ({ beforeEach }) => {
|
||||
// unselect all
|
||||
await click(fixture, ".o_list_unselect_all");
|
||||
assert.containsNone(fixture, ".o_list_selection_box");
|
||||
assert.containsOnce(fixture, ".o_control_panel .o_cp_bottom_right");
|
||||
assert.containsOnce(fixture, ".o_control_panel .fa-search");
|
||||
});
|
||||
|
||||
QUnit.test("selection box is properly displayed (multi pages)", async function (assert) {
|
||||
|
||||
@@ -72,7 +72,7 @@ QUnit.test("Burger Menu on an App", async (assert) => {
|
||||
document.body.querySelector(".o_burger_menu nav.o_burger_menu_content li").textContent,
|
||||
"SubMenu"
|
||||
);
|
||||
assert.hasClass(document.body.querySelector(".o_burger_menu_content"), "o_burger_menu_dark");
|
||||
assert.hasClass(document.body.querySelector(".o_burger_menu_content"), "o_burger_menu_app");
|
||||
|
||||
await click(document.body, ".o_burger_menu_topbar");
|
||||
assert.doesNotHaveClass(
|
||||
@@ -81,7 +81,7 @@ QUnit.test("Burger Menu on an App", async (assert) => {
|
||||
);
|
||||
|
||||
await click(document.body, ".o_burger_menu_topbar");
|
||||
assert.hasClass(document.body.querySelector(".o_burger_menu_content"), "o_burger_menu_dark");
|
||||
assert.hasClass(document.body.querySelector(".o_burger_menu_content"), "o_burger_menu_app");
|
||||
});
|
||||
|
||||
QUnit.test("Burger Menu on an App without SubMenu", async (assert) => {
|
||||
|
||||
Reference in New Issue
Block a user