mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-11-01 15:01:03 +00:00
chore: refactor the web UI tests for the actions run
- create tests/integration/actions_view_test.go
- extract TestActionsArtifactDeletion from actions_route_test.go
- extract tests misplaced in
- api_actions_artifact_test.go
- api_actions_artifact_v4_test.go
- add a tests for the /{owner}/{repo}/actions/runs/{run_index}/artifacts
because it is useful for debugging
This commit is contained in:
parent
014bf73db8
commit
f7b0eb16c8
4 changed files with 88 additions and 60 deletions
|
|
@ -146,38 +146,3 @@ func TestActionsWebRouteLatestRun(t *testing.T) {
|
|||
assert.Equal(t, workflow.HTMLURL(), resp.Header().Get("Location"))
|
||||
})
|
||||
}
|
||||
|
||||
func TestActionsWebRouteArtifactDeletion(t *testing.T) {
|
||||
onGiteaRun(t, func(t *testing.T, u *url.URL) {
|
||||
user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
|
||||
|
||||
// create the repo
|
||||
repo, _, f := tests.CreateDeclarativeRepo(t, user2, "",
|
||||
[]unit_model.Type{unit_model.TypeActions}, nil,
|
||||
[]*files_service.ChangeRepoFile{
|
||||
{
|
||||
Operation: "create",
|
||||
TreePath: ".gitea/workflows/pr.yml",
|
||||
ContentReader: strings.NewReader("name: test\non:\n push:\njobs:\n test:\n runs-on: ubuntu-latest\n steps:\n - run: echo helloworld\n"),
|
||||
},
|
||||
},
|
||||
)
|
||||
defer f()
|
||||
|
||||
// a run has been created
|
||||
assert.Equal(t, 1, unittest.GetCount(t, &actions_model.ActionRun{RepoID: repo.ID}))
|
||||
|
||||
// Load the run we just created
|
||||
run := unittest.AssertExistsAndLoadBean(t, &actions_model.ActionRun{RepoID: repo.ID})
|
||||
err := run.LoadAttributes(t.Context())
|
||||
require.NoError(t, err)
|
||||
|
||||
// Visit it's web view
|
||||
req := NewRequest(t, "GET", run.HTMLURL())
|
||||
resp := MakeRequest(t, req, http.StatusOK)
|
||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||
|
||||
// Assert that the artifact deletion markup exists
|
||||
htmlDoc.AssertElement(t, "[data-locale-confirm-delete-artifact]", true)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue