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
76380a68
Commit
76380a68
authored
May 07, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add tests for AppActionButton
parent
adee51ee
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
105 additions
and
6 deletions
+105
-6
address.ts
mocks/metadata/address.ts
+6
-6
appActionButton.ts
mocks/metadata/appActionButton.ts
+38
-0
AppActionButton.pw.tsx
ui/shared/AppActionButton/AppActionButton.pw.tsx
+61
-0
AppActionButton.pw.tsx_dark-color-mode_button-without-styles-dark-mode-1.png
...tsx_dark-color-mode_button-without-styles-dark-mode-1.png
+0
-0
AppActionButton.pw.tsx_dark-color-mode_link-without-styles-dark-mode-1.png
...w.tsx_dark-color-mode_link-without-styles-dark-mode-1.png
+0
-0
AppActionButton.pw.tsx_default_button-with-styles-1.png
..._/AppActionButton.pw.tsx_default_button-with-styles-1.png
+0
-0
AppActionButton.pw.tsx_default_button-without-styles-dark-mode-1.png
...tton.pw.tsx_default_button-without-styles-dark-mode-1.png
+0
-0
AppActionButton.pw.tsx_default_link-with-styles-1.png
...s__/AppActionButton.pw.tsx_default_link-with-styles-1.png
+0
-0
AppActionButton.pw.tsx_default_link-without-styles-dark-mode-1.png
...Button.pw.tsx_default_link-without-styles-dark-mode-1.png
+0
-0
No files found.
mocks/metadata/address.ts
View file @
76380a68
...
@@ -63,15 +63,15 @@ export const protocolTag: AddressMetadataTagApi = {
...
@@ -63,15 +63,15 @@ export const protocolTag: AddressMetadataTagApi = {
};
};
export
const
protocolTagWithMeta
:
AddressMetadataTagApi
=
{
export
const
protocolTagWithMeta
:
AddressMetadataTagApi
=
{
slug
:
'
furucombo
'
,
slug
:
'
uniswap
'
,
name
:
'
Furucombo
'
,
name
:
'
Uniswap
'
,
tagType
:
'
protocol
'
,
tagType
:
'
protocol
'
,
ordinal
:
0
,
ordinal
:
0
,
meta
:
{
meta
:
{
appID
:
'
furucombo
'
,
appID
:
'
uniswap
'
,
appMarketplaceURL
:
'
https://
furucombo.app/decombo?chainId={chainId}&txHash={txHash}&utm_source=Blockscout
'
,
appMarketplaceURL
:
'
https://
example.com
'
,
appLogoURL
:
'
https://
blockscout-content.s3.amazonaws.com/furucombo-action-bt
n.svg
'
,
appLogoURL
:
'
https://
localhost:3100/ico
n.svg
'
,
appActionButtonText
:
'
Decombo
'
,
appActionButtonText
:
'
Swap
'
,
textColor
:
'
#FFFFFF
'
,
textColor
:
'
#FFFFFF
'
,
bgColor
:
'
#1B1B21
'
,
bgColor
:
'
#1B1B21
'
,
},
},
...
...
mocks/metadata/appActionButton.ts
0 → 100644
View file @
76380a68
import
type
{
AddressMetadataTagApi
}
from
'
types/api/addressMetadata
'
;
const
appID
=
'
uniswap
'
;
const
appMarketplaceURL
=
'
https://example.com
'
;
export
const
appLogoURL
=
'
https://localhost:3100/icon.svg
'
;
const
appActionButtonText
=
'
Swap
'
;
const
textColor
=
'
#FFFFFF
'
;
const
bgColor
=
'
#FF007A
'
;
export
const
buttonWithoutStyles
:
AddressMetadataTagApi
[
'
meta
'
]
=
{
appID
,
appMarketplaceURL
,
appLogoURL
,
appActionButtonText
,
};
export
const
linkWithoutStyles
:
AddressMetadataTagApi
[
'
meta
'
]
=
{
appMarketplaceURL
,
appLogoURL
,
appActionButtonText
,
};
export
const
buttonWithStyles
:
AddressMetadataTagApi
[
'
meta
'
]
=
{
appID
,
appMarketplaceURL
,
appLogoURL
,
appActionButtonText
,
textColor
,
bgColor
,
};
export
const
linkWithStyles
:
AddressMetadataTagApi
[
'
meta
'
]
=
{
appMarketplaceURL
,
appLogoURL
,
appActionButtonText
,
textColor
,
bgColor
,
};
ui/shared/AppActionButton/AppActionButton.pw.tsx
0 → 100644
View file @
76380a68
import
{
Flex
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
type
{
AddressMetadataTagFormatted
}
from
'
types/client/addressMetadata
'
;
import
*
as
actionButtonMetadataMock
from
'
mocks/metadata/appActionButton
'
;
import
{
test
,
expect
}
from
'
playwright/lib
'
;
import
AppActionButton
from
'
./AppActionButton
'
;
test
.
beforeEach
(
async
({
mockAssetResponse
})
=>
{
await
mockAssetResponse
(
actionButtonMetadataMock
.
appLogoURL
as
string
,
'
./playwright/mocks/image_s.jpg
'
);
});
test
(
'
button without styles +@dark-mode
'
,
async
({
render
})
=>
{
const
component
=
await
render
(
<
Flex
w=
"200px"
>
<
AppActionButton
data=
{
actionButtonMetadataMock
.
buttonWithoutStyles
as
NonNullable
<
AddressMetadataTagFormatted
[
'
meta
'
]
>
}
source=
"Txn"
/>
</
Flex
>,
);
await
expect
(
component
).
toHaveScreenshot
();
});
test
(
'
link without styles +@dark-mode
'
,
async
({
render
})
=>
{
const
component
=
await
render
(
<
Flex
w=
"200px"
>
<
AppActionButton
data=
{
actionButtonMetadataMock
.
linkWithoutStyles
as
NonNullable
<
AddressMetadataTagFormatted
[
'
meta
'
]
>
}
source=
"Txn"
/>
</
Flex
>,
);
await
expect
(
component
).
toHaveScreenshot
();
});
test
(
'
button with styles
'
,
async
({
render
})
=>
{
const
component
=
await
render
(
<
Flex
w=
"200px"
>
<
AppActionButton
data=
{
actionButtonMetadataMock
.
buttonWithStyles
as
NonNullable
<
AddressMetadataTagFormatted
[
'
meta
'
]
>
}
source=
"Txn"
/>
</
Flex
>,
);
await
expect
(
component
).
toHaveScreenshot
();
});
test
(
'
link with styles
'
,
async
({
render
})
=>
{
const
component
=
await
render
(
<
Flex
w=
"200px"
>
<
AppActionButton
data=
{
actionButtonMetadataMock
.
linkWithStyles
as
NonNullable
<
AddressMetadataTagFormatted
[
'
meta
'
]
>
}
source=
"Txn"
/>
</
Flex
>,
);
await
expect
(
component
).
toHaveScreenshot
();
});
ui/shared/AppActionButton/__screenshots__/AppActionButton.pw.tsx_dark-color-mode_button-without-styles-dark-mode-1.png
0 → 100644
View file @
76380a68
2.81 KB
ui/shared/AppActionButton/__screenshots__/AppActionButton.pw.tsx_dark-color-mode_link-without-styles-dark-mode-1.png
0 → 100644
View file @
76380a68
2.97 KB
ui/shared/AppActionButton/__screenshots__/AppActionButton.pw.tsx_default_button-with-styles-1.png
0 → 100644
View file @
76380a68
2.53 KB
ui/shared/AppActionButton/__screenshots__/AppActionButton.pw.tsx_default_button-without-styles-dark-mode-1.png
0 → 100644
View file @
76380a68
2.65 KB
ui/shared/AppActionButton/__screenshots__/AppActionButton.pw.tsx_default_link-with-styles-1.png
0 → 100644
View file @
76380a68
2.67 KB
ui/shared/AppActionButton/__screenshots__/AppActionButton.pw.tsx_default_link-without-styles-dark-mode-1.png
0 → 100644
View file @
76380a68
2.83 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