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
cd6567ba
Unverified
Commit
cd6567ba
authored
Jan 09, 2023
by
tom goriunov
Committed by
GitHub
Jan 09, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #501 from blockscout/address-balance-history-tests
tests for address balance history tab
parents
5408b9f6
08865317
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
112 additions
and
4 deletions
+112
-4
coinBalanceHistory.ts
mocks/address/coinBalanceHistory.ts
+61
-1
address.ts
types/api/address.ts
+1
-1
AddressCoinBalance.pw.tsx
ui/address/AddressCoinBalance.pw.tsx
+41
-0
AddressCoinBalance.pw.tsx_dark-color-mode_base-view-dark-mode-mobile-1.png
...e.pw.tsx_dark-color-mode_base-view-dark-mode-mobile-1.png
+0
-0
AddressCoinBalance.pw.tsx_default_base-view-dark-mode-mobile-1.png
...inBalance.pw.tsx_default_base-view-dark-mode-mobile-1.png
+0
-0
AddressCoinBalance.pw.tsx_mobile_base-view-dark-mode-mobile-1.png
...oinBalance.pw.tsx_mobile_base-view-dark-mode-mobile-1.png
+0
-0
ChartArea.tsx
ui/shared/chart/ChartArea.tsx
+8
-1
ChartWidgetGraph.tsx
ui/shared/chart/ChartWidgetGraph.tsx
+1
-1
No files found.
mocks/address/coinBalanceHistory.ts
View file @
cd6567ba
export
const
base
=
{
import
type
{
AddressCoinBalanceHistoryItem
,
AddressCoinBalanceHistoryResponse
,
AddressCoinBalanceHistoryChart
}
from
'
types/api/address
'
;
export
const
base
:
AddressCoinBalanceHistoryItem
=
{
block_number
:
30367643
,
block_number
:
30367643
,
block_timestamp
:
'
2022-12-11T17:55:20Z
'
,
block_timestamp
:
'
2022-12-11T17:55:20Z
'
,
delta
:
'
-5568096000000000
'
,
delta
:
'
-5568096000000000
'
,
transaction_hash
:
null
,
transaction_hash
:
null
,
value
:
'
107014805905725000000
'
,
value
:
'
107014805905725000000
'
,
};
};
export
const
baseResponse
:
AddressCoinBalanceHistoryResponse
=
{
items
:
[
{
block_number
:
30367643
,
block_timestamp
:
'
2022-10-11T17:55:20Z
'
,
delta
:
'
-2105682233848856
'
,
transaction_hash
:
null
,
value
:
'
10102109526582662088
'
,
},
{
block_number
:
30367234
,
block_timestamp
:
'
2022-10-01T17:55:20Z
'
,
delta
:
'
1933020674364000
'
,
transaction_hash
:
'
0x62d597ebcf3e8d60096dd0363bc2f0f5e2df27ba1dacd696c51aa7c9409f3193
'
,
value
:
'
10143933697708939226
'
,
},
{
block_number
:
30363402
,
block_timestamp
:
'
2022-09-03T17:55:20Z
'
,
delta
:
'
-1448410607186694
'
,
transaction_hash
:
null
,
value
:
'
10142485287101752532
'
,
},
],
next_page_params
:
null
,
};
export
const
chartResponse
:
AddressCoinBalanceHistoryChart
=
[
{
date
:
'
2022-11-02
'
,
value
:
'
128238612887883515
'
,
},
{
date
:
'
2022-11-03
'
,
value
:
'
199807583157570922
'
,
},
{
date
:
'
2022-11-04
'
,
value
:
'
114487912907005778
'
,
},
{
date
:
'
2022-11-05
'
,
value
:
'
219533112907005778
'
,
},
{
date
:
'
2022-11-06
'
,
value
:
'
116487912907005778
'
,
},
{
date
:
'
2022-11-07
'
,
value
:
'
199807583157570922
'
,
},
{
date
:
'
2022-11-08
'
,
value
:
'
216488112907005778
'
,
},
];
types/api/address.ts
View file @
cd6567ba
...
@@ -88,7 +88,7 @@ export interface AddressCoinBalanceHistoryResponse {
...
@@ -88,7 +88,7 @@ export interface AddressCoinBalanceHistoryResponse {
next_page_params
:
{
next_page_params
:
{
block_number
:
number
;
block_number
:
number
;
items_count
:
number
;
items_count
:
number
;
};
}
|
null
;
}
}
export
type
AddressCoinBalanceHistoryChart
=
Array
<
{
export
type
AddressCoinBalanceHistoryChart
=
Array
<
{
...
...
ui/address/AddressCoinBalance.pw.tsx
0 → 100644
View file @
cd6567ba
import
{
test
,
expect
}
from
'
@playwright/experimental-ct-react
'
;
import
React
from
'
react
'
;
import
*
as
balanceHistoryMock
from
'
mocks/address/coinBalanceHistory
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
import
AddressCoinBalance
from
'
./AddressCoinBalance
'
;
const
addressHash
=
'
hash
'
;
const
BALANCE_HISTORY_API_URL
=
buildApiUrl
(
'
address_coin_balance
'
,
{
id
:
addressHash
});
const
BALANCE_HISTORY_CHART_API_URL
=
buildApiUrl
(
'
address_coin_balance_chart
'
,
{
id
:
addressHash
});
const
hooksConfig
=
{
router
:
{
query
:
{
id
:
addressHash
},
},
};
test
(
'
base view +@dark-mode +@mobile
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
BALANCE_HISTORY_API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
balanceHistoryMock
.
baseResponse
),
}));
await
page
.
route
(
BALANCE_HISTORY_CHART_API_URL
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
balanceHistoryMock
.
chartResponse
),
}));
const
component
=
await
mount
(
<
TestApp
>
<
AddressCoinBalance
/>
</
TestApp
>,
{
hooksConfig
},
);
await
page
.
waitForFunction
(()
=>
{
return
document
.
querySelector
(
'
path[data-name="chart-Balances-small"]
'
)?.
getAttribute
(
'
opacity
'
)
===
'
1
'
;
});
await
page
.
mouse
.
move
(
240
,
100
);
await
expect
(
component
).
toHaveScreenshot
();
});
ui/address/__screenshots__/AddressCoinBalance.pw.tsx_dark-color-mode_base-view-dark-mode-mobile-1.png
0 → 100644
View file @
cd6567ba
55.9 KB
ui/address/__screenshots__/AddressCoinBalance.pw.tsx_default_base-view-dark-mode-mobile-1.png
0 → 100644
View file @
cd6567ba
52.3 KB
ui/address/__screenshots__/AddressCoinBalance.pw.tsx_mobile_base-view-dark-mode-mobile-1.png
0 → 100644
View file @
cd6567ba
41.8 KB
ui/shared/chart/ChartArea.tsx
View file @
cd6567ba
...
@@ -47,7 +47,14 @@ const ChartArea = ({ id, xScale, yScale, color, data, disableAnimation, ...props
...
@@ -47,7 +47,14 @@ const ChartArea = ({ id, xScale, yScale, color, data, disableAnimation, ...props
return
(
return
(
<>
<>
<
path
ref=
{
ref
}
d=
{
d
}
fill=
{
color
?
`url(#${ gradientColorId })`
:
'
url(#gradient-chart-area-default)
'
}
opacity=
{
0
}
{
...
props
}
/>
<
path
ref=
{
ref
}
d=
{
d
}
fill=
{
color
?
`url(#${ gradientColorId })`
:
'
url(#gradient-chart-area-default)
'
}
opacity=
{
0
}
data
-
name=
{
id
||
'
gradient-chart-area
'
}
{
...
props
}
/>
{
color
?
(
{
color
?
(
<
defs
>
<
defs
>
<
linearGradient
id=
{
`${ gradientColorId }`
}
x1=
"0%"
x2=
"0%"
y1=
"0%"
y2=
"100%"
>
<
linearGradient
id=
{
`${ gradientColorId }`
}
x1=
"0%"
x2=
"0%"
y1=
"0%"
y2=
"100%"
>
...
...
ui/shared/chart/ChartWidgetGraph.tsx
View file @
cd6567ba
...
@@ -54,7 +54,7 @@ const ChartWidgetGraph = ({ isEnlarged, items, onZoom, isZoomResetInitial, title
...
@@ -54,7 +54,7 @@ const ChartWidgetGraph = ({ isEnlarged, items, onZoom, isZoomResetInitial, title
},
[
isZoomResetInitial
]);
},
[
isZoomResetInitial
]);
return
(
return
(
<
svg
width=
{
width
||
'
100%
'
}
height=
{
height
||
'
auto
'
}
ref=
{
ref
}
cursor=
"pointer"
id=
{
chartId
}
opacity=
{
width
?
1
:
0
}
>
<
svg
width=
{
width
||
'
100%
'
}
height=
{
height
||
'
100%
'
}
ref=
{
ref
}
cursor=
"pointer"
id=
{
chartId
}
opacity=
{
width
?
1
:
0
}
>
<
g
transform=
{
`translate(${ CHART_MARGIN?.left || 0 },${ CHART_MARGIN?.top || 0 })`
}
>
<
g
transform=
{
`translate(${ CHART_MARGIN?.left || 0 },${ CHART_MARGIN?.top || 0 })`
}
>
<
ChartGridLine
<
ChartGridLine
...
...
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