ljmotta commented on code in PR #2188: URL: https://github.com/apache/incubator-kie-tools/pull/2188#discussion_r1514652808
########## packages/scesim-editor/tests/e2e/features/keyboard/keyboard.spec.ts: ########## @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { expect, test } from "../../__fixtures__/base"; + +test.describe("Keyboard", () => { + test.describe("Navigation", () => { + test("should correctly navigate", async () => { + // enter, shift+enter, tab, shift+tab, escape + // currently not working in playwright + }); + }); + + test.describe("Arrow Key Navigation", () => { + test("should correctly navigate the page using arrow keys", async ({ stories, page }) => { + await stories.openTestScenarioTableDecision(); + await page.getByRole("cell", { name: "1" }).click(); + await page.getByRole("cell", { name: "1" }).locator("div").nth(1).click(); + await page.getByRole("cell", { name: "1" }).locator("div").nth(1).click(); + await page.getByRole("cell", { name: "1" }).locator("div").nth(1).click(); Review Comment: I know it can appers to be pointless, but the idea is to improve the readbility, and mimic the way we interacrt with the editor. The `addRow` could be: ```ts export enum AddRowPlace { ABOVE, BELOW } (...) public async function addRow(args: { fromCell: string, place: AddRowPlace }) { if (args.place=== AddRowPlace.BELOW) { // something different to add below await page.getByRole("cell", { name: args.from }).locator("div").nth(1).click(); } else { // something different to add above await page.getByRole("cell", { name: args.from }).locator("div").nth(1).click(); } } public async function addRows(args: { fromCell: string, place: AddRowPlace, nth: number }) { // for nth this.addRow( ... ) } ``` Now, this is just an idea of implementation, where on the test will be: ```ts await table.addRow({ fromCell: "1", place: AddRowPlace.BELOW }); ``` Maybe `place` and `AddRowPlace` are not the best name, but reading the line gives us a way better understanding of what is happening, and the idea that we're interacting with the editor itself. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
