···11// Copyright 2021 The Gitea Authors. All rights reserved.
22+// Copyright 2024 The Forgejo Authors. All rights reserved.
23// SPDX-License-Identifier: MIT
3445package integration
···2021 user_model "code.gitea.io/gitea/models/user"
2122 "code.gitea.io/gitea/modules/setting"
2223 "code.gitea.io/gitea/modules/structs"
2424+ "code.gitea.io/gitea/modules/translation"
2325 "code.gitea.io/gitea/services/migrations"
2426 "code.gitea.io/gitea/services/repository"
2527···8890 resp := session.MakeRequest(t, req, http.StatusOK)
8991 // Step 2: load the form
9092 htmlDoc := NewHTMLParser(t, resp.Body)
9393+ // Check form title
9494+ title := htmlDoc.doc.Find("title").Text()
9595+ assert.Contains(t, title, translation.NewLocale("en-US").TrString("new_migrate.title"))
9696+ // Get the link of migration button
9197 link, exists := htmlDoc.doc.Find(`form.ui.form[action^="/repo/migrate"]`).Attr("action")
9298 assert.True(t, exists, "The template has changed")
9399 // Step 4: submit the migration to only migrate issues
···5566import (
77 "net/http"
88+ "strings"
89 "testing"
9101111+ "code.gitea.io/gitea/modules/translation"
1012 "code.gitea.io/gitea/tests"
1313+1414+ "github.com/stretchr/testify/assert"
1115)
12161317// This test makes sure that organization members are able to navigate between `/<orgname>` and `/org/<orgname>/<section>` freely.
···1822// owners/admins/members of the organization.
1923func TestOrgNavigationDashboard(t *testing.T) {
2024 defer tests.PrepareTestEnv(t)()
2525+2626+ locale := translation.NewLocale("en-US")
21272228 // Login as the future organization admin and create an organization
2329 session1 := loginUser(t, "user2")
···3238 resp := session1.MakeRequest(t, NewRequest(t, "GET", "/org_navigation_test"), http.StatusOK)
3339 doc := NewHTMLParser(t, resp.Body)
3440 doc.AssertElement(t, "#org-info a[href='/org/org_navigation_test/dashboard']", true)
4141+4242+ // Verify the "New repository" and "New migration" buttons
4343+ links := doc.Find(".organization.profile .grid .column .center")
4444+ assert.EqualValues(t, locale.TrString("new_repo.link"), strings.TrimSpace(links.Find("a[href^='/repo/create?org=']").Text()))
4545+ assert.EqualValues(t, locale.TrString("new_migrate.link"), strings.TrimSpace(links.Find("a[href^='/repo/migrate?org=']").Text()))
35463647 // Check if the "View <orgname>" button is available on dashboard for the org admin (member)
3748 resp = session1.MakeRequest(t, NewRequest(t, "GET", "/org/org_navigation_test/dashboard"), http.StatusOK)
+11
tests/integration/repo_generate_test.go
···11// Copyright 2019 The Gitea Authors. All rights reserved.
22+// Copyright 2024 The Forgejo Authors. All rights reserved.
23// SPDX-License-Identifier: MIT
3445package integration
···1314 "code.gitea.io/gitea/models/unittest"
1415 user_model "code.gitea.io/gitea/models/user"
1516 "code.gitea.io/gitea/modules/setting"
1717+ "code.gitea.io/gitea/modules/translation"
1618 "code.gitea.io/gitea/tests"
17191820 "github.com/stretchr/testify/assert"
···2123func assertRepoCreateForm(t *testing.T, htmlDoc *HTMLDoc, owner *user_model.User, templateID string) {
2224 _, exists := htmlDoc.doc.Find("form.ui.form[action^='/repo/create']").Attr("action")
2325 assert.True(t, exists, "Expected the repo creation form")
2626+ locale := translation.NewLocale("en-US")
2727+2828+ // Verify page title
2929+ title := htmlDoc.doc.Find("title").Text()
3030+ assert.Contains(t, title, locale.TrString("new_repo.title"))
3131+3232+ // Verify form header
3333+ header := strings.TrimSpace(htmlDoc.doc.Find(".form[action='/repo/create'] .header").Text())
3434+ assert.EqualValues(t, locale.TrString("new_repo.title"), header)
24352536 htmlDoc.AssertDropdownHasSelectedOption(t, "uid", strconv.FormatInt(owner.ID, 10))
2637