Skip to content

Commit b5c9188

Browse files
committed
warnings
1 parent 09ade8c commit b5c9188

3 files changed

Lines changed: 85 additions & 2 deletions

File tree

web-report/src-e2e/static/report.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4868,5 +4868,13 @@
48684868
}
48694869
]
48704870
}
4871+
],
4872+
"warnings": [
4873+
{
4874+
"message": "No authentication info was provided. Unless you are testing an example API, you should setup some authentication info for different users. If this is the first time you are using EvoMaster, and you just want to get a feeling of how it works, then ignore this warning. However, to get better results, you will need setup authentication info, eventually. More info is currently available at https://github.com/WebFuzzing/EvoMaster/blob/master/docs/auth.md",
4875+
"category": "FUZZER",
4876+
"displayPriority": 1,
4877+
"additionalProperties": {}
4878+
}
48714879
]
48724880
}

web-report/src/components/Dashboard.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {Overview} from "@/pages/Overview.tsx";
77
import {Endpoints} from "@/pages/Endpoints.tsx";
88
import {TestResults} from "@/pages/TestResults.tsx";
99
import {Tests} from "@/pages/Tests.tsx";
10+
import {Warnings} from "@/pages/Warnings.tsx";
1011

1112
import {ScrollArea, ScrollBar} from "@/components/ui/scroll-area.tsx";
1213
import {useAppContext} from "@/AppProvider.tsx";
@@ -20,6 +21,8 @@ export interface ITestTabs {
2021
export const Dashboard: React.FC = () => {
2122
const {data, isDirty, reviews} = useAppContext();
2223

24+
const warningCount = data?.warnings?.length ?? 0;
25+
2326
const reviewRatio = useMemo(() => {
2427
if (!data) return null;
2528
const total = data.testCases.length;
@@ -79,7 +82,7 @@ export const Dashboard: React.FC = () => {
7982
toolNameVersion={`${data.toolName}-${data.toolVersion}`}/>
8083
<Tabs value={activeTab} onValueChange={setActiveTab} className="w-full">
8184
<div className="flex justify-center mb-2 w-full">
82-
<TabsList className={`flex gap-2 sm:gap-4 w-full max-w-[700px] h-auto p-1 bg-transparent`}>
85+
<TabsList className={`flex gap-2 sm:gap-4 w-full max-w-[850px] h-auto p-1 bg-transparent`}>
8386
<TabsTrigger
8487
value="overview"
8588
className="flex-1 sm:flex-none sm:min-w-[150px] py-3 text-xs sm:text-sm border border-gray-500 data-[state=active]:bg-blue-100 data-[state=active]:border-2 data-[state=active]:border-black data-[state=active]:shadow-[2px_2px_0px_0px_rgba(0,0,0,1)]"
@@ -107,13 +110,25 @@ export const Dashboard: React.FC = () => {
107110
)}
108111
{isDirty && <span className="ml-1 text-orange-600" title="Unsaved review changes"></span>}
109112
</TabsTrigger>
113+
<TabsTrigger
114+
value="warnings"
115+
className="flex-1 sm:flex-none sm:min-w-[150px] py-3 text-xs sm:text-sm border border-gray-500 data-[state=active]:bg-orange-100 data-[state=active]:border-2 data-[state=active]:border-black data-[state=active]:shadow-[2px_2px_0px_0px_rgba(0,0,0,1)]"
116+
data-testid="tab-warnings"
117+
>
118+
Warnings
119+
{warningCount > 0 && (
120+
<span className="ml-2 text-xs font-mono px-1.5 py-0.5 border border-orange-600 bg-orange-50 text-orange-700" data-testid="tab-warnings-count">
121+
{warningCount}
122+
</span>
123+
)}
124+
</TabsTrigger>
110125
</TabsList>
111126
</div>
112127
<div className="border-t border-black my-2"></div>
113128

114129
<div className="flex justify-center w-full">
115130
{
116-
<TabsList className={`flex gap-2 sm:gap-4 w-full max-w-[700px] h-auto p-1 bg-transparent`}>
131+
<TabsList className={`flex gap-2 sm:gap-4 w-full max-w-[850px] h-auto p-1 bg-transparent`}>
117132
<ScrollArea className="w-[130%] whitespace-nowrap py-3">
118133
{
119134
testTabs.map((test, index) => (
@@ -155,6 +170,10 @@ export const Dashboard: React.FC = () => {
155170
<Tests/>
156171
</TabsContent>
157172

173+
<TabsContent value="warnings">
174+
<Warnings/>
175+
</TabsContent>
176+
158177
{
159178
testTabs.map((test, index) => (
160179
<TabsContent value={`${test.value}`} key={index}>

web-report/src/pages/Warnings.tsx

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import React, {useMemo} from "react";
2+
import {useAppContext} from "@/AppProvider.tsx";
3+
import {Warning} from "@/types/GeneratedTypes.tsx";
4+
import {AlertTriangle} from "lucide-react";
5+
6+
export const Warnings: React.FC = () => {
7+
const {data} = useAppContext();
8+
9+
const sortedWarnings = useMemo<Warning[]>(() => {
10+
const warnings = data?.warnings ?? [];
11+
return [...warnings].sort((a, b) => {
12+
const pa = a.displayPriority ?? Number.MAX_SAFE_INTEGER;
13+
const pb = b.displayPriority ?? Number.MAX_SAFE_INTEGER;
14+
return pa - pb;
15+
});
16+
}, [data]);
17+
18+
return (
19+
<div className="border-2 border-black p-3 sm:p-6 rounded-none" data-testid="warnings-page">
20+
<div className="flex items-center gap-2 mb-4">
21+
<AlertTriangle className="text-orange-500" size={22}/>
22+
<h2 className="text-lg font-bold">Warnings</h2>
23+
<span className="ml-2 font-mono text-xs px-2 py-1 border-2 border-black bg-white" data-testid="warnings-count">
24+
{sortedWarnings.length}
25+
</span>
26+
</div>
27+
28+
{sortedWarnings.length === 0 ? (
29+
<div className="border-2 border-dashed border-gray-400 bg-gray-50 p-6 text-center text-sm text-gray-600 font-mono" data-testid="warnings-empty">
30+
No warnings reported.
31+
</div>
32+
) : (
33+
<div className="flex flex-col gap-3">
34+
{sortedWarnings.map((w, idx) => (
35+
<div
36+
key={idx}
37+
className="border-2 p-3 bg-blue-50 border-blue-500 text-blue-900"
38+
data-testid={`warning-${idx}`}
39+
>
40+
{w.category && (
41+
<div className="mb-2">
42+
<span className="font-mono text-xs px-2 py-0.5 border-2 border-black bg-white" data-testid={`warning-${idx}-category`}>
43+
{w.category}
44+
</span>
45+
</div>
46+
)}
47+
<div className="text-sm whitespace-pre-wrap break-words" data-testid={`warning-${idx}-message`}>
48+
{w.message ?? <span className="italic text-gray-500">(no message)</span>}
49+
</div>
50+
</div>
51+
))}
52+
</div>
53+
)}
54+
</div>
55+
);
56+
};

0 commit comments

Comments
 (0)