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
a1d394c3
Commit
a1d394c3
authored
May 13, 2024
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests
parent
a5b0110c
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
96 additions
and
14 deletions
+96
-14
publicTagTypes.ts
mocks/metadata/publicTagTypes.ts
+34
-0
PublicTagsSubmitForm.pw.tsx
ui/publicTags/submit/PublicTagsSubmitForm.pw.tsx
+37
-0
PublicTagsSubmitForm.tsx
ui/publicTags/submit/PublicTagsSubmitForm.tsx
+0
-14
PublicTagsSubmitResult.pw.tsx
ui/publicTags/submit/PublicTagsSubmitResult.pw.tsx
+25
-0
PublicTagsSubmitForm.pw.tsx_default_base-view-mobile-1.png
...ublicTagsSubmitForm.pw.tsx_default_base-view-mobile-1.png
+0
-0
PublicTagsSubmitForm.pw.tsx_mobile_base-view-mobile-1.png
...PublicTagsSubmitForm.pw.tsx_mobile_base-view-mobile-1.png
+0
-0
PublicTagsSubmitResult.pw.tsx_default_all-success-result-view-mobile-1.png
...esult.pw.tsx_default_all-success-result-view-mobile-1.png
+0
-0
PublicTagsSubmitResult.pw.tsx_default_mobile-result-with-errors-view-1.png
...esult.pw.tsx_default_mobile-result-with-errors-view-1.png
+0
-0
PublicTagsSubmitResult.pw.tsx_default_result-with-errors-view-1.png
...SubmitResult.pw.tsx_default_result-with-errors-view-1.png
+0
-0
PublicTagsSubmitResult.pw.tsx_mobile_all-success-result-view-mobile-1.png
...Result.pw.tsx_mobile_all-success-result-view-mobile-1.png
+0
-0
No files found.
mocks/metadata/publicTagTypes.ts
0 → 100644
View file @
a1d394c3
export
const
publicTagTypes
=
{
tagTypes
:
[
{
id
:
'
96f9db76-02fc-477d-a003-640a0c5e7e15
'
,
type
:
'
name
'
as
const
,
description
:
'
Alias for the address
'
,
},
{
id
:
'
e75f396e-f52a-44c9-8790-a1dbae496b72
'
,
type
:
'
generic
'
as
const
,
description
:
'
Group classification for the address
'
,
},
{
id
:
'
11a2d4f3-412e-4eb7-b663-86c6f48cdec3
'
,
type
:
'
information
'
as
const
,
description
:
'
Tags with custom data for the address, e.g. additional link to project, or classification details, or minor account details
'
,
},
{
id
:
'
d37443d4-748f-4314-a4a0-283b666e9f29
'
,
type
:
'
classifier
'
as
const
,
description
:
'
E.g. "ERC20", "Contract", "CEX", "DEX", "NFT"
'
,
},
{
id
:
'
ea9d0f91-9b46-44ff-be70-128bac468f6f
'
,
type
:
'
protocol
'
as
const
,
description
:
'
Special tag type for protocol-related contracts, e.g. for bridges
'
,
},
{
id
:
'
d2600acb-473c-445f-ac72-ed6fef53e06a
'
,
type
:
'
note
'
as
const
,
description
:
'
Short general-purpose description for the address
'
,
},
],
};
ui/publicTags/submit/PublicTagsSubmitForm.pw.tsx
0 → 100644
View file @
a1d394c3
import
{
Box
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
{
publicTagTypes
as
configMock
}
from
'
mocks/metadata/publicTagTypes
'
;
import
{
base
as
useInfoMock
}
from
'
mocks/user/profile
'
;
import
{
expect
,
test
}
from
'
playwright/lib
'
;
import
*
as
configs
from
'
playwright/utils/configs
'
;
import
*
as
mocks
from
'
./mocks
'
;
import
PublicTagsSubmitForm
from
'
./PublicTagsSubmitForm
'
;
const
onSubmitResult
=
()
=>
{};
test
(
'
base view +@mobile
'
,
async
({
render
})
=>
{
const
component
=
await
render
(
<
Box
sx=
{
{
'
.recaptcha
'
:
{
w
:
'
304px
'
,
h
:
'
78px
'
}
}
}
>
<
PublicTagsSubmitForm
config=
{
configMock
}
onSubmitResult=
{
onSubmitResult
}
userInfo=
{
useInfoMock
}
/>
</
Box
>,
);
await
component
.
getByLabel
(
/Smart contract
\/
Address/i
).
fill
(
mocks
.
address1
);
await
component
.
getByLabel
(
/add/i
).
nth
(
1
).
click
();
await
component
.
getByLabel
(
'
Tag (max 35 characters)*
'
).
fill
(
mocks
.
tag1
.
name
);
await
component
.
getByLabel
(
/label url/i
).
fill
(
mocks
.
tag1
.
meta
.
tagUrl
);
await
component
.
getByLabel
(
/background color/i
).
fill
(
mocks
.
tag1
.
meta
.
bgColor
.
replace
(
'
#
'
,
''
));
await
component
.
getByLabel
(
/text color/i
).
fill
(
mocks
.
tag1
.
meta
.
textColor
.
replace
(
'
#
'
,
''
));
await
component
.
getByLabel
(
/add/i
).
nth
(
3
).
click
();
await
component
.
getByLabel
(
/comment/i
).
focus
();
await
component
.
getByLabel
(
/comment/i
).
blur
();
await
expect
(
component
).
toHaveScreenshot
({
mask
:
[
component
.
locator
(
'
.recaptcha
'
)
],
maskColor
:
configs
.
maskColor
,
});
});
ui/publicTags/submit/PublicTagsSubmitForm.tsx
View file @
a1d394c3
...
@@ -23,7 +23,6 @@ import PublicTagsSubmitFieldDescription from './fields/PublicTagsSubmitFieldDesc
...
@@ -23,7 +23,6 @@ import PublicTagsSubmitFieldDescription from './fields/PublicTagsSubmitFieldDesc
import
PublicTagsSubmitFieldRequesterEmail
from
'
./fields/PublicTagsSubmitFieldRequesterEmail
'
;
import
PublicTagsSubmitFieldRequesterEmail
from
'
./fields/PublicTagsSubmitFieldRequesterEmail
'
;
import
PublicTagsSubmitFieldRequesterName
from
'
./fields/PublicTagsSubmitFieldRequesterName
'
;
import
PublicTagsSubmitFieldRequesterName
from
'
./fields/PublicTagsSubmitFieldRequesterName
'
;
import
PublicTagsSubmitFieldTags
from
'
./fields/PublicTagsSubmitFieldTags
'
;
import
PublicTagsSubmitFieldTags
from
'
./fields/PublicTagsSubmitFieldTags
'
;
import
*
as
mocks
from
'
./mocks
'
;
import
{
convertFormDataToRequestsBody
,
getFormDefaultValues
}
from
'
./utils
'
;
import
{
convertFormDataToRequestsBody
,
getFormDefaultValues
}
from
'
./utils
'
;
interface
Props
{
interface
Props
{
...
@@ -54,10 +53,6 @@ const PublicTagsSubmitForm = ({ config, userInfo, onSubmitResult }: Props) => {
...
@@ -54,10 +53,6 @@ const PublicTagsSubmitForm = ({ config, userInfo, onSubmitResult }: Props) => {
}
}
},
[
router
.
query
.
addresses
,
router
]);
},
[
router
.
query
.
addresses
,
router
]);
const
handleMockClick
=
React
.
useCallback
(
async
()
=>
{
return
onSubmitResult
(
mocks
.
mixedResponses
);
},
[
onSubmitResult
]);
const
onFormSubmit
:
SubmitHandler
<
FormFields
>
=
React
.
useCallback
(
async
(
data
)
=>
{
const
onFormSubmit
:
SubmitHandler
<
FormFields
>
=
React
.
useCallback
(
async
(
data
)
=>
{
const
requestsBody
=
convertFormDataToRequestsBody
(
data
);
const
requestsBody
=
convertFormDataToRequestsBody
(
data
);
...
@@ -129,15 +124,6 @@ const PublicTagsSubmitForm = ({ config, userInfo, onSubmitResult }: Props) => {
...
@@ -129,15 +124,6 @@ const PublicTagsSubmitForm = ({ config, userInfo, onSubmitResult }: Props) => {
>
>
Send request
Send request
</
Button
>
</
Button
>
<
Button
onClick=
{
handleMockClick
}
size=
"lg"
mt=
{
3
}
colorScheme=
"gray"
w=
"min-content"
>
Mock
</
Button
>
</
Grid
>
</
Grid
>
</
chakra
.
form
>
</
chakra
.
form
>
</
FormProvider
>
</
FormProvider
>
...
...
ui/publicTags/submit/PublicTagsSubmitResult.pw.tsx
0 → 100644
View file @
a1d394c3
import
React
from
'
react
'
;
import
{
expect
,
test
,
devices
}
from
'
playwright/lib
'
;
import
*
as
mocks
from
'
./mocks
'
;
import
PublicTagsSubmitResult
from
'
./PublicTagsSubmitResult
'
;
test
(
'
all success result view +@mobile
'
,
async
({
render
})
=>
{
const
component
=
await
render
(<
PublicTagsSubmitResult
data=
{
mocks
.
allSuccessResponses
}
/>);
await
expect
(
component
).
toHaveScreenshot
();
});
test
(
'
result with errors view
'
,
async
({
render
})
=>
{
const
component
=
await
render
(<
PublicTagsSubmitResult
data=
{
mocks
.
mixedResponses
}
/>);
await
expect
(
component
).
toHaveScreenshot
();
});
test
.
describe
(
'
mobile
'
,
()
=>
{
test
.
use
({
viewport
:
devices
[
'
iPhone 13 Pro
'
].
viewport
});
test
(
'
result with errors view
'
,
async
({
render
})
=>
{
const
component
=
await
render
(<
PublicTagsSubmitResult
data=
{
mocks
.
mixedResponses
}
/>);
await
expect
(
component
).
toHaveScreenshot
();
});
});
ui/publicTags/submit/__screenshots__/PublicTagsSubmitForm.pw.tsx_default_base-view-mobile-1.png
0 → 100644
View file @
a1d394c3
98.6 KB
ui/publicTags/submit/__screenshots__/PublicTagsSubmitForm.pw.tsx_mobile_base-view-mobile-1.png
0 → 100644
View file @
a1d394c3
77.5 KB
ui/publicTags/submit/__screenshots__/PublicTagsSubmitResult.pw.tsx_default_all-success-result-view-mobile-1.png
0 → 100644
View file @
a1d394c3
61.9 KB
ui/publicTags/submit/__screenshots__/PublicTagsSubmitResult.pw.tsx_default_mobile-result-with-errors-view-1.png
0 → 100644
View file @
a1d394c3
72.3 KB
ui/publicTags/submit/__screenshots__/PublicTagsSubmitResult.pw.tsx_default_result-with-errors-view-1.png
0 → 100644
View file @
a1d394c3
95.7 KB
ui/publicTags/submit/__screenshots__/PublicTagsSubmitResult.pw.tsx_mobile_all-success-result-view-mobile-1.png
0 → 100644
View file @
a1d394c3
40 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