Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
54 changes: 45 additions & 9 deletions packages/fiori/cypress/specs/Search.mobile.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type ResponsivePopover from "@ui5/webcomponents/dist/ResponsivePopover.js";
import Search from "../../src/Search.js";
import SearchItem from "../../src/SearchItem.js";
import SearchScope from "../../src/SearchScope.js";
Expand Down Expand Up @@ -45,6 +46,11 @@ describe("Search Field on mobile device", () => {
cy.get("[ui5-search]")
.realClick();

cy.get("[ui5-search]")
.shadow()
.find<ResponsivePopover>("[ui5-responsive-popover]")
.ui5ResponsivePopoverOpened();

cy.get("[ui5-search]")
.shadow()
.find(".ui5-search-popup-searching-header [ui5-button]")
Expand Down Expand Up @@ -73,12 +79,19 @@ describe("Search Field on mobile device", () => {
cy.get("[ui5-search]")
.realClick();

cy.get("[ui5-search]")
.shadow()
.find<ResponsivePopover>("[ui5-responsive-popover]")
.ui5ResponsivePopoverOpened();

cy.get("[ui5-search]")
.shadow()
.find("[ui5-input]")
.shadow()
.find("input")
.type("test{enter}");
.should("be.focused");

cy.realType("test{enter}");

cy.get("[ui5-search]")
.should("have.prop", "open", false);
Expand Down Expand Up @@ -114,12 +127,19 @@ describe("Search Field on mobile device", () => {
cy.get("[ui5-search]")
.realClick();

cy.get("[ui5-search]")
.shadow()
.find<ResponsivePopover>("[ui5-responsive-popover]")
.ui5ResponsivePopoverOpened();

cy.get("[ui5-search]")
.shadow()
.find("[ui5-input]")
.shadow()
.find("input")
.type("Item 1{enter}");
.should("be.focused");

cy.realType("Item 1{enter}");

cy.get("[ui5-search]")
.should("have.prop", "open", false);
Expand All @@ -130,7 +150,7 @@ describe("Search Field on mobile device", () => {
}));
});

it("should revert value of search if dialog is closed by cancel", () => {
it.skip("should revert value of search if dialog is closed by cancel", () => {
cy.mount(
<>
<Search showClearIcon={true}>
Expand All @@ -146,16 +166,18 @@ describe("Search Field on mobile device", () => {

cy.get("[ui5-search]")
.realClick();

cy.get("[ui5-search]")
.shadow()
.find(".ui5-search-popover-content")
.should("be.visible");
.find<ResponsivePopover>("[ui5-responsive-popover]")
.ui5ResponsivePopoverOpened();

cy.get("[ui5-search]")
.shadow()
.find("[ui5-input]")
.realPress("T");
.should("be.focused");

cy.realPress("T");

cy.get("[ui5-search]")
.should("have.prop", "value", "T");
Expand All @@ -165,6 +187,11 @@ describe("Search Field on mobile device", () => {
.find(".ui5-search-popup-searching-header [ui5-button]")
.realClick();

cy.get("[ui5-search]")
.shadow()
.find<ResponsivePopover>("[ui5-responsive-popover]")
.ui5ResponsivePopoverClosed();

cy.get("[ui5-search]")
.should("have.prop", "value", "");
});
Expand Down Expand Up @@ -228,12 +255,19 @@ describe("Search Field on mobile device", () => {
cy.get("[ui5-search]")
.realClick();

cy.get("[ui5-search]")
.shadow()
.find<ResponsivePopover>("[ui5-responsive-popover]")
.ui5ResponsivePopoverOpened();

cy.get("[ui5-search]")
.shadow()
.find("[ui5-input]")
.shadow()
.find("input")
.type("Ite");
.should("be.focused");

cy.realType("Ite");

cy.get("[ui5-search]")
.should("have.prop", "value", "Ite");
Expand All @@ -243,7 +277,9 @@ describe("Search Field on mobile device", () => {
.find("[ui5-input]")
.shadow()
.find("input")
.type("{enter}");
.should("be.focused");

cy.realType("{enter}");

cy.get("[ui5-search]")
.should("have.prop", "value", "Item 1");
Expand Down
2 changes: 1 addition & 1 deletion packages/fiori/cypress/specs/ShellBar.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ShellBar from "../../src/ShellBar.js";
import ShellBarItem from "../../src/ShellBarItem.js";
import ShellBarSpacer from "@ui5/webcomponents-fiori/dist/ShellBarSpacer.js";
import ShellBarSpacer from "../../src/ShellBarSpacer.js";
import activities from "@ui5/webcomponents-icons/dist/activities.js";
import navBack from "@ui5/webcomponents-icons/dist/nav-back.js";
import sysHelp from "@ui5/webcomponents-icons/dist/sys-help.js";
Expand Down
12 changes: 10 additions & 2 deletions packages/fiori/cypress/specs/UploadCollection.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,16 @@ describe("Edit - various file names", () => {

cy.get("#item")
.shadow()
.find(".ui5-uci-file-name")
.should("not.have.text");
.find("#ui5-uci-edit-input")
.should("be.visible")
.and("be.focused")
.and("have.value", ".gitignore")

cy.get("#item")
.shadow()
.find(".ui5-uci-file-extension")
.should("exist")
.and("have.text", "");
});

it("Tests cancelling of name change via keyboard", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,31 @@
import type ResponsivePopover from "../../../src/ResponsivePopover.js";
import { isPopupOpen } from "./utils/popup-open.js";
import { isPhone } from "@ui5/webcomponents-base/dist/Device.js";
import { isPopupOpen, isPopupClosed } from "./utils/popup-open.js";

Cypress.Commands.add("ui5ResponsivePopoverOpened", { prevSubject: true }, (subject: JQuery<ResponsivePopover>) => {
isPopupOpen(subject);
if (isPhone()) {
cy.wrap(subject)
.shadow()
.find("[ui5-dialog]")
.then($dialog => {
isPopupOpen($dialog);
});
} else {
isPopupOpen(subject);
}
});

Cypress.Commands.add("ui5ResponsivePopoverClosed", { prevSubject: true }, (subject: JQuery<ResponsivePopover>) => {
if (isPhone()) {
cy.wrap(subject)
.shadow()
.find("[ui5-dialog]")
.then($dialog => {
isPopupClosed($dialog);
});
} else {
isPopupClosed(subject);
}
});

declare global {
Expand All @@ -11,6 +34,9 @@ declare global {
ui5ResponsivePopoverOpened(
this: Chainable<JQuery<ResponsivePopover>>
): Chainable<void>;
ui5ResponsivePopoverClosed(
this: Chainable<JQuery<ResponsivePopover>>
): Chainable<void>;
}
}
}
18 changes: 17 additions & 1 deletion packages/main/cypress/support/commands/utils/popup-open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@ const isPopupOpen = (subject: any) => {
.and("have.attr", "open");
};

const isPopupClosed = (subject: any) => {
cy.wrap(subject)
.as("popup");

cy.get("@popup")
.should("not.have.attr", "open");

cy.get("@popup")
.should($rp => {
expect($rp.is(":popover-open")).to.be.false;
expect($rp).not.be.visible;
})
.and("not.have.attr", "open");
};

export {
isPopupOpen
isPopupOpen,
isPopupClosed
}