chore: fix flaky pv meter and soc range tests (#30570)

This commit is contained in:
Michael Geers 2026-06-06 18:07:00 +02:00 • committed by GitHub
parent abc66802ad
commit 8a2c8c56dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View file

@ -96,8 +96,12 @@ export default defineComponent({
this.$emit("opened");
if (this.autofocus) {
this.$nextTick(() => {
const firstInput =
this.$refs["modalBody"]?.querySelector("input, select, button");
const modalBody = this.$refs["modalBody"];
// don't steal focus if user already interacts with the modal content
if (modalBody?.contains(document.activeElement)) {
return;
}
const firstInput = modalBody?.querySelector("input, select, button");
if (firstInput instanceof HTMLElement) {
firstInput.focus();
}

View file

@ -49,7 +49,8 @@ export function simulatorConfig() {
const input = "./tests/simulator.evcc.yaml";
const content = fs.readFileSync(input, "utf8");
const result = content.replace(/localhost:7072/g, simulatorHost());
const resultName = "simulator.evcc.generated.yaml";
// per-worker file name, multiple workers write their own port concurrently
const resultName = `simulator-${workerPort()}.evcc.generated.yaml`;
const resultPath = path.join(os.tmpdir(), resultName);
fs.writeFileSync(resultPath, result);
return resultPath;