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
e3e8dbbc
Commit
e3e8dbbc
authored
Mar 25, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test for marketplace with security scores
parent
6d17681f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
0 deletions
+101
-0
securityReports.ts
mocks/apps/securityReports.ts
+58
-0
Marketplace.pw.tsx
ui/pages/Marketplace.pw.tsx
+43
-0
Marketplace.pw.tsx_dark-color-mode_with-scores-mobile-dark-mode-1.png
...pw.tsx_dark-color-mode_with-scores-mobile-dark-mode-1.png
+0
-0
Marketplace.pw.tsx_default_with-scores-mobile-dark-mode-1.png
...etplace.pw.tsx_default_with-scores-mobile-dark-mode-1.png
+0
-0
Marketplace.pw.tsx_mobile_with-scores-mobile-dark-mode-1.png
...ketplace.pw.tsx_mobile_with-scores-mobile-dark-mode-1.png
+0
-0
No files found.
mocks/apps/securityReports.ts
0 → 100644
View file @
e3e8dbbc
export
const
securityReports
=
[
{
appName
:
'
token-approval-tracker
'
,
doc
:
'
http://docs.li.fi/smart-contracts/deployments#mainnet
'
,
chainsData
:
{
'
1
'
:
{
overallInfo
:
{
verifiedNumber
:
1
,
totalContractsNumber
:
1
,
solidityScanContractsNumber
:
1
,
securityScore
:
87.5
,
issueSeverityDistribution
:
{
critical
:
4
,
gas
:
1
,
high
:
0
,
informational
:
4
,
low
:
2
,
medium
:
0
,
},
},
contractsData
:
[
{
address
:
'
0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE
'
,
isVerified
:
true
,
solidityScanReport
:
{
connection_id
:
''
,
contract_address
:
'
0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE
'
,
contract_chain
:
'
optimism
'
,
contract_platform
:
'
blockscout
'
,
contract_url
:
'
http://optimism.blockscout.com/address/0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE
'
,
contractname
:
'
LiFiDiamond
'
,
is_quick_scan
:
true
,
node_reference_id
:
null
,
request_type
:
'
threat_scan
'
,
scanner_reference_url
:
'
http://solidityscan.com/quickscan/0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE/blockscout/eth?ref=blockscout
'
,
scan_status
:
'
scan_done
'
,
scan_summary
:
{
issue_severity_distribution
:
{
critical
:
0
,
gas
:
1
,
high
:
0
,
informational
:
4
,
low
:
2
,
medium
:
0
,
},
lines_analyzed_count
:
72
,
scan_time_taken
:
1
,
score
:
'
4.38
'
,
score_v2
:
'
87.50
'
,
threat_score
:
'
100.00
'
,
},
},
},
],
},
},
},
];
ui/pages/Marketplace.pw.tsx
View file @
e3e8dbbc
...
@@ -3,6 +3,7 @@ import React from 'react';
...
@@ -3,6 +3,7 @@ import React from 'react';
import
{
buildExternalAssetFilePath
}
from
'
configs/app/utils
'
;
import
{
buildExternalAssetFilePath
}
from
'
configs/app/utils
'
;
import
{
apps
as
appsMock
}
from
'
mocks/apps/apps
'
;
import
{
apps
as
appsMock
}
from
'
mocks/apps/apps
'
;
import
{
securityReports
as
securityReportsMock
}
from
'
mocks/apps/securityReports
'
;
import
contextWithEnvs
from
'
playwright/fixtures/contextWithEnvs
'
;
import
contextWithEnvs
from
'
playwright/fixtures/contextWithEnvs
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
*
as
app
from
'
playwright/utils/app
'
;
import
*
as
app
from
'
playwright/utils/app
'
;
...
@@ -10,6 +11,8 @@ import * as app from 'playwright/utils/app';
...
@@ -10,6 +11,8 @@ import * as app from 'playwright/utils/app';
import
Marketplace
from
'
./Marketplace
'
;
import
Marketplace
from
'
./Marketplace
'
;
const
MARKETPLACE_CONFIG_URL
=
app
.
url
+
buildExternalAssetFilePath
(
'
NEXT_PUBLIC_MARKETPLACE_CONFIG_URL
'
,
'
https://marketplace-config.json
'
)
||
''
;
const
MARKETPLACE_CONFIG_URL
=
app
.
url
+
buildExternalAssetFilePath
(
'
NEXT_PUBLIC_MARKETPLACE_CONFIG_URL
'
,
'
https://marketplace-config.json
'
)
||
''
;
const
MARKETPLACE_SECURITY_REPORTS_URL
=
app
.
url
+
buildExternalAssetFilePath
(
'
NEXT_PUBLIC_MARKETPLACE_SECURITY_REPORTS_URL
'
,
'
https://marketplace-security-reports.json
'
)
||
''
;
const
test
=
base
.
extend
({
const
test
=
base
.
extend
({
context
:
contextWithEnvs
([
context
:
contextWithEnvs
([
...
@@ -41,3 +44,43 @@ test('base view +@mobile +@dark-mode', async({ mount, page }) => {
...
@@ -41,3 +44,43 @@ test('base view +@mobile +@dark-mode', async({ mount, page }) => {
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
const
testWithScoreFeature
=
test
.
extend
({
context
:
contextWithEnvs
([
{
name
:
'
NEXT_PUBLIC_MARKETPLACE_CONFIG_URL
'
,
value
:
MARKETPLACE_CONFIG_URL
},
{
name
:
'
NEXT_PUBLIC_MARKETPLACE_SECURITY_REPORTS_URL
'
,
value
:
MARKETPLACE_SECURITY_REPORTS_URL
},
{
name
:
'
pw_feature:security_score_exp
'
,
value
:
'
true
'
},
// eslint-disable-next-line @typescript-eslint/no-explicit-any
])
as
any
,
});
testWithScoreFeature
(
'
with scores +@mobile +@dark-mode
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
MARKETPLACE_CONFIG_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
appsMock
),
}));
await
page
.
route
(
MARKETPLACE_SECURITY_REPORTS_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
securityReportsMock
),
}));
await
Promise
.
all
(
appsMock
.
map
(
app
=>
page
.
route
(
app
.
logo
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
path
:
'
./playwright/mocks/image_s.jpg
'
,
}),
),
));
const
component
=
await
mount
(
<
TestApp
>
<
Marketplace
/>
</
TestApp
>,
);
await
component
.
getByText
(
'
Apps scores
'
).
click
();
await
expect
(
component
).
toHaveScreenshot
();
});
ui/pages/__screenshots__/Marketplace.pw.tsx_dark-color-mode_with-scores-mobile-dark-mode-1.png
0 → 100644
View file @
e3e8dbbc
52.3 KB
ui/pages/__screenshots__/Marketplace.pw.tsx_default_with-scores-mobile-dark-mode-1.png
0 → 100644
View file @
e3e8dbbc
51.1 KB
ui/pages/__screenshots__/Marketplace.pw.tsx_mobile_with-scores-mobile-dark-mode-1.png
0 → 100644
View file @
e3e8dbbc
36.7 KB
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