Skip to content

9527 autotests get rid of clickinthemiddleofthescreen function#9982

Merged
AlexeyGirin merged 181 commits into
masterfrom
9527-autotests-get-rid-of-clickinthemiddleofthescreen-function
May 20, 2026
Merged

9527 autotests get rid of clickinthemiddleofthescreen function#9982
AlexeyGirin merged 181 commits into
masterfrom
9527-autotests-get-rid-of-clickinthemiddleofthescreen-function

Conversation

@YatsekTest
Copy link
Copy Markdown
Collaborator

@YatsekTest YatsekTest commented May 7, 2026

How the feature works? / How did you fix the issue?

(Screenshots, videos, or GIFs, if applicable)

Check list

  • unit-tests written
  • e2e-tests written
  • documentation updated
  • PR name follows the pattern #1234 – issue name
  • branch name doesn't contain '#'
  • PR is linked with the issue
  • base branch (master or release/xx) is correct
  • task status changed to "Code review"
  • reviewers are notified about the pull request

…totests-get-rid-of-clickinthemiddleofthescreen-function
…totests-get-rid-of-clickinthemiddleofthescreen-function
…totests-get-rid-of-clickinthemiddleofthescreen-function
…totests-get-rid-of-clickinthemiddleofthescreen-function
…Canvas in InChi.spec.ts and ket-v2-text-formatting.spec.ts
…totests-get-rid-of-clickinthemiddleofthescreen-function
…totests-get-rid-of-clickinthemiddleofthescreen-function
…anvas in Aromatize/Dearomatize and Calculate CIP Tool tests
…anvas in Clean Tools and Enhanced Stereochemistry tests
…anvas in add-fragment and get-ket tests; update expected hydrogen location in selected-hydrogen-expected.ket
…anvas in set-molecule, set-zoom, and erase-tool tests
…totests-get-rid-of-clickinthemiddleofthescreen-function
- Updated binary image snapshots for R-group fragment tool tests to reflect recent changes in the UI and functionality.
- Modified expected .mol files for V2000 and V3000 formats to correct atom coordinates and ensure consistency with the latest structure generation logic.
- Adjusted expected reaction files for V2000 and V3000 formats to align with the updated R-group handling and atom positioning.
- Ensured all changes maintain compatibility with existing test cases and improve overall test accuracy.
…totests-get-rid-of-clickinthemiddleofthescreen-function
@YatsekTest
Copy link
Copy Markdown
Collaborator Author

@copilot Investigate (only — no fixes are needed!) the causes of the test failures in the latest CI run. Compile a list of failed tests and, separately, the files in which these tests are located, including the total number of failed tests and affected files. Analyze and generalize the root causes of the test failures.

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

@copilot Investigate (only — no fixes are needed!) the causes of the test failures in the latest CI run. Compile a list of failed tests and, separately, the files in which these tests are located, i...

Investigation of the latest CI run (SHA ca4feccfb68f, May 19, 2026).


Summary

Workflow Parts failed Permanently failed Flaky
FullScale 2 of 6 101 2
Popup 1 of 1 2 18
Total 103 20

Failed tests — complete list

FullScale — Part (1, 6): 29 failed, 2 flaky

# Test (file:line) Error type
1 Bugs/ketcher-2.28.0-bugs.spec.ts:391 — Case 13: Export to ket change incrementally IDs toEqual — coord shift
2 CDX-Files/cdx-files.spec.ts:31 — opening cdx files with R-group screenshot ratio 0.01
3 CDX-Files/cdx-files.spec.ts:56 — Open from .cdx file with contracted annotation screenshot ratio 0.01
4 CDX-Files/cdx-files.spec.ts:76 — Open from .cdx file with contracted annotation #2 screenshot ratio 0.01
5–16 CDX-Files/cdx-files.spec.ts:99–319 — CDX files without screenshots (12 tests) toEqual — coord shift
17–29 CDXML-Files/cdxml-files.spec.ts:157–419 — Tests for API setMolecule/getMolecule (13 tests) toEqual — coord shift

2 flaky: calculated-values.spec.ts, toggle-explicit-hydrogens.spec.ts — timing/infra, not PR-related.

FullScale — Part (6, 6): 72 failed

# Test (file:line) Error type
1 Mapping-Unmapping tool/mapping-tool.spec.ts:144 — Save as *.rxn file toEqual — coord shift
2–27 Attachment-Point-Tool/attachment-point-tool.spec.ts — 26 tests (lines 98–789) screenshot ratio 0.01
28–52 Rotation/rotation.spec.ts — 25 tests (lines 28–808) screenshot ratio 0.01
53–71 Data-S-Group-Tool/data-s-group-tool.spec.ts — 19 tests (lines 52–480) screenshot ratio 0.01 (earlier cases) / toEqual coord shift (later cases, e.g. line 480)
72 SRU-Polymer/sru-polymer-tool.spec.ts:286 — SRU Polymer toEqual — coord shift

