-
Notifications
You must be signed in to change notification settings - Fork 505
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into ylide-forum
- Loading branch information
Showing
35 changed files
with
427 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
export const solidityscanReportAverage = { | ||
scan_report: { | ||
scan_status: 'scan_done', | ||
scan_summary: { | ||
issue_severity_distribution: { | ||
critical: 0, | ||
gas: 1, | ||
high: 0, | ||
informational: 0, | ||
low: 2, | ||
medium: 0, | ||
}, | ||
lines_analyzed_count: 18, | ||
scan_time_taken: 1, | ||
score: '3.61', | ||
score_v2: '72.22', | ||
threat_score: '94.74', | ||
}, | ||
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', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { test, expect } from '@playwright/experimental-ct-react'; | ||
import React from 'react'; | ||
|
||
import * as solidityscanReportMock from 'mocks/contract/solidityscanReport'; | ||
import TestApp from 'playwright/TestApp'; | ||
import buildApiUrl from 'playwright/utils/buildApiUrl'; | ||
|
||
import SolidityscanReport from './SolidityscanReport'; | ||
|
||
const addressHash = 'hash'; | ||
const REPORT_API_URL = buildApiUrl('contract_solidityscan_report', { hash: addressHash }); | ||
|
||
test('average report +@dark-mode +@mobile', async({ mount, page }) => { | ||
await page.route(REPORT_API_URL, (route) => route.fulfill({ | ||
status: 200, | ||
body: JSON.stringify(solidityscanReportMock.solidityscanReportAverage), | ||
})); | ||
|
||
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('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 expect(page).toHaveScreenshot({ clip: { x: 0, y: 0, width: 400, height: 500 } }); | ||
}); |
Oops, something went wrong.