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
a1670d0f
Commit
a1670d0f
authored
May 21, 2024
by
isstuev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove unsupported features from search results
parent
6cdaafc0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
11 deletions
+35
-11
mockEnvs.ts
playwright/fixtures/mockEnvs.ts
+6
-0
SearchResults.pw.tsx
ui/pages/SearchResults.pw.tsx
+4
-2
SearchResults.tsx
ui/pages/SearchResults.tsx
+11
-2
utils.ts
ui/shared/search/utils.ts
+8
-2
SearchBar.pw.tsx
ui/snippets/searchBar/SearchBar.pw.tsx
+6
-5
No files found.
playwright/fixtures/mockEnvs.ts
View file @
a1670d0f
...
@@ -63,4 +63,10 @@ export const ENVS_MAP: Record<string, Array<[string, string]>> = {
...
@@ -63,4 +63,10 @@ export const ENVS_MAP: Record<string, Array<[string, string]>> = {
noNftMarketplaces
:
[
noNftMarketplaces
:
[
[
'
NEXT_PUBLIC_VIEWS_NFT_MARKETPLACES
'
,
''
],
[
'
NEXT_PUBLIC_VIEWS_NFT_MARKETPLACES
'
,
''
],
],
],
dataAvailability
:
[
[
'
NEXT_PUBLIC_DATA_AVAILABILITY_ENABLED
'
,
'
true
'
],
],
nameService
:
[
[
'
NEXT_PUBLIC_NAME_SERVICE_API_HOST
'
,
'
https://localhost:3101
'
],
],
};
};
ui/pages/SearchResults.pw.tsx
View file @
a1670d0f
...
@@ -100,7 +100,7 @@ test('search by tx hash +@mobile', async({ render, mockApiResponse }) => {
...
@@ -100,7 +100,7 @@ test('search by tx hash +@mobile', async({ render, mockApiResponse }) => {
await
expect
(
component
.
locator
(
'
main
'
)).
toHaveScreenshot
();
await
expect
(
component
.
locator
(
'
main
'
)).
toHaveScreenshot
();
});
});
test
(
'
search by blob hash +@mobile
'
,
async
({
render
,
mockApiResponse
})
=>
{
test
(
'
search by blob hash +@mobile
'
,
async
({
render
,
mockApiResponse
,
mockEnvs
})
=>
{
const
hooksConfig
=
{
const
hooksConfig
=
{
router
:
{
router
:
{
query
:
{
q
:
searchMock
.
blob1
.
blob_hash
},
query
:
{
q
:
searchMock
.
blob1
.
blob_hash
},
...
@@ -110,13 +110,14 @@ test('search by blob hash +@mobile', async({ render, mockApiResponse }) => {
...
@@ -110,13 +110,14 @@ test('search by blob hash +@mobile', async({ render, mockApiResponse }) => {
items
:
[
searchMock
.
blob1
],
items
:
[
searchMock
.
blob1
],
next_page_params
:
null
,
next_page_params
:
null
,
};
};
await
mockEnvs
(
ENVS_MAP
.
dataAvailability
);
await
mockApiResponse
(
'
search
'
,
data
,
{
queryParams
:
{
q
:
searchMock
.
blob1
.
blob_hash
}
});
await
mockApiResponse
(
'
search
'
,
data
,
{
queryParams
:
{
q
:
searchMock
.
blob1
.
blob_hash
}
});
const
component
=
await
render
(<
SearchResults
/>,
{
hooksConfig
});
const
component
=
await
render
(<
SearchResults
/>,
{
hooksConfig
});
await
expect
(
component
.
locator
(
'
main
'
)).
toHaveScreenshot
();
await
expect
(
component
.
locator
(
'
main
'
)).
toHaveScreenshot
();
});
});
test
(
'
search by domain name +@mobile
'
,
async
({
render
,
mockApiResponse
})
=>
{
test
(
'
search by domain name +@mobile
'
,
async
({
render
,
mockApiResponse
,
mockEnvs
})
=>
{
const
hooksConfig
=
{
const
hooksConfig
=
{
router
:
{
router
:
{
query
:
{
q
:
searchMock
.
domain1
.
ens_info
.
name
},
query
:
{
q
:
searchMock
.
domain1
.
ens_info
.
name
},
...
@@ -126,6 +127,7 @@ test('search by domain name +@mobile', async({ render, mockApiResponse }) => {
...
@@ -126,6 +127,7 @@ test('search by domain name +@mobile', async({ render, mockApiResponse }) => {
items
:
[
searchMock
.
domain1
],
items
:
[
searchMock
.
domain1
],
next_page_params
:
null
,
next_page_params
:
null
,
};
};
await
mockEnvs
(
ENVS_MAP
.
nameService
);
await
mockApiResponse
(
'
search
'
,
data
,
{
queryParams
:
{
q
:
searchMock
.
domain1
.
ens_info
.
name
}
});
await
mockApiResponse
(
'
search
'
,
data
,
{
queryParams
:
{
q
:
searchMock
.
domain1
.
ens_info
.
name
}
});
const
component
=
await
render
(<
SearchResults
/>,
{
hooksConfig
});
const
component
=
await
render
(<
SearchResults
/>,
{
hooksConfig
});
await
expect
(
component
.
locator
(
'
main
'
)).
toHaveScreenshot
();
await
expect
(
component
.
locator
(
'
main
'
)).
toHaveScreenshot
();
...
...
ui/pages/SearchResults.tsx
View file @
a1670d0f
...
@@ -61,8 +61,11 @@ const SearchResultsPageContent = () => {
...
@@ -61,8 +61,11 @@ const SearchResultsPageContent = () => {
break
;
break
;
}
}
case
'
blob
'
:
{
case
'
blob
'
:
{
router
.
replace
({
pathname
:
'
/blobs/[hash]
'
,
query
:
{
hash
:
redirectCheckQuery
.
data
.
parameter
}
});
if
(
config
.
features
.
dataAvailability
.
isEnabled
)
{
return
;
router
.
replace
({
pathname
:
'
/blobs/[hash]
'
,
query
:
{
hash
:
redirectCheckQuery
.
data
.
parameter
}
});
return
;
}
break
;
}
}
}
}
}
}
...
@@ -78,6 +81,12 @@ const SearchResultsPageContent = () => {
...
@@ -78,6 +81,12 @@ const SearchResultsPageContent = () => {
if
(
!
config
.
features
.
userOps
.
isEnabled
&&
item
.
type
===
'
user_operation
'
)
{
if
(
!
config
.
features
.
userOps
.
isEnabled
&&
item
.
type
===
'
user_operation
'
)
{
return
false
;
return
false
;
}
}
if
(
!
config
.
features
.
dataAvailability
.
isEnabled
&&
item
.
type
===
'
blob
'
)
{
return
false
;
}
if
(
!
config
.
features
.
nameService
.
isEnabled
&&
item
.
type
===
'
ens_domain
'
)
{
return
false
;
}
return
true
;
return
true
;
});
});
...
...
ui/shared/search/utils.ts
View file @
a1670d0f
...
@@ -17,20 +17,26 @@ export type SearchResultAppItem = {
...
@@ -17,20 +17,26 @@ export type SearchResultAppItem = {
export
const
searchCategories
:
Array
<
{
id
:
Category
;
title
:
string
}
>
=
[
export
const
searchCategories
:
Array
<
{
id
:
Category
;
title
:
string
}
>
=
[
{
id
:
'
app
'
,
title
:
'
DApps
'
},
{
id
:
'
app
'
,
title
:
'
DApps
'
},
{
id
:
'
domain
'
,
title
:
'
Names
'
},
{
id
:
'
token
'
,
title
:
'
Tokens (ERC-20)
'
},
{
id
:
'
token
'
,
title
:
'
Tokens (ERC-20)
'
},
{
id
:
'
nft
'
,
title
:
'
NFTs (ERC-721 & 1155)
'
},
{
id
:
'
nft
'
,
title
:
'
NFTs (ERC-721 & 1155)
'
},
{
id
:
'
address
'
,
title
:
'
Addresses
'
},
{
id
:
'
address
'
,
title
:
'
Addresses
'
},
{
id
:
'
public_tag
'
,
title
:
'
Public tags
'
},
{
id
:
'
public_tag
'
,
title
:
'
Public tags
'
},
{
id
:
'
transaction
'
,
title
:
'
Transactions
'
},
{
id
:
'
transaction
'
,
title
:
'
Transactions
'
},
{
id
:
'
block
'
,
title
:
'
Blocks
'
},
{
id
:
'
block
'
,
title
:
'
Blocks
'
},
{
id
:
'
blob
'
,
title
:
'
Blobs
'
},
];
];
if
(
config
.
features
.
userOps
.
isEnabled
)
{
if
(
config
.
features
.
userOps
.
isEnabled
)
{
searchCategories
.
push
({
id
:
'
user_operation
'
,
title
:
'
User operations
'
});
searchCategories
.
push
({
id
:
'
user_operation
'
,
title
:
'
User operations
'
});
}
}
if
(
config
.
features
.
dataAvailability
.
isEnabled
)
{
searchCategories
.
push
({
id
:
'
blob
'
,
title
:
'
Blobs
'
});
}
if
(
config
.
features
.
nameService
.
isEnabled
)
{
searchCategories
.
push
({
id
:
'
domain
'
,
title
:
'
Names
'
});
}
export
const
searchItemTitles
:
Record
<
Category
,
{
itemTitle
:
string
;
itemTitleShort
:
string
}
>
=
{
export
const
searchItemTitles
:
Record
<
Category
,
{
itemTitle
:
string
;
itemTitleShort
:
string
}
>
=
{
app
:
{
itemTitle
:
'
DApp
'
,
itemTitleShort
:
'
App
'
},
app
:
{
itemTitle
:
'
DApp
'
,
itemTitleShort
:
'
App
'
},
domain
:
{
itemTitle
:
'
Name
'
,
itemTitleShort
:
'
Name
'
},
domain
:
{
itemTitle
:
'
Name
'
,
itemTitleShort
:
'
Name
'
},
...
...
ui/snippets/searchBar/SearchBar.pw.tsx
View file @
a1670d0f
...
@@ -2,6 +2,7 @@ import React from 'react';
...
@@ -2,6 +2,7 @@ import React from 'react';
import
{
apps
as
appsMock
}
from
'
mocks/apps/apps
'
;
import
{
apps
as
appsMock
}
from
'
mocks/apps/apps
'
;
import
*
as
searchMock
from
'
mocks/search/index
'
;
import
*
as
searchMock
from
'
mocks/search/index
'
;
import
{
ENVS_MAP
}
from
'
playwright/fixtures/mockEnvs
'
;
import
{
test
,
expect
}
from
'
playwright/lib
'
;
import
{
test
,
expect
}
from
'
playwright/lib
'
;
import
SearchBar
from
'
./SearchBar
'
;
import
SearchBar
from
'
./SearchBar
'
;
...
@@ -109,7 +110,8 @@ test('search by tx hash +@mobile', async({ render, page, mockApiResponse }) => {
...
@@ -109,7 +110,8 @@ test('search by tx hash +@mobile', async({ render, page, mockApiResponse }) => {
await
expect
(
page
).
toHaveScreenshot
({
clip
:
{
x
:
0
,
y
:
0
,
width
:
1200
,
height
:
300
}
});
await
expect
(
page
).
toHaveScreenshot
({
clip
:
{
x
:
0
,
y
:
0
,
width
:
1200
,
height
:
300
}
});
});
});
test
(
'
search by blob hash +@mobile
'
,
async
({
render
,
page
,
mockApiResponse
})
=>
{
test
(
'
search by blob hash +@mobile
'
,
async
({
render
,
page
,
mockApiResponse
,
mockEnvs
})
=>
{
await
mockEnvs
(
ENVS_MAP
.
dataAvailability
);
const
apiUrl
=
await
mockApiResponse
(
'
quick_search
'
,
[
const
apiUrl
=
await
mockApiResponse
(
'
quick_search
'
,
[
searchMock
.
blob1
,
searchMock
.
blob1
,
],
{
queryParams
:
{
q
:
searchMock
.
blob1
.
blob_hash
}
});
],
{
queryParams
:
{
q
:
searchMock
.
blob1
.
blob_hash
}
});
...
@@ -120,7 +122,8 @@ test('search by blob hash +@mobile', async({ render, page, mockApiResponse }) =>
...
@@ -120,7 +122,8 @@ test('search by blob hash +@mobile', async({ render, page, mockApiResponse }) =>
await
expect
(
page
).
toHaveScreenshot
({
clip
:
{
x
:
0
,
y
:
0
,
width
:
1200
,
height
:
300
}
});
await
expect
(
page
).
toHaveScreenshot
({
clip
:
{
x
:
0
,
y
:
0
,
width
:
1200
,
height
:
300
}
});
});
});
test
(
'
search by domain name +@mobile
'
,
async
({
render
,
page
,
mockApiResponse
})
=>
{
test
(
'
search by domain name +@mobile
'
,
async
({
render
,
page
,
mockApiResponse
,
mockEnvs
})
=>
{
await
mockEnvs
(
ENVS_MAP
.
nameService
);
const
apiUrl
=
await
mockApiResponse
(
'
quick_search
'
,
[
const
apiUrl
=
await
mockApiResponse
(
'
quick_search
'
,
[
searchMock
.
domain1
,
searchMock
.
domain1
,
],
{
queryParams
:
{
q
:
searchMock
.
domain1
.
ens_info
.
name
}
});
],
{
queryParams
:
{
q
:
searchMock
.
domain1
.
ens_info
.
name
}
});
...
@@ -133,9 +136,7 @@ test('search by domain name +@mobile', async({ render, page, mockApiResponse })
...
@@ -133,9 +136,7 @@ test('search by domain name +@mobile', async({ render, page, mockApiResponse })
});
});
test
(
'
search by user op hash +@mobile
'
,
async
({
render
,
page
,
mockApiResponse
,
mockEnvs
})
=>
{
test
(
'
search by user op hash +@mobile
'
,
async
({
render
,
page
,
mockApiResponse
,
mockEnvs
})
=>
{
await
mockEnvs
([
await
mockEnvs
(
ENVS_MAP
.
userOps
);
[
'
NEXT_PUBLIC_HAS_USER_OPS
'
,
'
true
'
],
]);
const
apiUrl
=
await
mockApiResponse
(
'
quick_search
'
,
[
const
apiUrl
=
await
mockApiResponse
(
'
quick_search
'
,
[
searchMock
.
userOp1
,
searchMock
.
userOp1
,
],
{
queryParams
:
{
q
:
searchMock
.
tx1
.
tx_hash
}
});
],
{
queryParams
:
{
q
:
searchMock
.
tx1
.
tx_hash
}
});
...
...
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