Popup — Part (1, 1): 2 failed, 18 flaky

# Test (file:line) Error type
1 Chromium-popup/Bugs/ketcher-2.28.0-bugs.spec.ts:388 — Case 13: Export to ket toEqual — coord shift
2 Chromium-popup/Bugs/ketcher-3.11.0-bugs.spec.ts:849 — Case 22: Context menu after cyclic structure screenshot ratio 0.01

18 flaky tests all passed on retry — timing/infra issues, unrelated to this PR.


Affected spec files (9 unique)

Spec file Failures
Bugs/ketcher-2.28.0-bugs.spec.ts 1
CDX-Files/cdx-files.spec.ts 15
CDXML-Files/cdxml-files.spec.ts 13
Attachment-Point-Tool/attachment-point-tool.spec.ts 26
Rotation/rotation.spec.ts 25
Data-S-Group-Tool/data-s-group-tool.spec.ts 19
Mapping-Unmapping tool/mapping-tool.spec.ts 1
SRU-Polymer/sru-polymer-tool.spec.ts 1
Chromium-popup/Bugs/ketcher-2.28.0-bugs.spec.ts 1
Chromium-popup/Bugs/ketcher-3.11.0-bugs.spec.ts 1

(The ketcher-2.28.0 test appears in both FullScale and Popup suites as separate file paths, so 10 file paths total, 9 distinct spec names.)


Root cause analysis

All 103 failures fall into two failure types that share a single root cause:

Root cause: clickInTheMiddleOfTheCanvas places structures at a y-position ~0.025 canvas units higher than clickInTheMiddleOfTheScreen did.

clickInTheMiddleOfTheScreen clicked at the absolute center of the viewport/body. clickInTheMiddleOfTheCanvas clicks at the center of the <canvas> element, which is offset downward from the viewport top by the toolbar height. The canvas coordinate system converts this pixel offset into ~0.025 Angstrom-like units in the y-axis, shifting every placed structure upward by that amount.

Failure type 1 — Screenshot mismatch (ratio 0.01)

Affects 80 tests across attachment-point-tool, rotation, data-s-group-tool, cdx-files, and ketcher-3.11.0-bugs (Case 22).
Every screenshot failure has a ratio of exactly 0.01 (~590–5050 pixels out of ~50k–500k total). The rendered molecule is shifted ~0.025 units upward relative to the baseline snapshot, producing a ~1% pixel difference.

Failure type 2 — File-comparison coordinate shift (toEqual)

Affects 23 tests across ketcher-2.28.0-bugs (Case 13), cdx-files (12 tests), cdxml-files (13 tests), data-s-group-tool (some), sru-polymer-tool, and mapping-tool.
When the exported MOL/KET/RXN/JSON content is compared to the stored expected file, every y-coordinate in the received output is shifted by exactly +0.025 units (e.g., expected -7.7500, received -7.7250; expected -8.0, received -7.975). The x-coordinates are unaffected, confirming the shift is purely in the y-axis and matches the toolbar-height offset introduced by switching to canvas-center clicks.

- Updated the expected .mol files for V2000 and V3000 formats to adjust atomic coordinates for better alignment.
- Modified reaction files to reflect changes in atom positions and identifiers.
- Ensured that all changes maintain the integrity of the molecular structures while improving readability and accuracy.
…totests-get-rid-of-clickinthemiddleofthescreen-function
@YatsekTest
Copy link
Copy Markdown
Collaborator Author

@copilot Investigate and analize (only — no fixes are needed!) the causes of the test failures in the latest CI run.

Copy link
Copy Markdown
Contributor

Copilot AI commented May 20, 2026

@copilot Investigate and analize (only — no fixes are needed!) the causes of the test failures in the latest CI run.

Investigation of the latest CI run (SHA 6c822cf30e0d, May 20, 2026).


Summary — significant improvement vs. previous run

Workflow Parts failed Permanently failed Flaky
FullScale (6 parts) 1 of 6 1 3
Popup (1 part) 1 of 1 1 21
Total 2 24

This is a major reduction from the previous run (103 permanently failed → 2).


Permanently failed tests (2)

Both failures are the same test in both suites:

