forgejo/tests/integration/notification_test.go
Minecon724 5016926d01
Some checks are pending
/ release (push) Waiting to run
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-e2e (push) Blocked by required conditions
testing / test-remote-cacher (redis) (push) Blocked by required conditions
testing / test-remote-cacher (valkey) (push) Blocked by required conditions
testing / test-remote-cacher (garnet) (push) Blocked by required conditions
testing / test-remote-cacher (redict) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions
Just merg
2025-03-29 20:14:01 +01:00

32 lines
975 B
Go

// Copyright 2024 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: GPL-3.0-or-later
package integration
import (
"net/http"
"testing"
"forgejo.org/models/unittest"
user_model "forgejo.org/models/user"
"forgejo.org/tests"
)
func TestNotification(t *testing.T) {
defer tests.PrepareTestEnv(t)()
user2 := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})
session := loginUser(t, user2.Name)
req := NewRequest(t, "GET", "/notifications")
resp := session.MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
// Unread and pinned notification.
htmlDoc.AssertElement(t, ".notifications-link[href='/user2/repo1/pulls/3']", true)
htmlDoc.AssertElement(t, ".notifications-link[href='/user2/repo1/issues/4']", true)
htmlDoc.AssertElement(t, ".notifications-link[href='/user2/repo2/issues/1']", true)
// Read notification.
htmlDoc.AssertElement(t, ".notifications-link[href='/user2/repo2/pulls/2']", false)
}