Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
b0ddaca4
Commit
b0ddaca4
authored
Dec 01, 2023
by
isstuev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change border color, add tests
parent
9c45f200
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
91 additions
and
5 deletions
+91
-5
solidityscanReport.ts
mocks/contract/solidityscanReport.ts
+45
-1
SolidityscanReport.pw.tsx
ui/address/SolidityscanReport.pw.tsx
+44
-3
SolidityscanReport.tsx
ui/address/SolidityscanReport.tsx
+2
-1
SolidityscanReport.pw.tsx_dark-color-mode_average-report-dark-mode-mobile-1.png
...tsx_dark-color-mode_average-report-dark-mode-mobile-1.png
+0
-0
SolidityscanReport.pw.tsx_dark-color-mode_average-report-dark-mode-mobile-2.png
...tsx_dark-color-mode_average-report-dark-mode-mobile-2.png
+0
-0
SolidityscanReport.pw.tsx_dark-color-mode_base-view-dark-mode-mobile-1.png
...t.pw.tsx_dark-color-mode_base-view-dark-mode-mobile-1.png
+0
-0
SolidityscanReport.pw.tsx_default_average-report-dark-mode-mobile-1.png
...port.pw.tsx_default_average-report-dark-mode-mobile-1.png
+0
-0
SolidityscanReport.pw.tsx_default_average-report-dark-mode-mobile-2.png
...port.pw.tsx_default_average-report-dark-mode-mobile-2.png
+0
-0
SolidityscanReport.pw.tsx_default_base-view-dark-mode-mobile-1.png
...canReport.pw.tsx_default_base-view-dark-mode-mobile-1.png
+0
-0
SolidityscanReport.pw.tsx_default_great-report-1.png
...ts__/SolidityscanReport.pw.tsx_default_great-report-1.png
+0
-0
SolidityscanReport.pw.tsx_default_great-report-2.png
...ts__/SolidityscanReport.pw.tsx_default_great-report-2.png
+0
-0
SolidityscanReport.pw.tsx_default_low-report-1.png
...hots__/SolidityscanReport.pw.tsx_default_low-report-1.png
+0
-0
SolidityscanReport.pw.tsx_default_low-report-2.png
...hots__/SolidityscanReport.pw.tsx_default_low-report-2.png
+0
-0
SolidityscanReport.pw.tsx_mobile_average-report-dark-mode-mobile-1.png
...eport.pw.tsx_mobile_average-report-dark-mode-mobile-1.png
+0
-0
SolidityscanReport.pw.tsx_mobile_average-report-dark-mode-mobile-2.png
...eport.pw.tsx_mobile_average-report-dark-mode-mobile-2.png
+0
-0
No files found.
mocks/contract/solidityscanReport.ts
View file @
b0ddaca4
export
const
solidityscanReport
=
{
export
const
solidityscanReport
Average
=
{
scan_report
:
{
scan_report
:
{
scan_status
:
'
scan_done
'
,
scan_status
:
'
scan_done
'
,
scan_summary
:
{
scan_summary
:
{
...
@@ -19,3 +19,47 @@ export const solidityscanReport = {
...
@@ -19,3 +19,47 @@ export const solidityscanReport = {
scanner_reference_url
:
'
https://solidityscan.com/quickscan/0xc1EF7811FF2ebFB74F80ed7423f2AdAA37454be2/blockscout/eth-goerli?ref=blockscout
'
,
scanner_reference_url
:
'
https://solidityscan.com/quickscan/0xc1EF7811FF2ebFB74F80ed7423f2AdAA37454be2/blockscout/eth-goerli?ref=blockscout
'
,
},
},
};
};
export
const
solidityscanReportGreat
=
{
scan_report
:
{
scan_status
:
'
scan_done
'
,
scan_summary
:
{
issue_severity_distribution
:
{
critical
:
0
,
gas
:
0
,
high
:
0
,
informational
:
0
,
low
:
0
,
medium
:
0
,
},
lines_analyzed_count
:
18
,
scan_time_taken
:
1
,
score
:
'
3.61
'
,
score_v2
:
'
100
'
,
threat_score
:
'
94.74
'
,
},
scanner_reference_url
:
'
https://solidityscan.com/quickscan/0xc1EF7811FF2ebFB74F80ed7423f2AdAA37454be2/blockscout/eth-goerli?ref=blockscout
'
,
},
};
export
const
solidityscanReportLow
=
{
scan_report
:
{
scan_status
:
'
scan_done
'
,
scan_summary
:
{
issue_severity_distribution
:
{
critical
:
2
,
gas
:
1
,
high
:
3
,
informational
:
0
,
low
:
2
,
medium
:
10
,
},
lines_analyzed_count
:
18
,
scan_time_taken
:
1
,
score
:
'
3.61
'
,
score_v2
:
'
22.22
'
,
threat_score
:
'
94.74
'
,
},
scanner_reference_url
:
'
https://solidityscan.com/quickscan/0xc1EF7811FF2ebFB74F80ed7423f2AdAA37454be2/blockscout/eth-goerli?ref=blockscout
'
,
},
};
ui/address/SolidityscanReport.pw.tsx
View file @
b0ddaca4
import
{
test
,
expect
}
from
'
@playwright/experimental-ct-react
'
;
import
{
test
,
expect
}
from
'
@playwright/experimental-ct-react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
{
solidityscanReport
as
solidityscanReportMock
}
from
'
mocks/contract/solidityscanReport
'
;
import
*
as
solidityscanReportMock
from
'
mocks/contract/solidityscanReport
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
...
@@ -10,10 +10,10 @@ import SolidityscanReport from './SolidityscanReport';
...
@@ -10,10 +10,10 @@ import SolidityscanReport from './SolidityscanReport';
const
addressHash
=
'
hash
'
;
const
addressHash
=
'
hash
'
;
const
REPORT_API_URL
=
buildApiUrl
(
'
contract_solidityscan_report
'
,
{
hash
:
addressHash
});
const
REPORT_API_URL
=
buildApiUrl
(
'
contract_solidityscan_report
'
,
{
hash
:
addressHash
});
test
(
'
base view
+@dark-mode +@mobile
'
,
async
({
mount
,
page
})
=>
{
test
(
'
average report
+@dark-mode +@mobile
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
REPORT_API_URL
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
REPORT_API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
status
:
200
,
body
:
JSON
.
stringify
(
solidityscanReportMock
),
body
:
JSON
.
stringify
(
solidityscanReportMock
.
solidityscanReportAverage
),
}));
}));
const
component
=
await
mount
(
const
component
=
await
mount
(
...
@@ -21,6 +21,47 @@ test('base view +@dark-mode +@mobile', async({ mount, page }) => {
...
@@ -21,6 +21,47 @@ test('base view +@dark-mode +@mobile', async({ mount, page }) => {
<
SolidityscanReport
hash=
{
addressHash
}
/>
<
SolidityscanReport
hash=
{
addressHash
}
/>
</
TestApp
>,
</
TestApp
>,
);
);
await
expect
(
page
).
toHaveScreenshot
({
clip
:
{
x
:
0
,
y
:
0
,
width
:
100
,
height
:
50
}
});
await
component
.
getByLabel
(
'
SolidityScan score
'
).
click
();
await
expect
(
page
).
toHaveScreenshot
({
clip
:
{
x
:
0
,
y
:
0
,
width
:
400
,
height
:
500
}
});
});
test
(
'
great report
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
REPORT_API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
solidityscanReportMock
.
solidityscanReportGreat
),
}));
const
component
=
await
mount
(
<
TestApp
>
<
SolidityscanReport
hash=
{
addressHash
}
/>
</
TestApp
>,
);
await
expect
(
page
).
toHaveScreenshot
({
clip
:
{
x
:
0
,
y
:
0
,
width
:
100
,
height
:
50
}
});
await
component
.
getByLabel
(
'
SolidityScan score
'
).
click
();
await
expect
(
page
).
toHaveScreenshot
({
clip
:
{
x
:
0
,
y
:
0
,
width
:
400
,
height
:
500
}
});
});
test
(
'
low report
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
REPORT_API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
solidityscanReportMock
.
solidityscanReportLow
),
}));
const
component
=
await
mount
(
<
TestApp
>
<
SolidityscanReport
hash=
{
addressHash
}
/>
</
TestApp
>,
);
await
expect
(
page
).
toHaveScreenshot
({
clip
:
{
x
:
0
,
y
:
0
,
width
:
100
,
height
:
50
}
});
await
component
.
getByLabel
(
'
SolidityScan score
'
).
click
();
await
component
.
getByLabel
(
'
SolidityScan score
'
).
click
();
await
expect
(
page
).
toHaveScreenshot
({
clip
:
{
x
:
0
,
y
:
0
,
width
:
400
,
height
:
500
}
});
await
expect
(
page
).
toHaveScreenshot
({
clip
:
{
x
:
0
,
y
:
0
,
width
:
400
,
height
:
500
}
});
...
...
ui/address/SolidityscanReport.tsx
View file @
b0ddaca4
...
@@ -91,6 +91,7 @@ const SolidityscanReport = ({ className, hash }: Props) => {
...
@@ -91,6 +91,7 @@ const SolidityscanReport = ({ className, hash }: Props) => {
<
Button
<
Button
className=
{
className
}
className=
{
className
}
color=
{
scoreColor
}
color=
{
scoreColor
}
borderColor=
{
scoreColor
}
size=
"sm"
size=
"sm"
variant=
"outline"
variant=
"outline"
colorScheme=
"gray"
colorScheme=
"gray"
...
@@ -130,7 +131,7 @@ const SolidityscanReport = ({ className, hash }: Props) => {
...
@@ -130,7 +131,7 @@ const SolidityscanReport = ({ className, hash }: Props) => {
<
Text
color=
{
scoreColor
}
fontWeight=
{
500
}
>
Security score is
{
scoreLevel
}
</
Text
>
<
Text
color=
{
scoreColor
}
fontWeight=
{
500
}
>
Security score is
{
scoreLevel
}
</
Text
>
</
Box
>
</
Box
>
</
Flex
>
</
Flex
>
{
vulnerabilities
&&
vulnerabilitiesCount
&&
(
{
vulnerabilities
&&
vulnerabilitiesCount
>
0
&&
(
<
Box
mb=
{
5
}
>
<
Box
mb=
{
5
}
>
<
Text
py=
"7px"
variant=
"secondary"
fontSize=
"xs"
fontWeight=
{
500
}
>
Vulnerabilities distribution
</
Text
>
<
Text
py=
"7px"
variant=
"secondary"
fontSize=
"xs"
fontWeight=
{
500
}
>
Vulnerabilities distribution
</
Text
>
<
Grid
templateColumns=
"20px 1fr 100px"
alignItems=
"center"
rowGap=
{
2
}
>
<
Grid
templateColumns=
"20px 1fr 100px"
alignItems=
"center"
rowGap=
{
2
}
>
...
...
ui/address/__screenshots__/SolidityscanReport.pw.tsx_dark-color-mode_average-report-dark-mode-mobile-1.png
0 → 100644
View file @
b0ddaca4
1.64 KB
ui/address/__screenshots__/SolidityscanReport.pw.tsx_dark-color-mode_average-report-dark-mode-mobile-2.png
0 → 100644
View file @
b0ddaca4
29.3 KB
ui/address/__screenshots__/SolidityscanReport.pw.tsx_dark-color-mode_base-view-dark-mode-mobile-1.png
deleted
100644 → 0
View file @
9c45f200
29.3 KB
ui/address/__screenshots__/SolidityscanReport.pw.tsx_default_average-report-dark-mode-mobile-1.png
0 → 100644
View file @
b0ddaca4
1.74 KB
ui/address/__screenshots__/SolidityscanReport.pw.tsx_default_average-report-dark-mode-mobile-2.png
0 → 100644
View file @
b0ddaca4
30.1 KB
ui/address/__screenshots__/SolidityscanReport.pw.tsx_default_base-view-dark-mode-mobile-1.png
deleted
100644 → 0
View file @
9c45f200
30.1 KB
ui/address/__screenshots__/SolidityscanReport.pw.tsx_default_great-report-1.png
0 → 100644
View file @
b0ddaca4
1.72 KB
ui/address/__screenshots__/SolidityscanReport.pw.tsx_default_great-report-2.png
0 → 100644
View file @
b0ddaca4
20.1 KB
ui/address/__screenshots__/SolidityscanReport.pw.tsx_default_low-report-1.png
0 → 100644
View file @
b0ddaca4
1.52 KB
ui/address/__screenshots__/SolidityscanReport.pw.tsx_default_low-report-2.png
0 → 100644
View file @
b0ddaca4
29.4 KB
ui/address/__screenshots__/SolidityscanReport.pw.tsx_mobile_average-report-dark-mode-mobile-1.png
0 → 100644
View file @
b0ddaca4
1.74 KB
ui/address/__screenshots__/SolidityscanReport.pw.tsx_mobile_
base-view-dark-mode-mobile-1
.png
→
ui/address/__screenshots__/SolidityscanReport.pw.tsx_mobile_
average-report-dark-mode-mobile-2
.png
View file @
b0ddaca4
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment