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
4f37e0b9
Commit
4f37e0b9
authored
Nov 25, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BlocksContent tests
parent
bb5b5fac
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
89 additions
and
9 deletions
+89
-9
tasks.json
.vscode/tasks.json
+7
-0
block.ts
mocks/blocks/block.ts
+49
-2
index.ts
playwright/index.ts
+1
-1
block.ts
types/api/block.ts
+4
-4
reward.ts
types/api/reward.ts
+1
-1
BlockDetails.tsx
ui/block/BlockDetails.tsx
+1
-1
BlocksContent.pw.tsx
ui/blocks/BlocksContent.pw.tsx
+26
-0
BlocksContent.pw.tsx_default_base-view-mobile-1.png
...ots__/BlocksContent.pw.tsx_default_base-view-mobile-1.png
+0
-0
BlocksContent.pw.tsx_mobile_base-view-mobile-1.png
...hots__/BlocksContent.pw.tsx_mobile_base-view-mobile-1.png
+0
-0
No files found.
.vscode/tasks.json
View file @
4f37e0b9
...
@@ -113,6 +113,7 @@
...
@@ -113,6 +113,7 @@
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"always"
,
"reveal"
:
"always"
,
"panel"
:
"new"
,
"panel"
:
"new"
,
"focus"
:
true
,
},
},
"icon"
:
{
"icon"
:
{
"color"
:
"terminal.ansiBlue"
,
"color"
:
"terminal.ansiBlue"
,
...
@@ -131,6 +132,7 @@
...
@@ -131,6 +132,7 @@
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"always"
,
"reveal"
:
"always"
,
"panel"
:
"new"
,
"panel"
:
"new"
,
"focus"
:
true
,
},
},
"icon"
:
{
"icon"
:
{
"color"
:
"terminal.ansiBlue"
,
"color"
:
"terminal.ansiBlue"
,
...
@@ -149,6 +151,7 @@
...
@@ -149,6 +151,7 @@
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"always"
,
"reveal"
:
"always"
,
"panel"
:
"new"
,
"panel"
:
"new"
,
"focus"
:
true
,
},
},
"icon"
:
{
"icon"
:
{
"color"
:
"terminal.ansiBlue"
,
"color"
:
"terminal.ansiBlue"
,
...
@@ -169,6 +172,7 @@
...
@@ -169,6 +172,7 @@
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"always"
,
"reveal"
:
"always"
,
"panel"
:
"new"
,
"panel"
:
"new"
,
"focus"
:
true
,
},
},
"icon"
:
{
"icon"
:
{
"color"
:
"terminal.ansiBlue"
,
"color"
:
"terminal.ansiBlue"
,
...
@@ -188,6 +192,7 @@
...
@@ -188,6 +192,7 @@
"reveal"
:
"always"
,
"reveal"
:
"always"
,
"panel"
:
"new"
,
"panel"
:
"new"
,
"close"
:
true
,
"close"
:
true
,
"focus"
:
true
,
},
},
"icon"
:
{
"icon"
:
{
"color"
:
"terminal.ansiBlue"
,
"color"
:
"terminal.ansiBlue"
,
...
@@ -206,6 +211,7 @@
...
@@ -206,6 +211,7 @@
"presentation"
:
{
"presentation"
:
{
"reveal"
:
"always"
,
"reveal"
:
"always"
,
"panel"
:
"new"
,
"panel"
:
"new"
,
"focus"
:
true
,
},
},
"icon"
:
{
"icon"
:
{
"color"
:
"terminal.ansiBlue"
,
"color"
:
"terminal.ansiBlue"
,
...
@@ -227,6 +233,7 @@
...
@@ -227,6 +233,7 @@
"panel"
:
"new"
,
"panel"
:
"new"
,
"close"
:
true
,
"close"
:
true
,
"revealProblems"
:
"onProblem"
,
"revealProblems"
:
"onProblem"
,
"focus"
:
true
,
},
},
"icon"
:
{
"icon"
:
{
"color"
:
"terminal.ansiRed"
,
"color"
:
"terminal.ansiRed"
,
...
...
mocks/blocks/block.ts
View file @
4f37e0b9
export
const
base
=
{
import
type
{
Block
,
BlocksResponse
}
from
'
types/api/block
'
;
export
const
base
:
Block
=
{
base_fee_per_gas
:
'
10000000000
'
,
base_fee_per_gas
:
'
10000000000
'
,
burnt_fees
:
'
5449200000000000
'
,
burnt_fees
:
'
5449200000000000
'
,
burnt_fees_percentage
:
20.292245650793845
,
burnt_fees_percentage
:
20.292245650793845
,
...
@@ -39,7 +41,7 @@ export const base = {
...
@@ -39,7 +41,7 @@ export const base = {
],
],
size
:
2448
,
size
:
2448
,
state_root
:
'
TODO
'
,
state_root
:
'
TODO
'
,
timestamp
:
'
2022-1
0-24T11:46:05.000000
Z
'
,
timestamp
:
'
2022-1
1-11T11:59:35
Z
'
,
total_difficulty
:
'
10258276095980170141167591583995189665817672619
'
,
total_difficulty
:
'
10258276095980170141167591583995189665817672619
'
,
tx_count
:
5
,
tx_count
:
5
,
tx_fees
:
'
26853607500000000
'
,
tx_fees
:
'
26853607500000000
'
,
...
@@ -82,3 +84,48 @@ export const genesis = {
...
@@ -82,3 +84,48 @@ export const genesis = {
type
:
'
block
'
,
type
:
'
block
'
,
uncles_hashes
:
[],
uncles_hashes
:
[],
};
};
export
const
base2
:
Block
=
{
...
base
,
height
:
base
.
height
-
1
,
size
:
592
,
miner
:
{
hash
:
'
0xDfE10D55d9248B2ED66f1647df0b0A46dEb25165
'
,
implementation_name
:
null
,
is_contract
:
false
,
is_verified
:
null
,
name
:
'
Kiryl Ihnatsyeu
'
,
private_tags
:
[],
public_tags
:
[],
watchlist_names
:
[],
},
timestamp
:
'
2022-11-11T11:46:05Z
'
,
tx_count
:
253
,
gas_target_percentage
:
23.6433
,
gas_used
:
'
6333342
'
,
gas_used_percentage
:
87.859504
,
burnt_fees
:
'
232438000000000000
'
,
burnt_fees_percentage
:
65.3333333333334
,
rewards
:
[
{
reward
:
'
500000000000000000
'
,
type
:
'
Chore Reward
'
,
},
{
reward
:
'
1017432850000000000
'
,
type
:
'
Miner Reward
'
,
},
{
reward
:
'
500000000000000000
'
,
type
:
'
Emission Reward
'
,
},
],
};
export
const
baseListResponse
:
BlocksResponse
=
{
items
:
[
base
,
base2
,
],
next_page_params
:
null
,
};
playwright/index.ts
View file @
4f37e0b9
...
@@ -14,7 +14,7 @@ beforeMount(async({ hooksConfig }) => {
...
@@ -14,7 +14,7 @@ beforeMount(async({ hooksConfig }) => {
router
.
useRouter
=
()
=>
hooksConfig
?.
router
||
NEXT_ROUTER_MOCK
;
router
.
useRouter
=
()
=>
hooksConfig
?.
router
||
NEXT_ROUTER_MOCK
;
// set current date
// set current date
MockDate
.
set
(
'
2022-11-11
'
);
MockDate
.
set
(
'
2022-11-11
T12:00:00Z
'
);
});
});
export
{};
export
{};
types/api/block.ts
View file @
4f37e0b9
...
@@ -16,10 +16,10 @@ export interface Block {
...
@@ -16,10 +16,10 @@ export interface Block {
total_difficulty
:
string
;
total_difficulty
:
string
;
gas_used
:
string
|
null
;
gas_used
:
string
|
null
;
gas_limit
:
string
;
gas_limit
:
string
;
nonce
:
number
;
nonce
:
string
;
base_fee_per_gas
:
number
|
null
;
base_fee_per_gas
:
string
|
null
;
burnt_fees
:
number
|
null
;
burnt_fees
:
string
|
null
;
priority_fee
:
number
|
null
;
priority_fee
:
string
|
null
;
extra_data
:
string
|
null
;
extra_data
:
string
|
null
;
state_root
:
string
|
null
;
state_root
:
string
|
null
;
rewards
?:
Array
<
Reward
>
;
rewards
?:
Array
<
Reward
>
;
...
...
types/api/reward.ts
View file @
4f37e0b9
export
interface
Reward
{
export
interface
Reward
{
reward
:
string
;
reward
:
string
;
type
:
'
Miner Reward
'
|
'
Validator Reward
'
|
'
Emission Reward
'
|
'
Chore Reward
'
|
'
Uncle Reward
'
;
type
:
'
Miner Reward
'
|
'
Validator Reward
'
|
'
Emission Reward
'
|
'
Chore Reward
'
|
'
Uncle Reward
'
|
'
POA Mania Reward
'
;
}
}
ui/block/BlockDetails.tsx
View file @
4f37e0b9
...
@@ -228,7 +228,7 @@ const BlockDetails = () => {
...
@@ -228,7 +228,7 @@ const BlockDetails = () => {
</
Tooltip
>
</
Tooltip
>
)
}
)
}
</
DetailsInfoItem
>
</
DetailsInfoItem
>
{
data
.
priority_fee
!==
null
&&
data
.
priority_fee
>
0
&&
(
{
data
.
priority_fee
!==
null
&&
BigNumber
(
data
.
priority_fee
).
gt
(
ZERO
)
&&
(
<
DetailsInfoItem
<
DetailsInfoItem
title=
"Priority fee / Tip"
title=
"Priority fee / Tip"
hint=
"User-defined tips sent to validator for transaction priority/inclusion."
hint=
"User-defined tips sent to validator for transaction priority/inclusion."
...
...
ui/blocks/BlocksContent.pw.tsx
0 → 100644
View file @
4f37e0b9
import
{
test
,
expect
}
from
'
@playwright/experimental-ct-react
'
;
import
React
from
'
react
'
;
import
*
as
blockMock
from
'
mocks/blocks/block
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
BlocksContent
from
'
./BlocksContent
'
;
const
API_URL
=
'
/node-api/blocks
'
;
test
(
'
base view +@mobile
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
blockMock
.
baseListResponse
),
}));
const
component
=
await
mount
(
<
TestApp
>
<
BlocksContent
/>
</
TestApp
>,
);
await
page
.
waitForResponse
(
API_URL
),
await
expect
(
component
).
toHaveScreenshot
();
});
ui/blocks/__screenshots__/BlocksContent.pw.tsx_default_base-view-mobile-1.png
0 → 100644
View file @
4f37e0b9
34.9 KB
ui/blocks/__screenshots__/BlocksContent.pw.tsx_mobile_base-view-mobile-1.png
0 → 100644
View file @
4f37e0b9
48.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