Suite File:line Test name Error type
FullScale tests/specs/Bugs/ketcher-2.28.0-bugs.spec.ts:391 Case 13: Export to ket (and getKET function) change incrementally internal IDs toEqual — y-coordinate shift
Popup tests/specs/Chromium-popup/Bugs/ketcher-2.28.0-bugs.spec.ts:388 Case 13 (same test) toEqual — y-coordinate shift

Affected spec files: 1 (ketcher-2.28.0-bugs.spec.ts)


Flaky tests (24 total — all passed on retry)

FullScale — 3 flaky (all timing/infra, unrelated to this PR)

  • Bugs/ketcher-3.4.0-bugs.spec.ts:630 — Case 23 (timing)
  • Indigo-Tools/Calculated-Values-Tool/calculated-values.spec.ts:135 — timing
  • Indigo-Tools/Toggle-Explicit-Hydrogens/toggle-explicit-hydrogens.spec.ts:600 — timing

Popup — 21 flaky

Type Tests
Screenshot ratio 0.01 ketcher-3.11.0-bugs.spec.ts:1377, color-of-nucleobases.spec.ts:193 (×2), color-of-nucleobases.spec.ts:248 (×3), color-of-nucleobases.spec.ts:269, 8852-preset-structure-additions.spec.ts:212
Screenshot ratio 0.02 ketcher-3.11.0-bugs.spec.ts:945, monomer-creation3.spec.ts:989
Timeout (60 000 ms) ketcher-3.11.0-bugs.spec.ts:518, ketcher-3.11.0-bugs.spec.ts:849, ketcher-3.11.0-bugs.spec.ts:915, monomer-creation5.spec.ts:1424
Timeout (180 000 ms) loading-of-many-monomers.spec.ts:119
Element not visible ketcher-3.13.0-bugs.spec.ts:618
Screenshot size mismatch monomer-creation3.spec.ts:989 (ratio 0.02)

Root cause analysis

Permanent failures (2 tests)

Both are the same toEqual assertion failure in ketcher-2.28.0-bugs.spec.ts Case 13, which compares exported KET/JSON coordinate output to a stored expected file. The received y-coordinate is -7.9750000000000005 where -8 is expected — a shift of exactly +0.025 units. This is the same root cause identified in previous runs: clickInTheMiddleOfTheCanvas places the monomer 0.025 canvas units higher than clickInTheMiddleOfTheScreen did, because the canvas element is offset downward by the toolbar height. The expected file for this test has not yet been updated to match the new canvas-center placement.

Flaky screenshot mismatches (ratio 0.01–0.02)

The 9 flaky tests with screenshot ratio 0.01–0.02 are likely residual effects of the same y-shift: their baselines weren't updated, but the test passed on the second or third attempt due to minor run-to-run rendering variation. They are unstable and will likely fail permanently in a future run unless their baselines are regenerated.

Flaky timeouts and infra issues (12 tests)

Tests in ketcher-3.11.0-bugs.spec.ts, monomer-creation, and loading-of-many-monomers fail with 60 000 ms / 180 000 ms timeouts, element-not-visible errors, or small timeout (2000 ms) failures. These are pre-existing infrastructure/timing instabilities unrelated to this PR — they appear consistently as flaky across multiple runs.

@YatsekTest
Copy link
Copy Markdown
Collaborator Author

@copilot Try to fix those two failing tests.

Copy link
Copy Markdown
Contributor

Copilot AI commented May 20, 2026

@copilot Try to fix those two failing tests.

Fixed in commit 3e411654.

The actual failure in the latest CI run (SHA 57e79af4) was not a y-coordinate mismatch — that had already been corrected. The remaining error was that commit b12f9e3b0 had accidentally removed the "aliasBILN": "D" field from both expected KET files, while the app still outputs it (it was added to the app in master via commit 66e86b6c). Both tests (FullScale and Popup) were failing with:

- Expected  - 0
+ Received  + 1
+   "aliasBILN": "D",

The fix adds "aliasBILN": "D" back to both expected files.

@YatsekTest YatsekTest marked this pull request as ready for review May 20, 2026 18:15
@auto-assign auto-assign Bot requested a review from rrodionov91 May 20, 2026 18:15
@YatsekTest YatsekTest requested review from AlexeyGirin and Copilot May 20, 2026 18:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

Copy link
Copy Markdown
Collaborator

@AlexeyGirin AlexeyGirin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@AlexeyGirin AlexeyGirin merged commit 66f46d1 into master May 20, 2026
14 of 15 checks passed
@AlexeyGirin AlexeyGirin deleted the 9527-autotests-get-rid-of-clickinthemiddleofthescreen-function branch May 20, 2026 20:01
@YatsekTest YatsekTest restored the 9527-autotests-get-rid-of-clickinthemiddleofthescreen-function branch May 21, 2026 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants