demo ready
This commit is contained in:
7
TODO.txt
Normal file
7
TODO.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
dont save null class instead use combination of tag and something
|
||||
|
||||
add "title" as attribute
|
||||
|
||||
disable special charaters in function names
|
||||
|
||||
inputfield writing
|
||||
11
cypress.config.js
Normal file
11
cypress.config.js
Normal file
@@ -0,0 +1,11 @@
|
||||
const { defineConfig } = require("cypress");
|
||||
|
||||
module.exports = defineConfig({
|
||||
allowCypressEnv: false,
|
||||
|
||||
e2e: {
|
||||
setupNodeEvents(on, config) {
|
||||
// implement node event listeners here
|
||||
},
|
||||
},
|
||||
});
|
||||
10
cypress/e2e/demo.cy.js
Normal file
10
cypress/e2e/demo.cy.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Mainpage } from '../../mainpage.po.ts';
|
||||
|
||||
const mainpage = new Mainpage();
|
||||
|
||||
describe('template spec', () => {
|
||||
it('passes', () => {
|
||||
cy.visit('https://www.optimal-systems.de/')
|
||||
|
||||
})
|
||||
})
|
||||
5
cypress/fixtures/example.json
Normal file
5
cypress/fixtures/example.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "Using fixtures to represent data",
|
||||
"email": "hello@cypress.io",
|
||||
"body": "Fixtures are a great way to mock data for responses to routes"
|
||||
}
|
||||
25
cypress/support/commands.js
Normal file
25
cypress/support/commands.js
Normal file
@@ -0,0 +1,25 @@
|
||||
// ***********************************************
|
||||
// This example commands.js shows you how to
|
||||
// create various custom commands and overwrite
|
||||
// existing commands.
|
||||
//
|
||||
// For more comprehensive examples of custom
|
||||
// commands please read more here:
|
||||
// https://on.cypress.io/custom-commands
|
||||
// ***********************************************
|
||||
//
|
||||
//
|
||||
// -- This is a parent command --
|
||||
// Cypress.Commands.add('login', (email, password) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a child command --
|
||||
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a dual command --
|
||||
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This will overwrite an existing command --
|
||||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
||||
17
cypress/support/e2e.js
Normal file
17
cypress/support/e2e.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// ***********************************************************
|
||||
// This example support/e2e.js is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
// behavior that modifies Cypress.
|
||||
//
|
||||
// You can change the location of this file or turn off
|
||||
// automatically serving support files with the
|
||||
// 'supportFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands'
|
||||
@@ -1,47 +1,8 @@
|
||||
import { Util } from "../util";
|
||||
|
||||
export class Mainpage {
|
||||
static button = ".dummy"
|
||||
static matmdctooltiptriggerclass = ".mat-mdc-tooltip-trigger"
|
||||
static matbuttontogglebuttonclass = ".mat-button-toggle-button"
|
||||
static matmdcinputelementclass = ".mat-mdc-input-element"
|
||||
static startsearcharia = "[aria-label='Start search']"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
get startsearchsearch() {
|
||||
return cy.nccontains(Mainpage.startsearcharia, 'search');
|
||||
}
|
||||
get matmdcinputelement() {
|
||||
return cy.get(Mainpage.matmdcinputelementclass);
|
||||
}
|
||||
get matmdctooltiptriggercloud_circle() {
|
||||
return cy.nccontains(Mainpage.matmdctooltiptriggerclass, 'cloud_circle');
|
||||
}
|
||||
get matmdctooltiptriggerlibrary_books() {
|
||||
return cy.nccontains(Mainpage.matmdctooltiptriggerclass, 'library_books');
|
||||
}
|
||||
get matmdctooltiptriggermove_to_inbox() {
|
||||
return cy.nccontains(Mainpage.matmdctooltiptriggerclass, 'move_to_inbox');
|
||||
}
|
||||
get matbuttontogglebuttondark() {
|
||||
return cy.nccontains(Mainpage.matbuttontogglebuttonclass, 'Dark');
|
||||
}
|
||||
get matbuttontogglebuttonsystem() {
|
||||
return cy.nccontains(Mainpage.matbuttontogglebuttonclass, 'System');
|
||||
}
|
||||
get matmdctooltiptriggersettings() {
|
||||
return cy.nccontains(Mainpage.matmdctooltiptriggerclass, 'settings');
|
||||
}
|
||||
get dummybutton() {
|
||||
return cy.nccontains(Mainpage.menubutton, 'Upload document');
|
||||
return cy.contains(Mainpage.menubutton, 'Upload document');
|
||||
}
|
||||
}
|
||||
1831
package-lock.json
generated
1831
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -2,5 +2,8 @@
|
||||
"type": "commonjs",
|
||||
"devDependencies": {
|
||||
"@types/node": "^25.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"cypress": "^15.10.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
mainpage.matmdctooltiptriggersettings.click();
|
||||
mainpage.matbuttontogglebuttonsystem.click();
|
||||
mainpage.matbuttontogglebuttonclass.click();
|
||||
mainpage.schreibensieihreanfrageanclaude.click();
|
||||
mainpage.fontbaseboldkopieren.click();
|
||||
mainpage.matmdctooltiptriggersettings.click();
|
||||
mainpage.matbuttontogglebuttonsystem.click();
|
||||
mainpage.matbuttontogglebuttondark.click();
|
||||
mainpage.matmdctooltiptriggermove_to_inbox.click();
|
||||
mainpage.matmdctooltiptriggerlibrary_books.click();
|
||||
mainpage.matmdctooltiptriggercloud_circle.click();
|
||||
mainpage.matmdcinputelement.click();
|
||||
mainpage.startsearchsearch.click();
|
||||
|
||||
18
server.ts
18
server.ts
@@ -21,7 +21,7 @@ interface ParsedGetFn {
|
||||
name: string;
|
||||
body: string; // full body text
|
||||
referencedStatics: string[]; // static variable names used in body
|
||||
nccontainsText: string | null; // text in nccontains() if present
|
||||
containsText: string | null; // text in contains() if present
|
||||
}
|
||||
|
||||
function parsePageObject(): ParsedPageObject {
|
||||
@@ -70,11 +70,11 @@ function parsePageObject(): ParsedPageObject {
|
||||
body.includes(s)
|
||||
);
|
||||
|
||||
// Extract nccontains text if present: nccontains(Mainpage.foo, 'some text')
|
||||
const ncMatch = body.match(/nccontains\s*\([^,]+,\s*['"](.+?)['"]\s*\)/);
|
||||
const nccontainsText = ncMatch ? ncMatch[1] : null;
|
||||
// Extract contains text if present: contains(Mainpage.foo, 'some text')
|
||||
const ncMatch = body.match(/contains\s*\([^,]+,\s*['"](.+?)['"]\s*\)/);
|
||||
const containsText = ncMatch ? ncMatch[1] : null;
|
||||
|
||||
getFunctions.push({ name: fnName, body, referencedStatics, nccontainsText });
|
||||
getFunctions.push({ name: fnName, body, referencedStatics, containsText });
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -116,9 +116,9 @@ function findMatch(data: any, po: ParsedPageObject): MatchResult {
|
||||
const referencesMatch = fn.referencedStatics.some(s => matchingStatics.includes(s));
|
||||
if (!referencesMatch) continue;
|
||||
|
||||
// If we have text, require nccontains to match it
|
||||
// If we have text, require contains to match it
|
||||
if (rawText) {
|
||||
if (fn.nccontainsText && fn.nccontainsText.toLowerCase() === rawText.toLowerCase()) {
|
||||
if (fn.containsText && fn.containsText.toLowerCase() === rawText.toLowerCase()) {
|
||||
return { type: "full_match", fnName: fn.name };
|
||||
}
|
||||
} else {
|
||||
@@ -228,7 +228,7 @@ function handleClick(data: any) {
|
||||
// Static exists, just create the get function
|
||||
const getFnName = buildGetFnName(data);
|
||||
const getBody = hasText
|
||||
? ` return cy.nccontains(${match.selectorVar}, '${rawText}');`
|
||||
? ` return cy.contains(${match.selectorVar}, '${rawText}');`
|
||||
: ` return cy.get(${match.selectorVar});`;
|
||||
const getBlock = ` get ${getFnName}() {\n${getBody}\n }`;
|
||||
|
||||
@@ -250,7 +250,7 @@ function handleClick(data: any) {
|
||||
const staticName = data.ariaLabel ? `${baseName}aria` : `${baseName}class`;
|
||||
const staticLine = `static ${staticName} = ${staticValue}`;
|
||||
const getBody = hasText
|
||||
? ` return cy.nccontains(${selectorVar}, '${rawText}');`
|
||||
? ` return cy.contains(${selectorVar}, '${rawText}');`
|
||||
: ` return cy.get(${selectorVar});`;
|
||||
const getBlock = ` get ${getFnName}() {\n${getBody}\n }`;
|
||||
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
// --- Inserted (tag: <button>, text: "settings") ---
|
||||
static matmdctooltiptriggerclass = ".mat-mdc-tooltip-trigger"
|
||||
get matmdctooltiptriggersettings() {
|
||||
return cy.nccontains(Mainpage.matmdctooltiptriggerclass, 'settings');
|
||||
}
|
||||
// ------------------------------------------------
|
||||
|
||||
// --- Inserted (tag: <button>, text: "System") ---
|
||||
static matbuttontogglebuttonclass = ".mat-button-toggle-button"
|
||||
get matbuttontogglebuttonsystem() {
|
||||
return cy.nccontains(Mainpage.matbuttontogglebuttonclass, 'System');
|
||||
}
|
||||
// ------------------------------------------------
|
||||
|
||||
// --- Inserted (tag: <div>, text: "null") ---
|
||||
static schreibensieihreanfrageanclaudearia = "[aria-label='Schreiben Sie Ihre Anfrage an Claude']"
|
||||
get schreibensieihreanfrageanclaude() {
|
||||
return cy.get(Mainpage.schreibensieihreanfrageanclaudearia);
|
||||
}
|
||||
// ------------------------------------------------
|
||||
|
||||
// --- Inserted (tag: <button>, text: "Kopieren") ---
|
||||
static fontbaseboldclass = ".font-base-bold"
|
||||
get fontbaseboldkopieren() {
|
||||
return cy.nccontains(Mainpage.fontbaseboldclass, 'Kopieren');
|
||||
}
|
||||
// ------------------------------------------------
|
||||
|
||||
// Inserted static + get
|
||||
static matmdctooltiptriggerclass = ".mat-mdc-tooltip-trigger"
|
||||
get matmdctooltiptriggersettings() {
|
||||
return cy.nccontains(Mainpage.matmdctooltiptriggerclass, 'settings');
|
||||
}
|
||||
// ----
|
||||
|
||||
// Inserted static + get
|
||||
static matbuttontogglebuttonclass = ".mat-button-toggle-button"
|
||||
get matbuttontogglebuttonsystem() {
|
||||
return cy.nccontains(Mainpage.matbuttontogglebuttonclass, 'System');
|
||||
}
|
||||
// ----
|
||||
|
||||
// Inserted get function (static already existed)
|
||||
get matbuttontogglebuttondark() {
|
||||
return cy.nccontains(Mainpage.matbuttontogglebuttonclass, 'Dark');
|
||||
}
|
||||
// ----
|
||||
|
||||
// Inserted get function (static already existed)
|
||||
get matmdctooltiptriggermove_to_inbox() {
|
||||
return cy.nccontains(Mainpage.matmdctooltiptriggerclass, 'move_to_inbox');
|
||||
}
|
||||
// ----
|
||||
|
||||
// Inserted get function (static already existed)
|
||||
get matmdctooltiptriggerlibrary_books() {
|
||||
return cy.nccontains(Mainpage.matmdctooltiptriggerclass, 'library_books');
|
||||
}
|
||||
// ----
|
||||
|
||||
// Inserted get function (static already existed)
|
||||
get matmdctooltiptriggercloud_circle() {
|
||||
return cy.nccontains(Mainpage.matmdctooltiptriggerclass, 'cloud_circle');
|
||||
}
|
||||
// ----
|
||||
|
||||
// Inserted static + get
|
||||
static matmdcinputelementclass = ".mat-mdc-input-element"
|
||||
get matmdcinputelement() {
|
||||
return cy.get(Mainpage.matmdcinputelementclass);
|
||||
}
|
||||
// ----
|
||||
|
||||
// Inserted static + get
|
||||
static startsearcharia = "[aria-label='Start search']"
|
||||
get startsearchsearch() {
|
||||
return cy.nccontains(Mainpage.startsearcharia, 'search');
|
||||
}
|
||||
// ----
|
||||
|
||||
|
||||
Reference in New Issue
Block a user