Widen the app page, double its log heights and move the logs (closes #246)
Check / check (pull_request) Skipped
Check / check (pull_request) Skipped
The app page's content column is now at most 84rem wide instead of 56rem (max-w-4xl), set inline because the committed Tailwind CSS has no class for that width. The build log and container log boxes are 800px tall instead of 400px. The build log section moves to between the webhook URL and the environment variables, and the container log section moves to directly above the deploy key; nothing else moves. A new handler test renders the app page and checks the width, the section order and both log heights. Model: opus-5-5
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
package handlers_test
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"sneak.berlin/go/upaas/internal/service/app"
|
||||
)
|
||||
|
||||
// TestAppPageLayout checks the app page's width, the order of its sections,
|
||||
// and the height of its two log boxes.
|
||||
func TestAppPageLayout(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testCtx := setupTestHandlers(t)
|
||||
|
||||
createdApp, err := testCtx.appSvc.CreateApp(t.Context(), app.CreateAppInput{
|
||||
Name: "layout-app",
|
||||
RepoURL: "git@example.com:user/layout-app.git",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
request := httptest.NewRequestWithContext(
|
||||
t.Context(), http.MethodGet, "/apps/"+createdApp.ID, nil,
|
||||
)
|
||||
request = addChiURLParams(request, map[string]string{"id": createdApp.ID})
|
||||
recorder := httptest.NewRecorder()
|
||||
|
||||
testCtx.handlers.HandleAppDetail().ServeHTTP(recorder, request)
|
||||
|
||||
require.Equal(t, http.StatusOK, recorder.Code)
|
||||
|
||||
body := recorder.Body.String()
|
||||
|
||||
_, afterMain, found := strings.Cut(body, "<main")
|
||||
require.True(t, found, "app page has no main element")
|
||||
|
||||
mainTag, _, _ := strings.Cut(afterMain, ">")
|
||||
assert.Contains(t, mainTag, "max-width: 84rem;")
|
||||
|
||||
sectionTitles := []string{
|
||||
"Container Logs",
|
||||
"Deploy Key",
|
||||
"Webhook URL",
|
||||
"Last Deployment Build Logs",
|
||||
"Environment Variables",
|
||||
"Docker Labels",
|
||||
"Volume Mounts",
|
||||
"Port Mappings",
|
||||
"Recent Deployments",
|
||||
"Danger Zone",
|
||||
}
|
||||
|
||||
previousIndex := -1
|
||||
|
||||
for _, title := range sectionTitles {
|
||||
index := strings.Index(body, ">"+title+"</h2>")
|
||||
require.NotEqual(t, -1, index, "app page has no %q section", title)
|
||||
assert.Greater(t, index, previousIndex, "%q section is out of order", title)
|
||||
|
||||
previousIndex = index
|
||||
}
|
||||
|
||||
for _, logBox := range []string{"containerLogsWrapper", "buildLogsWrapper"} {
|
||||
_, afterRef, found := strings.Cut(body, `x-ref="`+logBox+`"`)
|
||||
require.True(t, found, "app page has no %s", logBox)
|
||||
|
||||
logBoxTag, _, _ := strings.Cut(afterRef, ">")
|
||||
assert.Contains(t, logBoxTag, "max-height: 800px;", logBox)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user