mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-22 06:04:40 +03:00
d1520cf08d
- Only prepare repositories once. - Move the repositories to temporary directories (these should usually be stored in memory) which are recreated for each test to avoid persistentance between tests. Doing some dirty profiling suggests that the preparing test functions from 140-100ms to 70-40ms
30 lines
993 B
Go
30 lines
993 B
Go
// Copyright 2024 The Forgejo Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package integration
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
|
|
"code.gitea.io/gitea/tests"
|
|
)
|
|
|
|
func TestEasyMDESwitch(t *testing.T) {
|
|
defer tests.PrepareTestEnv(t)()
|
|
session := loginUser(t, "user2")
|
|
testEasyMDESwitch(t, session, "user2/glob/issues/1", false)
|
|
testEasyMDESwitch(t, session, "user2/glob/issues/new", false)
|
|
testEasyMDESwitch(t, session, "user2/glob/wiki?action=_new", true)
|
|
testEasyMDESwitch(t, session, "user2/glob/releases/new", true)
|
|
testEasyMDESwitch(t, session, "user2/glob/milestones/new", true)
|
|
testEasyMDESwitch(t, session, "user2/repo1/milestones/1/edit", true)
|
|
}
|
|
|
|
func testEasyMDESwitch(t *testing.T, session *TestSession, url string, expected bool) {
|
|
t.Helper()
|
|
req := NewRequest(t, "GET", url)
|
|
resp := session.MakeRequest(t, req, http.StatusOK)
|
|
doc := NewHTMLParser(t, resp.Body)
|
|
doc.AssertElement(t, ".combo-markdown-editor button.markdown-switch-easymde", expected)
|
|
}
|