# Changelog

## 1.2.1 (2026-10-09)

- The documentation is now in English by default: [README](https://git.xylentis.com/tools/automation-test-code/-/blob/main/README.md) and the [user guide](https://git.xylentis.com/tools/automation-test-code/-/blob/main/docs/user-guide.md). The Vietnamese versions remain available: [README.vi.md](https://git.xylentis.com/tools/automation-test-code/-/blob/main/README.vi.md) and [docs/huong-dan-su-dung.md](https://git.xylentis.com/tools/automation-test-code/-/blob/main/docs/huong-dan-su-dung.md).

## 1.2.0 (2026-10-06)

- **Edit steps in the UI:** edit the locator (written as in a Playwright test, for example `getByRole('button', { name: 'Sign in' })`), the typed text, the selected value, the assertion value, the key and the upload file path; reorder or delete steps; **Undo** to go back. testgen blocks changes that would make a page get used before it is opened or after it is closed.
- **Replay:** run the steps again with Playwright right in the UI; each step shows ✓ or ✗. A failed step shows the error, a screenshot of the page at that moment and an **Edit** button to fix it. Replay runs the recording itself on Playwright, not the generated Selenium code.
- **Checks:** testgen points out what to review before using a test: no assertions at all, last steps not checked, locators that rely on position (`nth`, `first`) or page structure (XPath, `div > span`), uploads with only a file name, locators that rely on visible text when the app has no test ids, and each target's `// TODO(testgen)`s. The UI shows them under **Checks**; the CLI prints them after generating code.
- **Passwords no longer end up in tests.** Values typed into password, PIN, OTP, token, API key… fields are read from environment variables, for example `TEST_PASSWORD`: Java `TestgenSupport.secret("TEST_PASSWORD")`, TypeScript/JavaScript `secret('TEST_PASSWORD')`, Go `os.LookupEnv("TEST_PASSWORD")`. If the variable is missing, the test stops right away with a clear message. The value also stays out of CSV files, the recording saved by `testgen record` and the file from **Download recording**. When the value appears inside other text (a locator, expected text), the code uses `secret(...)` in that spot and the recording stores `${TEST_PASSWORD}`. Logs and error messages of Selenium and Replay show `***`. In the UI you can turn secrets on or off and name the variable for each step; a step that is already secret stays secret when you edit its locator.
  - This is a change from 1.1.x: tests generated from a recording with a password field need the environment variable set before they run, for example `TEST_PASSWORD=... mvn test`.
- **Data-driven tests for every target:** `playwright-ts`, `playwright-go` and `selenium-js` also read data from a CSV file and run the test once per row. The CSV file sits next to the test file, except for Go, where it goes in `testdata/`. Locator text that *contains* a typed value now follows the data as well, for example `filterHasText(whatNeedsToBeDone + " Delete")` instead of `filterHasText("Buy milk Delete")`.
- **UI security:** the `testgen ui` server only accepts changes from the testgen page itself (it checks `Origin` and `Sec-Fetch-Site` and requires JSON). Before, another website open in the browser could send commands to `testgen ui`, for example to write files into the project folder.
- **`--log-steps` for `selenium-js`:** the test calls `page.setLogger(console.log)` and logs each step and each assertion result, like the Java version. The two Playwright targets don't need this option, because Playwright's report and trace already show every step.
- Detailed user guide (in Vietnamese): [docs/huong-dan-su-dung.md](https://git.xylentis.com/tools/automation-test-code/-/blob/main/docs/huong-dan-su-dung.md).

## 1.1.2 (2026-10-06)

- New target `selenium-java-testng`: Selenium WebDriver + TestNG (`@BeforeMethod`, `@AfterMethod(alwaysRun = true)`, `@Test`), sharing `TestgenSupport.java` with `selenium-java`. Sample project in `e2e/projects/selenium-java-testng`.
- New `--log-steps` (the **Log steps** field in the UI): Java tests log each step with its values and the result of each assertion (`passed` / `FAILED`). TestNG logs through `Reporter.log`, JUnit prints to the console. In logs and error messages, pages opened later (popups) are called `page1`, `page2`…, matching the variable names in the test.
- New `--data-driven` (the **Data-driven (CSV)** field): typed, selected and asserted values become columns of `<Name>Test.csv`, placed in `src/test/resources/<package>/`. The test runs once per row, through `@DataProvider` (TestNG) or `@ParameterizedTest` (JUnit). An existing CSV file is never overwritten.
- `TestgenSupport.readCsv(...)` reads UTF-8 CSV with or without a BOM, separated by commas or semicolons.
- `testgen targets` aligns its columns to the longest id.

## 1.1.1 (2026-10-06)

- The generated code always uses the test id attribute the recording used. Before, changing **Test id attribute** in the UI after recording, or passing a different `--test-id-attribute` to `testgen generate`, made `getByTestId(...)` look up the wrong attribute. Now the UI shows a note when this field differs from the recording, and `testgen generate` tells you when it ignores the option.
- README: new section on how the recorder picks locators and how to handle multilingual sites (i18n).

## 1.1.0 (2026-10-06)

- Recording no longer opens the Playwright Inspector window, only the browser you are working in. View the code in the testgen UI or in the generated files.
- New `testgen record --inspector` to show the Inspector again when needed.

## 1.0.0 (2026-10-05)

- First release. Records actions with Playwright's recorder and generates tests for `playwright-ts`, `playwright-go`, `selenium-java` and `selenium-js`.
- Web UI (`testgen ui`) that shows the code for every target while you record.
