mirror of
https://github.com/SigNoz/signoz.git
synced 2026-12-03 13:40:42 +00:00
Compare commits
9 Commits
v0.153.0
...
perf/web-i
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3a00eb69fe | ||
|
|
f8a5e11dfb | ||
|
|
1f6b0e6acc | ||
|
|
52c2961368 | ||
|
|
f0c1f4bbf9 | ||
|
|
8fad61a8b5 | ||
|
|
ed69006a2a | ||
|
|
649c3a250c | ||
|
|
f7b1383427 |
@@ -165,6 +165,7 @@ apiserver:
|
||||
- /api/v1/health
|
||||
- /api/v1/version
|
||||
- /
|
||||
- /assets/
|
||||
|
||||
##################### Querier #####################
|
||||
querier:
|
||||
|
||||
3
frontend/.gitignore
vendored
3
frontend/.gitignore
vendored
@@ -1,4 +1,7 @@
|
||||
|
||||
# Vite copies public/ unhashed, and the Go server caches /assets/ as immutable
|
||||
/public/assets/
|
||||
|
||||
# Sentry Config File
|
||||
.env.sentry-build-plugin
|
||||
.qodo
|
||||
|
||||
@@ -162,6 +162,16 @@ describe('SENTRY_IGNORE_ERRORS', () => {
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it('ignores Safari loading a stale chunk served as index.html', () => {
|
||||
expect(
|
||||
SENTRY_IGNORE_ERRORS.some((pattern) =>
|
||||
pattern.test(
|
||||
"TypeError: 'text/html' is not a valid JavaScript MIME type for module script 'https://example.us.signoz.cloud/assets/AIAssistantModal-cna5ncpr.js'.",
|
||||
),
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isExpectedRequestFailure', () => {
|
||||
|
||||
@@ -5,11 +5,14 @@ export const SENTRY_IGNORE_ERRORS = [
|
||||
// A tab that outlived a deploy requests hashed assets the new build no longer
|
||||
// has. `lazyRetry` recovers by reloading once, so this class is not worth
|
||||
// reporting. The stylesheet message is Vite's own; the module ones are the
|
||||
// same failure worded differently by Chromium, Firefox and Safari.
|
||||
// same failure worded differently by Chromium, Firefox and Safari. Safari
|
||||
// reports the MIME type one when the server answers the missing asset with
|
||||
// index.html.
|
||||
/Unable to preload CSS for/,
|
||||
/Failed to fetch dynamically imported module/,
|
||||
/error loading dynamically imported module/,
|
||||
/Importing a module script failed/,
|
||||
/is not a valid JavaScript MIME type/,
|
||||
// Thrown by the bundled posthog-js when its recorder script fails to load, so
|
||||
// its frames point at our own bundle and the URL check below misses it.
|
||||
/Called on script loaded before session recording is available/,
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
justify-content: flex-end;
|
||||
gap: var(--spacing-3) var(--spacing-4);
|
||||
margin-top: -28px;
|
||||
padding: 0 calc(var(--spacing-8) + 28px) var(--spacing-4) var(--spacing-8);
|
||||
padding: 0 calc(var(--spacing-8) + 28px) var(--spacing-2) var(--spacing-8);
|
||||
|
||||
&.compact {
|
||||
padding: 0 calc(var(--spacing-3) + 28px) var(--spacing-3) var(--spacing-3);
|
||||
padding: 0 calc(var(--spacing-3) + 28px) var(--spacing-2) var(--spacing-3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
.message {
|
||||
display: flex;
|
||||
padding: 8px 16px;
|
||||
// Each message ends in its 28px hover row; the 4px under it makes 32px between messages.
|
||||
padding: 0 var(--spacing-8) var(--spacing-2);
|
||||
// CSS variable consumed by MessageFeedback to fade in on hover.
|
||||
--feedback-opacity: 0;
|
||||
|
||||
@@ -9,7 +10,12 @@
|
||||
}
|
||||
|
||||
&.compact {
|
||||
padding: 6px;
|
||||
padding: 0 var(--spacing-3) var(--spacing-2);
|
||||
}
|
||||
|
||||
// An error reply has no hover row, so it holds the 32px itself.
|
||||
&.noActions {
|
||||
padding-bottom: var(--spacing-16);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +80,10 @@
|
||||
border-bottom-left-radius: var(--radius-2);
|
||||
}
|
||||
|
||||
.assistant &:not(.error) {
|
||||
padding-block: 0;
|
||||
}
|
||||
|
||||
// The full page sets replies flush on the pane; errors keep their callout.
|
||||
.assistant .fullPage &:not(.error) {
|
||||
padding: 0 0 0 var(--spacing-5);
|
||||
@@ -114,7 +124,7 @@
|
||||
}
|
||||
|
||||
.retryButton {
|
||||
margin-top: 6px;
|
||||
margin-top: var(--spacing-2);
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
|
||||
@@ -142,6 +142,7 @@ export default function MessageBubble({
|
||||
isUser ? styles.user : styles.assistant,
|
||||
{
|
||||
[styles.compact]: isCompact,
|
||||
[styles.noActions]: isError && !showRetry,
|
||||
},
|
||||
);
|
||||
const bodyClass = cx(styles.body, {
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
// Room around the thread lives in its rows: Virtuoso measures only rows, so padding outside them leaves its scrolls short.
|
||||
.row.first {
|
||||
padding-top: var(--spacing-8);
|
||||
padding-top: var(--spacing-12);
|
||||
}
|
||||
|
||||
// Keeps the last bubble off the disclaimer and input bar.
|
||||
.row.last {
|
||||
padding-bottom: var(--spacing-32);
|
||||
padding-bottom: var(--spacing-2);
|
||||
}
|
||||
|
||||
// As wide as the full-page input; the extra 32px is the rows' own gutters.
|
||||
|
||||
@@ -185,6 +185,8 @@ export default defineConfig(({ mode }): UserConfig => {
|
||||
sourcemap: true,
|
||||
outDir: 'build',
|
||||
cssMinify: 'esbuild',
|
||||
// The Go server caches /assets/ as immutable, so every file there must carry a content hash.
|
||||
assetsDir: 'assets',
|
||||
rolldownOptions: {
|
||||
treeshake: {
|
||||
moduleSideEffects: [
|
||||
@@ -197,6 +199,9 @@ export default defineConfig(({ mode }): UserConfig => {
|
||||
],
|
||||
},
|
||||
output: {
|
||||
entryFileNames: 'assets/[name]-[hash].js',
|
||||
chunkFileNames: 'assets/[name]-[hash].js',
|
||||
assetFileNames: 'assets/[name]-[hash].[ext]',
|
||||
// Without this group Rolldown splits the entry's static graph into ~300
|
||||
// chunks, 324 requests on first load.
|
||||
codeSplitting: {
|
||||
|
||||
@@ -53,6 +53,7 @@ func newConfig() factory.Config {
|
||||
"/api/v1/health",
|
||||
"/api/v1/version",
|
||||
"/",
|
||||
"/assets/",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -8,25 +8,38 @@ import (
|
||||
)
|
||||
|
||||
type Cache struct {
|
||||
maxAge time.Duration
|
||||
cacheControl string
|
||||
}
|
||||
|
||||
func NewCache(maxAge time.Duration) *Cache {
|
||||
// Cache-Control: no-cache is equivalent to Cache-Control: max-age=0, must-revalidate as most HTTP/1.0 caches don't support no-cache directives
|
||||
directives := []string{
|
||||
"max-age=" + strconv.Itoa(int(maxAge.Seconds())),
|
||||
"no-cache", // Note that no-cache does not mean "don't cache". no-cache allows caches to store a response but requires them to revalidate it before reuse.
|
||||
"private", //If you forget to add private to a response with personalized content, then that response can be stored in a shared cache and end up being reused for multiple users, which can cause personal information to leak.
|
||||
"must-revalidate", // HTTP allows caches to reuse stale responses when they are disconnected from the origin server. must-revalidate is a way to prevent this from happening - either the stored response is revalidated with the origin server or a 504 (Gateway Timeout) response is generated.
|
||||
}
|
||||
|
||||
return &Cache{
|
||||
maxAge: maxAge,
|
||||
cacheControl: strings.Join(directives, ","),
|
||||
}
|
||||
}
|
||||
|
||||
func NewImmutableCache(maxAge time.Duration) *Cache {
|
||||
directives := []string{
|
||||
"public",
|
||||
"max-age=" + strconv.Itoa(int(maxAge.Seconds())),
|
||||
"immutable",
|
||||
}
|
||||
|
||||
return &Cache{
|
||||
cacheControl: strings.Join(directives, ","),
|
||||
}
|
||||
}
|
||||
|
||||
func (middleware *Cache) Wrap(next http.Handler) http.Handler {
|
||||
// Cache-Control: no-cache is equivalent to Cache-Control: max-age=0, must-revalidate as most HTTP/1.0 caches don't support no-cache directives
|
||||
return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
|
||||
directives := []string{
|
||||
"max-age=" + strconv.Itoa(int(middleware.maxAge.Seconds())),
|
||||
"no-cache", // Note that no-cache does not mean "don't cache". no-cache allows caches to store a response but requires them to revalidate it before reuse.
|
||||
"private", //If you forget to add private to a response with personalized content, then that response can be stored in a shared cache and end up being reused for multiple users, which can cause personal information to leak.
|
||||
"must-revalidate", // HTTP allows caches to reuse stale responses when they are disconnected from the origin server. must-revalidate is a way to prevent this from happening - either the stored response is revalidated with the origin server or a 504 (Gateway Timeout) response is generated.
|
||||
}
|
||||
rw.Header().Set("Cache-Control", strings.Join(directives, ","))
|
||||
rw.Header().Set("Cache-Control", middleware.cacheControl)
|
||||
next.ServeHTTP(rw, req)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package middleware
|
||||
import (
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -44,8 +45,8 @@ func TestCache(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
req, err := http.NewRequest("GET", "http://"+listener.Addr().String(), nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -62,3 +63,25 @@ func TestCache(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestCacheControl(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
cache *Cache
|
||||
expected string
|
||||
}{
|
||||
{name: "NoCache", cache: NewCache(0), expected: "max-age=0,no-cache,private,must-revalidate"},
|
||||
{name: "Immutable", cache: NewImmutableCache(365 * 24 * time.Hour), expected: "public,max-age=31536000,immutable"},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
rw := httptest.NewRecorder()
|
||||
testCase.cache.Wrap(http.HandlerFunc(func(http.ResponseWriter, *http.Request) {})).ServeHTTP(rw, httptest.NewRequest(http.MethodGet, "/", nil))
|
||||
|
||||
assert.Equal(t, testCase.expected, rw.Header().Get("Cache-Control"))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,10 @@ import (
|
||||
"html/template"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/SigNoz/signoz/pkg/errors"
|
||||
"github.com/SigNoz/signoz/pkg/factory"
|
||||
@@ -16,6 +19,11 @@ import (
|
||||
"github.com/gorilla/mux"
|
||||
)
|
||||
|
||||
const (
|
||||
assetsPathPrefix = "/assets/"
|
||||
assetsMaxAge = 365 * 24 * time.Hour
|
||||
)
|
||||
|
||||
type provider struct {
|
||||
config web.Config
|
||||
indexContents []byte
|
||||
@@ -64,8 +72,18 @@ func New(ctx context.Context, settings factory.ProviderSettings, config web.Conf
|
||||
}
|
||||
|
||||
func (provider *provider) AddToRouter(router *mux.Router) error {
|
||||
assetsCache := middleware.NewImmutableCache(assetsMaxAge)
|
||||
err := router.PathPrefix(assetsPathPrefix).
|
||||
MatcherFunc(provider.matchAsset).
|
||||
Handler(
|
||||
assetsCache.Wrap(http.HandlerFunc(provider.ServeHTTP)),
|
||||
).GetError()
|
||||
if err != nil {
|
||||
return errors.WrapInternalf(err, errors.CodeInternal, "unable to add web assets to router")
|
||||
}
|
||||
|
||||
cache := middleware.NewCache(0)
|
||||
err := router.PathPrefix("/").
|
||||
err = router.PathPrefix("/").
|
||||
Handler(
|
||||
cache.Wrap(http.HandlerFunc(provider.ServeHTTP)),
|
||||
).GetError()
|
||||
@@ -78,10 +96,10 @@ func (provider *provider) AddToRouter(router *mux.Router) error {
|
||||
|
||||
func (provider *provider) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||
// Join internally call path.Clean to prevent directory traversal
|
||||
path := filepath.Join(provider.config.Directory, req.URL.Path)
|
||||
filePath := filepath.Join(provider.config.Directory, req.URL.Path)
|
||||
|
||||
// check whether a file exists or is a directory at the given path
|
||||
fi, err := os.Stat(path)
|
||||
fi, err := os.Stat(filePath)
|
||||
if err != nil {
|
||||
// if the file doesn't exist, serve index.html
|
||||
if os.IsNotExist(err) {
|
||||
@@ -105,6 +123,28 @@ func (provider *provider) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||
provider.fileHandler.ServeHTTP(rw, req)
|
||||
}
|
||||
|
||||
// matchAsset matches files under /assets/, which are content-hashed, so their URL changes with their content.
|
||||
func (provider *provider) matchAsset(req *http.Request, _ *mux.RouteMatch) bool {
|
||||
// a non-canonical URL can name a file outside /assets/ or get a redirect
|
||||
if req.URL.Path != path.Clean(req.URL.Path) {
|
||||
return false
|
||||
}
|
||||
|
||||
if !strings.HasPrefix(req.URL.Path, assetsPathPrefix) {
|
||||
return false
|
||||
}
|
||||
|
||||
filePath := filepath.Join(provider.config.Directory, req.URL.Path)
|
||||
|
||||
// a missing file or a directory serves index.html
|
||||
fi, err := os.Stat(filePath)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return !fi.IsDir()
|
||||
}
|
||||
|
||||
func (provider *provider) serveIndex(rw http.ResponseWriter) {
|
||||
rw.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
_, _ = rw.Write(provider.indexContents)
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -251,3 +252,87 @@ func TestServeStaticFilesUnchanged(t *testing.T) {
|
||||
|
||||
assert.Equal(t, string(expected), httpGet(t, base+"/assets/style.css"))
|
||||
}
|
||||
|
||||
func TestServeCacheControl(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
directory := t.TempDir()
|
||||
files := map[string]string{
|
||||
"index.html": "<html>index</html>",
|
||||
"assets/x.js": "console.log('x')",
|
||||
"assets/nested/y.css": "body{}",
|
||||
"assets-legacy/z.js": "console.log('z')",
|
||||
"favicon.ico": "icon",
|
||||
"css/uPlot.min.css": ".uplot{}",
|
||||
"locales/en/main.json": "{}",
|
||||
}
|
||||
for name, content := range files {
|
||||
require.NoError(t, os.MkdirAll(filepath.Join(directory, filepath.Dir(name)), 0o755))
|
||||
require.NoError(t, os.WriteFile(filepath.Join(directory, name), []byte(content), 0o644))
|
||||
}
|
||||
|
||||
testCases := []struct {
|
||||
name string
|
||||
basePath string
|
||||
path string
|
||||
expectedStatus int
|
||||
expectedBody string
|
||||
expectedCC string
|
||||
}{
|
||||
{name: "ExistingAsset_Immutable", path: "/assets/x.js", expectedBody: files["assets/x.js"], expectedCC: "public,max-age=31536000,immutable"},
|
||||
{name: "ExistingNestedAsset_Immutable", path: "/assets/nested/y.css", expectedBody: files["assets/nested/y.css"], expectedCC: "public,max-age=31536000,immutable"},
|
||||
{name: "MissingAsset_ServesIndex_NoCache", path: "/assets/missing-AAAA.js", expectedBody: files["index.html"], expectedCC: "max-age=0,no-cache,private,must-revalidate"},
|
||||
{name: "AssetsDirectory_ServesIndex_NoCache", path: "/assets/nested/", expectedBody: files["index.html"], expectedCC: "max-age=0,no-cache,private,must-revalidate"},
|
||||
{name: "Root_ServesIndex_NoCache", path: "/", expectedBody: files["index.html"], expectedCC: "max-age=0,no-cache,private,must-revalidate"},
|
||||
{name: "UnknownRoute_ServesIndex_NoCache", path: "/does-not-exist", expectedBody: files["index.html"], expectedCC: "max-age=0,no-cache,private,must-revalidate"},
|
||||
{name: "NonAssetFile_NoCache", path: "/favicon.ico", expectedBody: files["favicon.ico"], expectedCC: "max-age=0,no-cache,private,must-revalidate"},
|
||||
{name: "NonAssetNestedFile_NoCache", path: "/css/uPlot.min.css", expectedBody: files["css/uPlot.min.css"], expectedCC: "max-age=0,no-cache,private,must-revalidate"},
|
||||
{name: "LocaleFile_NoCache", path: "/locales/en/main.json", expectedBody: files["locales/en/main.json"], expectedCC: "max-age=0,no-cache,private,must-revalidate"},
|
||||
{name: "AssetsPrefixLookalike_NoCache", path: "/assets-legacy/z.js", expectedBody: files["assets-legacy/z.js"], expectedCC: "max-age=0,no-cache,private,must-revalidate"},
|
||||
{name: "BasePath_ExistingAsset_Immutable", basePath: "/signoz", path: "/assets/x.js", expectedBody: files["assets/x.js"], expectedCC: "public,max-age=31536000,immutable"},
|
||||
{name: "BasePath_MissingAsset_ServesIndex_NoCache", basePath: "/signoz", path: "/assets/missing-AAAA.js", expectedBody: files["index.html"], expectedCC: "max-age=0,no-cache,private,must-revalidate"},
|
||||
{name: "BasePath_NonAssetFile_NoCache", basePath: "/signoz", path: "/favicon.ico", expectedBody: files["favicon.ico"], expectedCC: "max-age=0,no-cache,private,must-revalidate"},
|
||||
{name: "AssetTrailingSlash_Redirects_NoCache", path: "/assets/x.js/", expectedStatus: http.StatusMovedPermanently, expectedCC: "max-age=0,no-cache,private,must-revalidate"},
|
||||
{name: "EncodedDotDotOutOfAssets_NoCache", path: "/assets/%2e%2e/locales/en/main.json", expectedBody: files["locales/en/main.json"], expectedCC: "max-age=0,no-cache,private,must-revalidate"},
|
||||
{name: "BasePath_Root_ServesIndex_NoCache", basePath: "/signoz", path: "/", expectedBody: files["index.html"], expectedCC: "max-age=0,no-cache,private,must-revalidate"},
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
t.Run(testCase.name, func(t *testing.T) {
|
||||
routerWeb, err := New(
|
||||
context.Background(),
|
||||
factorytest.NewSettings(),
|
||||
web.Config{Index: "index.html", Directory: directory},
|
||||
global.Config{ExternalURL: &url.URL{Path: testCase.basePath}},
|
||||
)
|
||||
require.NoError(t, err)
|
||||
|
||||
router := mux.NewRouter().UseEncodedPath()
|
||||
require.NoError(t, routerWeb.AddToRouter(router))
|
||||
|
||||
var handler http.Handler = router
|
||||
if testCase.basePath != "" {
|
||||
handler = http.StripPrefix(testCase.basePath, router)
|
||||
}
|
||||
|
||||
server := httptest.NewServer(handler)
|
||||
t.Cleanup(server.Close)
|
||||
|
||||
client := &http.Client{CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}
|
||||
res, err := client.Get(server.URL + testCase.basePath + testCase.path)
|
||||
require.NoError(t, err)
|
||||
defer func() { _ = res.Body.Close() }()
|
||||
|
||||
body, err := io.ReadAll(res.Body)
|
||||
require.NoError(t, err)
|
||||
|
||||
expectedStatus := testCase.expectedStatus
|
||||
if expectedStatus == 0 {
|
||||
expectedStatus = http.StatusOK
|
||||
}
|
||||
assert.Equal(t, expectedStatus, res.StatusCode)
|
||||
assert.Equal(t, testCase.expectedCC, res.Header.Get("Cache-Control"))
|
||||
assert.Equal(t, testCase.expectedBody, string(body))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,3 +388,24 @@ freshly seeded stack. The likely cause is the golden dataset, which `global.setu
|
||||
rebases to the moment it runs: its newest log is 15 minutes old and its newest
|
||||
span 30, so a spec that reads it through a short window only sees it for a while
|
||||
after the seed. Reproduce CI with `--shard=N/10` per shard, not with one long run.
|
||||
|
||||
## AuthZ-gated select options drop clicks while their check runs
|
||||
|
||||
`alerts/planned-downtime` TC-01 failed all three attempts in 2 of about 15 CI
|
||||
runs after planned downtime FGA (#13516). Opening the rule picker starts a
|
||||
per-rule `attach` check (~400 ms on CI); until it answers, `AuthZSelect` renders
|
||||
each option disabled. antd draws the option as a role-less `div`, so Playwright
|
||||
ignores its `aria-disabled` and clicks it anyway, antd drops the click, and the
|
||||
trace shows the click landing ~170 ms into the check with no tag after.
|
||||
`pickRule` and `antd.pickByName` now match only
|
||||
`.ant-select-item-option:not(.ant-select-item-option-disabled)`, so the click
|
||||
waits for the check.
|
||||
|
||||
## A view link applies its filter after its permission check
|
||||
|
||||
`alerts/views` TC-03 failed all three attempts in most merge-queue runs after
|
||||
alert rule views FGA (#13756). The views query now waits for the rule list
|
||||
`useAuthZ` check, but the rules query does not, so `list.goto({ view })` returned
|
||||
on unfiltered rows. The view's filter then landed mid-`runSearch` and replaced
|
||||
the typed query (the failure snapshot shows the view's `warning` query in the
|
||||
editor). The spec now waits for the view's query in the editor before editing.
|
||||
|
||||
3
tests/e2e/drivers/alerts/configuration.ts
generated
3
tests/e2e/drivers/alerts/configuration.ts
generated
@@ -129,9 +129,10 @@ export function plannedDowntimeDriver(page: Page): PlannedDowntime {
|
||||
const select = downtime.rulePicker();
|
||||
await select.click();
|
||||
await select.locator('input[role="combobox"]').fill(name);
|
||||
// Options stay disabled while their authz check runs; antd drops a click on one.
|
||||
await page
|
||||
.locator('.ant-select-dropdown:not(.ant-select-dropdown-hidden)')
|
||||
.locator('.ant-select-item-option')
|
||||
.locator('.ant-select-item-option:not(.ant-select-item-option-disabled)')
|
||||
.filter({ hasText: name })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
3
tests/e2e/drivers/antd.ts
generated
3
tests/e2e/drivers/antd.ts
generated
@@ -81,8 +81,9 @@ export function antdDriver(page: Page): Antd {
|
||||
// one input event is all rc-select's search needs.
|
||||
await select.locator('input[role="combobox"]').fill(name);
|
||||
const dropdown = await antd.ownDropdown(select);
|
||||
// Options stay disabled while their authz check runs; antd drops a click on one.
|
||||
await dropdown
|
||||
.locator('.ant-select-item-option')
|
||||
.locator('.ant-select-item-option:not(.ant-select-item-option-disabled)')
|
||||
.filter({ hasText: name })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
@@ -54,12 +54,15 @@ test.describe('Alert rules saved views', () => {
|
||||
ownedViews,
|
||||
}) => {
|
||||
const scope = nameContains(alertList.namePrefix);
|
||||
const original = `${scope} AND severity = 'warning'`;
|
||||
const id = await ownedViews.create(viewName('update'), {
|
||||
version: 'v1',
|
||||
query: `${scope} AND severity = 'warning'`,
|
||||
query: original,
|
||||
});
|
||||
|
||||
await alerts.list.goto({ view: id });
|
||||
// The view's filter lands after its permission check, later than the first rows.
|
||||
await expect(alerts.list.search()).toHaveText(original);
|
||||
const edited = `${scope} AND severity = 'critical'`;
|
||||
await alerts.list.runSearch(edited);
|
||||
await alerts.views.save();
|
||||
|
||||
Reference in New Issue
Block a user