Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(autoedit): Add more E2E test scenarios #6573

Merged
merged 7 commits into from
Jan 13, 2025
Merged

feat(autoedit): Add more E2E test scenarios #6573

merged 7 commits into from
Jan 13, 2025

Conversation

umpox
Copy link
Contributor

@umpox umpox commented Jan 9, 2025

Description

closes https://linear.app/sourcegraph/issue/CODY-4617/improve-e2e-tests-to-cover-more-cases

Covers different rendering logic cases for:

  • Inline decorations
  • Inline completions
  • Suffix decorations

Test plan

This PR adds tests, and is tested by running the tests and verifying the results

@umpox umpox marked this pull request as ready for review January 9, 2025 13:37
@umpox
Copy link
Contributor Author

umpox commented Jan 9, 2025

Going to iterate on these for additional telemetry testing but will do so in a follow up branch

width: 1024,
height: 741,
width: 1920,
height: 1080,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Curious if we chaging the view port results in some improvements. I set these values arbitrary but can we add a small comment if we think there is any preferred view port size.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It makes it possible to see the diff on some lines (e.g. a line where there are two separate insertion decorations)

I'll leave a comment here :)

})

it.only('first hunk', () => {
expect(citationSubstring(`hello("world") // comment`, `hello("world", 32, "goodbye")`)).toStrictEqual(`hello("world")`)
Copy link
Contributor

Choose a reason for hiding this comment

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

@umpox I this this example creates a very small ghost text and when I was testing it last time, I observed that such small diffs are not detected because we set certain maxDiffPixelRatio: 0.02 in the snapshot testing.
So, just wanted to cross check if we are actually able to detect such minor changes in the testing. (for eg: if I just replace the image with no decoration as ground truth, will the test still pass ?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for raising @hitesh-1997. This test fails if I remove the decoration, but I did notice two of the tests still pass.

I've adjusted the maxDiffPixels from 1000 to 500, now all tests fail if I remove the decoration. I think we'll have to keep an eye out for this in future so will leave some comments.

Tests seem stable on my machine, but running 100 times in CI to check for any flakiness

Copy link
Contributor

Choose a reason for hiding this comment

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

That's awesome !!
Thanks for looking into this Tom, approving to unblock.

Copy link
Contributor

@hitesh-1997 hitesh-1997 left a comment

Choose a reason for hiding this comment

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

This is so awesome !! Thanks for adding these test cases @umpox !!
Mostly changes looks good to me, just wanted to check if are are actually detecting regression in certain tests (particularly the ones which have very small diff) or will they just pass by default even if they are broken ?

Copy link
Member

@valerybugakov valerybugakov left a comment

Choose a reason for hiding this comment

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

This is awesome! I feel safe now.

Comment on lines +236 to +238
* Linear issue: https://linear.app/sourcegraph/issue/CODY-4650/fix-rendering-issues-with-suffix-suggestions-at-the-end-of-a-file
* Expected behaviour: We do not show any suggestion, as there is not enough room in the file to show the full decorations..
* Actual behaviour: We *do* hide the suffix decorations, but we still show the deletion decorations.
Copy link
Member

Choose a reason for hiding this comment

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

🙏

@umpox umpox merged commit 52e0b0b into main Jan 13, 2025
21 checks passed
@umpox umpox deleted the tr/e2e-autoedits branch January 13, 2025 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants