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

added support for Attachments (aka Embedddings) #623

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Johnlon
Copy link
Member

@Johnlon Johnlon commented May 8, 2024

🤔 What's changed?

The cucumber and events formatters support the inclusion of Attachments.

The proposed API is demonstrated in the tests as ...

func stepWithAttachment(ctx context.Context) (context.Context, error) {
    ctxOut := godog.Attach(ctx,
	godog.Attachment{Body: []byte("TheData1"), FileName: "TheFilename1", MediaType: "text/plain"},
	godog.Attachment{Body: []byte("TheData2"), FileName: "TheFilename2", MediaType: "text/plain"},
    )

    return ctxOut, nil
}

⚡️ What's your motivation?

#617

Want support for Attachments from steps.
This PR proposes to use the context.Context object as a means to attach content from the step.

🏷️ What kind of change is this?

  • ⚡ New feature (non-breaking change which adds new behaviour)

♻️ Anything particular you want feedback on?

This change involves minimal changes to patterns of use of godog API's.

I added tests for the cuke and events formats but the coverage isn't being recorded even on some lines I didn't modify.

fmt_output_test.go now has a normalise() fn that eliminates some extraneous diffs in the actual/expected files such as line endings and also line numbers so that the tests are easier to maintain and cross platform,

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • [ x] I've changed the behaviour of the code
    • [ x] I have added/updated tests to cover my changes.
  • [ x] My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

Copy link

codecov bot commented May 8, 2024

Codecov Report

Attention: Patch coverage is 88.70968% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 79.69%. Comparing base (153db4e) to head (2d66c72).
Report is 8 commits behind head on main.

Current head 2d66c72 differs from pull request most recent head a8f193f

Please upload reports for the commit a8f193f to get more accurate results.

Files Patch % Lines
suite.go 81.25% 5 Missing and 1 partial ⚠️
internal/models/results.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #623      +/-   ##
==========================================
- Coverage   83.21%   79.69%   -3.52%     
==========================================
  Files          28       40      +12     
  Lines        3413     3113     -300     
==========================================
- Hits         2840     2481     -359     
- Misses        458      513      +55     
- Partials      115      119       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Johnlon and others added 9 commits May 16, 2024 17:43
… formats - done by sneaking the attachment into the context.Context object (but not letting that context value propagate into the next step, so it's kinda bending the context.Context purpose)
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.

None yet

3 participants