diff --git a/mainpage.po.ts_empty b/mainpage.po.ts_empty new file mode 100644 index 0000000..9171074 --- /dev/null +++ b/mainpage.po.ts_empty @@ -0,0 +1,5 @@ +import { Util } from "../util"; + +export class Mainpage { + +} \ No newline at end of file diff --git a/recorded_clicks.ts b/recorded_clicks.ts index 99e2796..886be8b 100644 --- a/recorded_clicks.ts +++ b/recorded_clicks.ts @@ -1,3 +1,13 @@ mainpage.navbuttons.click(); mainpage.navbuttons.click(); mainpage.navbuttons.click(); +mainpage.openmenu.click(); +mainpage.menubutton.click(); +mainpage.navbuttons.click(); +mainpage.navbuttons.click(); +mainpage.navbuttons.click(); +mainpage.treenode.click(); +mainpage.navbuttons.click(); +mainpage.navbuttons.click(); +mainpage.navbuttons.click(); +mainpage.inputfield.click(); diff --git a/server.ts b/server.ts index 6809e01..80fcf6f 100644 --- a/server.ts +++ b/server.ts @@ -75,17 +75,23 @@ function appendSuggestion(data: any) { if (data.id) lines.push(`static ${name}id = "#${data.id}"`); if (data.ariaLabel) lines.push(`static ${name}aria = "[aria-label='${data.ariaLabel}']"`); lines.push(``); - lines.push(`// Suggested get function (use whichever selector fits best):`); + lines.push(`// Suggested get function:`); - // Prefer aria > id > class for the get function selector variable - const selectorVar = data.ariaLabel - ? `Mainpage.${name}aria` - : data.id - ? `Mainpage.${name}id` - : `Mainpage.${name}class`; + // Selector: aria if available, otherwise class + const selectorVar = data.ariaLabel ? `Mainpage.${name}aria` : `Mainpage.${name}class`; + + // Always include text and tag if available + const hasText = data.text && data.text.length > 0; + const filterParts: string[] = []; + if (data.tag) filterParts.push(`data.tag: "${data.tag}"`); + if (hasText) filterParts.push(`text: "${data.text}"`); lines.push(`get ${name}() {`); - lines.push(` return cy.get(${selectorVar});`); + if (hasText) { + lines.push(` return cy.nccontains(${selectorVar}, '${data.text}');`); + } else { + lines.push(` return cy.get(${selectorVar});`); + } lines.push(`}`); lines.push(``); lines.push(`// ------------------------------------------------`); diff --git a/suggestions.txt b/suggestions.txt new file mode 100644 index 0000000..e69de29