Skip to content

Commit

Permalink
Use godog attachments (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
vearutop authored Oct 31, 2024
1 parent dd0ad9a commit fe947a7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
13 changes: 13 additions & 0 deletions formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ func (f *formatter) argumentAttachment(st *godog.Step) *report.Attachment {
log.Fatal(err)
}

att.Name = "argument value"

return att
} else if st.Argument.DataTable != nil {
var table [][]string
Expand All @@ -166,6 +168,8 @@ func (f *formatter) argumentAttachment(st *godog.Step) *report.Attachment {
log.Fatal(err)
}

att.Name = "argument table"

return att
}

Expand All @@ -178,10 +182,19 @@ func (f *formatter) step(sc *godog.Scenario, st *godog.Step, status report.Statu
c := f.scenarios[sc]
c.finishedSteps++

pickleStepResult := f.Storage.MustGetPickleStepResult(st.Id)

step := report.StepFinished(c.result, st.Text, status, statusDetails, func(s *report.Step) {
if att := f.argumentAttachment(st); att != nil {
s.Attachments = append(s.Attachments, *att)
}

for _, a := range pickleStepResult.Attachments {
if att, err := f.BytesAttachment(a.Data, a.MimeType); err == nil && att != nil {
att.Name = a.Name
s.Attachments = append(s.Attachments, *att)
}
}
}, c.lastTime)

f.LastTime = step.Stop
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

require (
github.com/bool64/dev v0.2.35
github.com/cucumber/godog v0.14.1
github.com/cucumber/godog v0.15.0
github.com/google/uuid v1.6.0
github.com/stretchr/testify v1.8.2
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ github.com/bool64/dev v0.2.35/go.mod h1:iJbh1y/HkunEPhgebWRNcs8wfGq7sjvJ6W5iabL8
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/cucumber/gherkin/go/v26 v26.2.0 h1:EgIjePLWiPeslwIWmNQ3XHcypPsWAHoMCz/YEBKP4GI=
github.com/cucumber/gherkin/go/v26 v26.2.0/go.mod h1:t2GAPnB8maCT4lkHL99BDCVNzCh1d7dBhCLt150Nr/0=
github.com/cucumber/godog v0.14.1 h1:HGZhcOyyfaKclHjJ+r/q93iaTJZLKYW6Tv3HkmUE6+M=
github.com/cucumber/godog v0.14.1/go.mod h1:FX3rzIDybWABU4kuIXLZ/qtqEe1Ac5RdXmqvACJOces=
github.com/cucumber/godog v0.15.0 h1:51AL8lBXF3f0cyA5CV4TnJFCTHpgiy+1x1Hb3TtZUmo=
github.com/cucumber/godog v0.15.0/go.mod h1:FX3rzIDybWABU4kuIXLZ/qtqEe1Ac5RdXmqvACJOces=
github.com/cucumber/messages/go/v21 v21.0.1 h1:wzA0LxwjlWQYZd32VTlAVDTkW6inOFmSM+RuOwHZiMI=
github.com/cucumber/messages/go/v21 v21.0.1/go.mod h1:zheH/2HS9JLVFukdrsPWoPdmUtmYQAQPLk7w5vWsk5s=
github.com/cucumber/messages/go/v22 v22.0.0/go.mod h1:aZipXTKc0JnjCsXrJnuZpWhtay93k7Rn3Dee7iyPJjs=
Expand Down

0 comments on commit fe947a7

Please sign in to comment.