-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge dev to main (major changes) (#9)
* implemented quick selector tool * implement test prompt file (#2) * Create npm-publish.yml * Update npm-publish.yml * Update npm-publish.yml * fix workflow: use pnpm * fix workflow: add set version to release tag * workflow: add checkout fetch-depth: 0 * 1.0.2 * 1.0.3 * patch 1.0.2 * fix src import * 1.0.3 * wip generate test from test prompt file * working testsuite generator * move testsuite generator to new directory * refactor cli * update project tests * Tidy test file mode (#3) * tidy cli code * make gen command output steps json * update README and package.json * implements press key action in webcontroller * remove http.controller.ts * update default prompts * update test and remove unused * implements press key action in webcontroller (#6) * CLI decoupling to new function (#5) * implements press key action in webcontroller * remove http.controller.ts * update default prompts * update test and remove unused * extract cli run to new function * add selenium test generation support (#7) * wip selenium test generator * MVP working selenium test generate * add interface for translator * move templates to new dir * add more translation for selenium * fix selenium bugs Template unknown translator: selenium Testsuite generator unknown translator selenium * removed prompt mode (#8) * update project tests * update README.md
- Loading branch information
1 parent
a4c911f
commit ab7a512
Showing
55 changed files
with
1,369 additions
and
642 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,3 +136,4 @@ screenshot.png | |
app.test.ts | ||
gen.test.ts | ||
*.test.ts | ||
examples/java_selenium/src/test/java/BasicTest.java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,90 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
// From https://medium.com/@mtiller/debugging-with-typescript-jest-ts-jest-and-visual-studio-code-ef9ca8644132 | ||
// { | ||
// "name": "Debug Jest Tests", | ||
// "type": "node", | ||
// "request": "launch", | ||
// "program": "${file}", | ||
// "runtimeArgs": [ | ||
// "--inspect-brk", | ||
// "${workspaceRoot}/node_modules/.bin/jest", | ||
// "--runInBand" | ||
// ], | ||
// "console": "integratedTerminal", | ||
// "internalConsoleOptions": "neverOpen", | ||
// "skipFiles": [ | ||
// // Node.js internal core modules | ||
// "<node_internals>/**", | ||
// // Ignore all dependencies (optional) | ||
// "${workspaceFolder}/node_modules/**", | ||
// ], | ||
// }, | ||
{ | ||
"name": "tsx", | ||
"type": "node", | ||
"request": "launch", | ||
// Debug current file in VSCode | ||
"program": "${file}", | ||
/* | ||
* Path to tsx binary | ||
* Assuming locally installed | ||
*/ | ||
"runtimeExecutable": "tsx", | ||
/* | ||
* Open terminal when debugging starts (Optional) | ||
* Useful to see console.logs | ||
*/ | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "neverOpen", | ||
// Files to exclude from debugger (e.g. call stack) | ||
"skipFiles": [ | ||
// Node.js internal core modules | ||
"<node_internals>/**", | ||
// Ignore all dependencies (optional) | ||
"${workspaceFolder}/node_modules/**", | ||
], | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Vitest Debug Current Test File", | ||
"autoAttachChildProcesses": true, | ||
"skipFiles": [ | ||
"<node_internals>/**", | ||
"**/node_modules/**" | ||
], | ||
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs", | ||
"args": [ | ||
"run", | ||
"${relativeFile}" | ||
], | ||
"smartStep": true, | ||
"console": "integratedTerminal" | ||
} | ||
] | ||
} | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
// From https://medium.com/@mtiller/debugging-with-typescript-jest-ts-jest-and-visual-studio-code-ef9ca8644132 | ||
// { | ||
// "name": "Debug Jest Tests", | ||
// "type": "node", | ||
// "request": "launch", | ||
// "program": "${file}", | ||
// "runtimeArgs": [ | ||
// "--inspect-brk", | ||
// "${workspaceRoot}/node_modules/.bin/jest", | ||
// "--runInBand" | ||
// ], | ||
// "console": "integratedTerminal", | ||
// "internalConsoleOptions": "neverOpen", | ||
// "skipFiles": [ | ||
// // Node.js internal core modules | ||
// "<node_internals>/**", | ||
// // Ignore all dependencies (optional) | ||
// "${workspaceFolder}/node_modules/**", | ||
// ], | ||
// }, | ||
{ | ||
"name": "tsx", | ||
"type": "node", | ||
"request": "launch", | ||
// Debug current file in VSCode | ||
"program": "${file}", | ||
/* | ||
* Path to tsx binary | ||
* Assuming locally installed | ||
*/ | ||
"runtimeExecutable": "tsx", | ||
/* | ||
* Open terminal when debugging starts (Optional) | ||
* Useful to see console.logs | ||
*/ | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "neverOpen", | ||
// Files to exclude from debugger (e.g. call stack) | ||
"skipFiles": [ | ||
// Node.js internal core modules | ||
"<node_internals>/**", | ||
// Ignore all dependencies (optional) | ||
"${workspaceFolder}/node_modules/**" | ||
] | ||
}, | ||
{ | ||
"name": "Debug gen command", | ||
"type": "node", | ||
"request": "launch", | ||
// Debug current file in VSCode | ||
"program": "index.ts", | ||
/* | ||
* Path to tsx binary | ||
* Assuming locally installed | ||
*/ | ||
"runtimeExecutable": "tsx", | ||
/* | ||
* Open terminal when debugging starts (Optional) | ||
* Useful to see console.logs | ||
*/ | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "neverOpen", | ||
// Files to exclude from debugger (e.g. call stack) | ||
"skipFiles": [ | ||
// Node.js internal core modules | ||
"<node_internals>/**", | ||
// Ignore all dependencies (optional) | ||
"${workspaceFolder}/node_modules/**" | ||
], | ||
"args": ["gen", "--headless", "false", "--verbose", "-f", "examples/testprompts/todo.xml"] | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Vitest Debug Current Test File", | ||
"autoAttachChildProcesses": true, | ||
"skipFiles": ["<node_internals>/**", "**/node_modules/**"], | ||
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs", | ||
"args": ["run", "${relativeFile}"], | ||
"smartStep": true, | ||
"console": "integratedTerminal" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Compiled class file | ||
*.class | ||
|
||
# Log file | ||
*.log | ||
|
||
# BlueJ files | ||
*.ctxt | ||
|
||
# Mobile Tools for Java (J2ME) | ||
.mtj.tmp/ | ||
|
||
# Package Files # | ||
*.jar | ||
*.war | ||
*.nar | ||
*.ear | ||
*.zip | ||
*.tar.gz | ||
*.rar | ||
|
||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml | ||
hs_err_pid* | ||
replay_pid* | ||
|
||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "java", | ||
"name": "Current File", | ||
"request": "launch", | ||
"mainClass": "${file}" | ||
}, | ||
{ | ||
"type": "java", | ||
"name": "Main", | ||
"request": "launch", | ||
"mainClass": "com.example.Main", | ||
"projectName": "demo" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"java.configuration.updateBuildConfiguration": "automatic", | ||
"[xml]": { | ||
"editor.defaultFormatter": "redhat.vscode-xml", | ||
"editor.formatOnSave": true, | ||
"editor.autoClosingBrackets": "never", | ||
"files.trimFinalNewlines": true | ||
}, | ||
"java.compile.nullAnalysis.mode": "automatic" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 wuttinanhi | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# aitestgen java test | ||
|
||
## Run test | ||
```bash | ||
mvn test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.example</groupId> | ||
<artifactId>demo</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<properties> | ||
<maven.compiler.source>17</maven.compiler.source> | ||
<maven.compiler.target>17</maven.compiler.target> | ||
<selenium.version>4.26.0</selenium.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.seleniumhq.selenium</groupId> | ||
<artifactId>selenium-java</artifactId> | ||
<version>${selenium.version}</version> | ||
</dependency> | ||
|
||
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine --> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<version>5.11.3</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.example; | ||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
System.out.println("Hello world!"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.time.Duration; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.JavascriptExecutor; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.chrome.ChromeDriver; | ||
import org.openqa.selenium.support.ui.WebDriverWait; | ||
|
||
public class BasicTest { | ||
|
||
WebDriver driver; | ||
|
||
@BeforeEach | ||
public void setup() { | ||
driver = new ChromeDriver(); | ||
} | ||
|
||
@AfterEach | ||
public void teardown() { | ||
driver.quit(); | ||
} | ||
|
||
@Test | ||
public void SimpleTest() { | ||
driver.get("https://www.selenium.dev/selenium/web/web-form.html"); | ||
|
||
WebElement textInput = driver.findElement(By.cssSelector("#my-text-id")); | ||
|
||
WebElement submitButton = driver.findElement(By.cssSelector(".btn")); | ||
|
||
textInput.sendKeys("hello"); | ||
|
||
submitButton.click(); | ||
|
||
new WebDriverWait(driver, Duration.ofSeconds(10)).until(webDriver -> ((JavascriptExecutor) webDriver).executeScript("return document.readyState").equals("complete")); | ||
|
||
WebElement successMessage = driver.findElement(By.cssSelector("#message")); | ||
String textsuccessMessage = successMessage.getText(); | ||
assertEquals("Received!", textsuccessMessage); | ||
|
||
driver.quit(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<testsuite> | ||
<name>Ollama Test</name> | ||
<output>todo.test.ts</output> | ||
<language>typescript</language> | ||
<translator>puppeteer</translator> | ||
<provider>ollama</provider> | ||
<ollamahost>http://localhost:11434</ollamahost> | ||
<model>qwen2.5-coder:7b-instruct-q8_0</model> | ||
<testcases> | ||
<testcase> | ||
<name>Should add a todo</name> | ||
<prompt> | ||
1. go to https://microsoftedge.github.io/Demos/demo-to-do/ | ||
2. add a todo "Cook Dinner" to the list | ||
3. expected added todo "Cook Dinner" in the list | ||
</prompt> | ||
</testcase> | ||
</testcases> | ||
</testsuite> |
Oops, something went wrong.