| 1 |
package e2e_test |
| 2 |
|
| 3 |
import ( |
| 4 |
"net/url" |
| 5 |
"os" |
| 6 |
"time" |
| 7 |
|
| 8 |
"github.com/onsi/ginkgo/v2" |
| 9 |
"github.com/onsi/gomega" |
| 10 |
|
| 11 |
"github.com/nicholas-fedor/shoutrrr/internal/testutils" |
| 12 |
"github.com/nicholas-fedor/shoutrrr/pkg/services/chat/discord" |
| 13 |
"github.com/nicholas-fedor/shoutrrr/pkg/types" |
| 14 |
) |
| 15 |
|
| 16 |
var _ = ginkgo.Describe("Discord E2E Complex Combination Test", func() { |
| 17 |
ginkgo.When("running e2e tests", func() { |
| 18 |
ginkgo.It("should send complex combination (embed with all features)", func() { |
| 19 |
envURL := os.Getenv("SHOUTRRR_DISCORD_URL") |
| 20 |
if envURL == "" { |
| 21 |
ginkgo.Skip("SHOUTRRR_DISCORD_URL not set, skipping complex combination test") |
| 22 |
|
| 23 |
return |
| 24 |
} |
| 25 |
|
| 26 |
serviceURL, _ := url.Parse(envURL) |
| 27 |
service := &discord.Service{} |
| 28 |
err := service.Initialize(serviceURL, testutils.TestLogger()) |
| 29 |
gomega.Expect(err).NotTo(gomega.HaveOccurred()) |
| 30 |
|
| 31 |
items := []types.MessageItem{ |
| 32 |
{ |
| 33 |
Text: "E2E Test: Complex combination - embed with all features", |
| 34 |
Level: types.Info, |
| 35 |
Timestamp: time.Now(), |
| 36 |
Fields: []types.Field{ |
| 37 |
{Key: "embed_author_name", Value: "Shoutrrr E2E Test"}, |
| 38 |
{ |
| 39 |
Key: "embed_author_url", |
| 40 |
Value: "https://github.com/nicholas-fedor/shoutrrr", |
| 41 |
}, |
| 42 |
{ |
| 43 |
Key: "embed_author_icon_url", |
| 44 |
Value: "https://raw.githubusercontent.com/nicholas-fedor/shoutrrr/master/docs/assets/media/shoutrrr-180px.png", |
| 45 |
}, |
| 46 |
{ |
| 47 |
Key: "embed_image_url", |
| 48 |
Value: "https://raw.githubusercontent.com/nicholas-fedor/shoutrrr/master/docs/assets/media/shoutrrr-logotype.png", |
| 49 |
}, |
| 50 |
{ |
| 51 |
Key: "embed_thumbnail_url", |
| 52 |
Value: "https://raw.githubusercontent.com/nicholas-fedor/shoutrrr/master/docs/assets/media/shoutrrr-180px.png", |
| 53 |
}, |
| 54 |
{Key: "Status", Value: "Complex Test"}, |
| 55 |
{Key: "Features", Value: "Author, Images, Fields, Timestamp"}, |
| 56 |
{Key: "Level", Value: "Info"}, |
| 57 |
}, |
| 58 |
}, |
| 59 |
} |
| 60 |
err = service.SendItems(items, nil) |
| 61 |
gomega.Expect(err).NotTo(gomega.HaveOccurred()) |
| 62 |
}) |
| 63 |
}) |
| 64 |
}) |