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
f0fd51a4
Commit
f0fd51a4
authored
Sep 25, 2024
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ts
parent
a7a304ee
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
12 deletions
+13
-12
render.tsx
playwright/fixtures/render.tsx
+5
-9
lib.tsx
playwright/lib.tsx
+4
-1
MarketplaceAppModal.pw.tsx
ui/marketplace/MarketplaceAppModal.pw.tsx
+2
-1
MarketplaceApp.pw.tsx
ui/pages/MarketplaceApp.pw.tsx
+2
-1
No files found.
playwright/fixtures/render.tsx
View file @
f0fd51a4
...
...
@@ -4,8 +4,6 @@ import type { Locator, TestFixture } from '@playwright/test';
import
type
router
from
'
next/router
'
;
import
React
from
'
react
'
;
import
type
{
JsonObject
}
from
'
@playwright/experimental-ct-core/types/component
'
;
import
type
{
Props
as
TestAppProps
}
from
'
playwright/TestApp
'
;
import
TestApp
from
'
playwright/TestApp
'
;
...
...
@@ -14,15 +12,13 @@ interface MountResult extends Locator {
update
(
component
:
JSX
.
Element
):
Promise
<
void
>
;
}
type
Mount
=
<
HooksConfig
extends
JsonObject
>
(component: JSX.Element, options?: MountOptions
<
HooksConfig
>
) =
>
Promise
<
MountResult
>
;
interface Options extends JsonObject
{
hooksConfig
?:
{
router
:
Partial
<
Pick
<
typeof
router
,
'
query
'
|
'
isReady
'
|
'
asPath
'
|
'
pathname
'
>>
;
};
interface
AppHooksConfig
{
router
:
Partial
<
Pick
<
typeof
router
,
'
query
'
|
'
isReady
'
|
'
asPath
'
|
'
pathname
'
>>
;
}
export type RenderFixture = (component: JSX.Element, options?: Options, props?: Omit
<
TestAppProps
,
'
children
'
>
) =
>
Promise
<
MountResult
>
type
Mount
=
<
HooksConfig
extends
AppHooksConfig
>
(component: JSX.Element, options?: MountOptions
<
HooksConfig
>
) =
>
Promise
<
MountResult
>
export type RenderFixture = (component: JSX.Element, options?: MountOptions
<
AppHooksConfig
>
, props?: Omit
<
TestAppProps
,
'
children
'
>
) =
>
Promise
<
MountResult
>
const fixture: TestFixture
<
RenderFixture
,
{
mount
:
Mount
}
>
= async(
{
mount
}
, use) =
>
{
await
use
((
component
,
options
,
props
)
=>
{
...
...
playwright/lib.tsx
View file @
f0fd51a4
/* eslint-disable no-console */
import
{
test
as
base
}
from
'
@playwright/experimental-ct-react
'
;
import
type
{
Page
}
from
'
@playwright/test
'
;
import
*
as
injectMetaMaskProvider
from
'
./fixtures/injectMetaMaskProvider
'
;
import
*
as
mockApiResponse
from
'
./fixtures/mockApiResponse
'
;
...
...
@@ -13,7 +14,7 @@ import * as mockTextAd from './fixtures/mockTextAd';
import
*
as
render
from
'
./fixtures/render
'
;
import
*
as
socketServer
from
'
./fixtures/socketServer
'
;
interface
Fixtures
{
export
interface
Fixtures
{
render
:
render
.
RenderFixture
;
mockApiResponse
:
mockApiResponse
.
MockApiResponseFixture
;
mockAssetResponse
:
mockAssetResponse
.
MockAssetResponseFixture
;
...
...
@@ -27,6 +28,8 @@ interface Fixtures {
mockTextAd
:
mockTextAd
.
MockTextAdFixture
;
}
export
type
TestFnArgs
=
Fixtures
&
{
page
:
Page
};
const
test
=
base
.
extend
<
Fixtures
>
({
render
:
render
.
default
,
mockApiResponse
:
mockApiResponse
.
default
,
...
...
ui/marketplace/MarketplaceAppModal.pw.tsx
View file @
f0fd51a4
...
...
@@ -4,6 +4,7 @@ import type { MarketplaceAppWithSecurityReport } from 'types/client/marketplace'
import
{
apps
as
appsMock
}
from
'
mocks/apps/apps
'
;
import
{
securityReports
as
securityReportsMock
}
from
'
mocks/apps/securityReports
'
;
import
type
{
TestFnArgs
}
from
'
playwright/lib
'
;
import
{
test
,
expect
,
devices
}
from
'
playwright/lib
'
;
import
MarketplaceAppModal
from
'
./MarketplaceAppModal
'
;
...
...
@@ -28,7 +29,7 @@ const props = {
canRate
:
undefined
,
};
const
testFn
:
Parameters
<
typeof
test
>
[
1
]
=
async
({
render
,
page
,
mockAssetResponse
,
mockEnvs
}
)
=>
{
const
testFn
=
async
({
render
,
page
,
mockAssetResponse
,
mockEnvs
}:
TestFnArgs
)
=>
{
await
mockEnvs
([
[
'
NEXT_PUBLIC_MARKETPLACE_RATING_AIRTABLE_API_KEY
'
,
'
test
'
],
[
'
NEXT_PUBLIC_MARKETPLACE_RATING_AIRTABLE_BASE_ID
'
,
'
test
'
],
...
...
ui/pages/MarketplaceApp.pw.tsx
View file @
f0fd51a4
...
...
@@ -6,6 +6,7 @@ import config from 'configs/app';
import
{
apps
as
appsMock
}
from
'
mocks/apps/apps
'
;
import
{
ratings
as
ratingsMock
}
from
'
mocks/apps/ratings
'
;
import
{
securityReports
as
securityReportsMock
}
from
'
mocks/apps/securityReports
'
;
import
type
{
TestFnArgs
}
from
'
playwright/lib
'
;
import
{
test
,
expect
,
devices
}
from
'
playwright/lib
'
;
import
MarketplaceApp
from
'
./MarketplaceApp
'
;
...
...
@@ -20,7 +21,7 @@ const hooksConfig = {
const
MARKETPLACE_CONFIG_URL
=
'
http://localhost:4000/marketplace-config.json
'
;
const
MARKETPLACE_SECURITY_REPORTS_URL
=
'
http://localhost:4000/marketplace-security-reports.json
'
;
const
testFn
:
Parameters
<
typeof
test
>
[
1
]
=
async
({
render
,
mockConfigResponse
,
mockAssetResponse
,
mockEnvs
,
mockRpcResponse
,
page
}
)
=>
{
const
testFn
=
async
({
render
,
mockConfigResponse
,
mockAssetResponse
,
mockEnvs
,
mockRpcResponse
,
page
}:
TestFnArgs
)
=>
{
await
mockEnvs
([
[
'
NEXT_PUBLIC_MARKETPLACE_ENABLED
'
,
'
true
'
],
[
'
NEXT_PUBLIC_MARKETPLACE_CONFIG_URL
'
,
MARKETPLACE_CONFIG_URL
],
...
...
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