diff options
author | yp05327 <576951401@qq.com> | 2024-03-14 10:37:15 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-14 01:37:15 +0000 |
commit | 2da13675c0cfdc531044553636c3b74f2fda3eb4 (patch) | |
tree | 06b038f45ec567470de832c275e22a5887a9bf01 /tests/integration/repo_webhook_test.go | |
parent | 43de021ac1ca017212ec75fd88a8a80a9db27c4c (diff) | |
download | gitea-2da13675c0cfdc531044553636c3b74f2fda3eb4.tar.gz gitea-2da13675c0cfdc531044553636c3b74f2fda3eb4.zip |
Fix incorrect menu/link on webhook edit page (#29709)
Fix #29699
---------
Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'tests/integration/repo_webhook_test.go')
-rw-r--r-- | tests/integration/repo_webhook_test.go | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/integration/repo_webhook_test.go b/tests/integration/repo_webhook_test.go new file mode 100644 index 0000000000..ef44a9e2d0 --- /dev/null +++ b/tests/integration/repo_webhook_test.go @@ -0,0 +1,41 @@ +// Copyright 2024 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package integration + +import ( + "net/http" + "strings" + "testing" + + "code.gitea.io/gitea/tests" + + "github.com/PuerkitoBio/goquery" + "github.com/stretchr/testify/assert" +) + +func TestNewWebHookLink(t *testing.T) { + defer tests.PrepareTestEnv(t)() + session := loginUser(t, "user2") + + baseurl := "/user2/repo1/settings/hooks" + tests := []string{ + // webhook list page + baseurl, + // new webhook page + baseurl + "/gitea/new", + // edit webhook page + baseurl + "/1", + } + + for _, url := range tests { + resp := session.MakeRequest(t, NewRequest(t, "GET", url), http.StatusOK) + htmlDoc := NewHTMLParser(t, resp.Body) + menus := htmlDoc.doc.Find(".ui.top.attached.header .ui.dropdown .menu a") + menus.Each(func(i int, menu *goquery.Selection) { + url, exist := menu.Attr("href") + assert.True(t, exist) + assert.True(t, strings.HasPrefix(url, baseurl)) + }) + } +} |