2017-08-17 12:20:21 +00:00
|
|
|
// Copyright 2017 The Gitea Authors. All rights reserved.
|
2022-11-27 18:20:29 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2017-08-17 12:20:21 +00:00
|
|
|
|
2022-09-02 19:18:23 +00:00
|
|
|
package integration
|
2017-08-17 12:20:21 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
2022-09-02 19:18:23 +00:00
|
|
|
|
|
|
|
"code.gitea.io/gitea/tests"
|
2024-03-06 10:15:38 +00:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2017-08-17 12:20:21 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestExploreRepos(t *testing.T) {
|
2022-09-02 19:18:23 +00:00
|
|
|
defer tests.PrepareTestEnv(t)()
|
2017-08-17 12:20:21 +00:00
|
|
|
|
|
|
|
req := NewRequest(t, "GET", "/explore/repos")
|
|
|
|
MakeRequest(t, req, http.StatusOK)
|
2024-03-06 10:15:38 +00:00
|
|
|
|
|
|
|
t.Run("Persistent parameters", func(t *testing.T) {
|
|
|
|
defer tests.PrintCurrentTest(t)()
|
|
|
|
|
|
|
|
req := NewRequest(t, "GET", "/explore/repos?topic=1&language=Go")
|
|
|
|
resp := MakeRequest(t, req, http.StatusOK)
|
|
|
|
htmlDoc := NewHTMLParser(t, resp.Body).Find("#repo-search-form")
|
|
|
|
|
|
|
|
assert.EqualValues(t, "Go", htmlDoc.Find("input[name='language']").AttrOr("value", "not found"))
|
|
|
|
assert.EqualValues(t, "true", htmlDoc.Find("input[name='topic']").AttrOr("value", "not found"))
|
|
|
|
})
|
2017-08-17 12:20:21 +00:00
|
|
|
}
|