Switch integration tests to get application menus by IDs (#3912)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-10-07 15:30:52 -04:00
1 parent 724b9450a6
commit e10c13cdf4
6 files changed
+73 -165

No files matched your search

+11 -3
View File
@@ -25,16 +25,24 @@
TEST_NAMESPACE namespace. This is done to minimize destructive impact of the cluster tests on an existing minikube
cluster and vice versa.
*/
import type { Page } from "playwright";
import type { ElectronApplication, Page } from "playwright";
import * as utils from "../helpers/utils";
describe("preferences page tests", () => {
let window: Page, cleanup: () => Promise<void>;
beforeEach(async () => {
({ window, cleanup } = await utils.start());
let app: ElectronApplication;
({ window, cleanup, app } = await utils.start());
await utils.clickWelcomeButton(window);
await window.keyboard.press("Meta+,");
await app.evaluate(async ({ app }) => {
await app.applicationMenu
.getMenuItemById(process.platform === "darwin" ? "root" : "file")
.submenu.getMenuItemById("preferences")
.click();
});
}, 10*60*1000);
afterEach(async () => {
+10 -5
View File
@@ -19,14 +19,14 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import type { Page } from "playwright";
import type { ElectronApplication, Page } from "playwright";
import * as utils from "../helpers/utils";
describe("Lens command palette", () => {
let window: Page, cleanup: () => Promise<void>;
let window: Page, cleanup: () => Promise<void>, app: ElectronApplication;
beforeEach(async () => {
({ window, cleanup } = await utils.start());
({ window, cleanup, app } = await utils.start());
await utils.clickWelcomeButton(window);
}, 10*60*1000);
@@ -35,8 +35,13 @@ describe("Lens command palette", () => {
}, 10*60*1000);
describe("menu", () => {
it("opens command dialog from keyboard shortcut", async () => {
await window.keyboard.press("Meta+Shift+p");
it("opens command dialog from menu", async () => {
await app.evaluate(async ({ app }) => {
await app.applicationMenu
.getMenuItemById("view")
.submenu.getMenuItemById("command-palette")
.click();
});
await window.waitForSelector(".Select__option >> text=Hotbar: Switch");
}, 10*60*1000);
});