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
d2051262
Commit
d2051262
authored
Dec 25, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test fixes
parent
67311929
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
51 additions
and
32 deletions
+51
-32
buildApiUrl.ts
playwright/utils/buildApiUrl.ts
+9
-0
AddressInternalTxs.pw.tsx
ui/address/AddressInternalTxs.pw.tsx
+2
-3
AddressTxs.pw.tsx
ui/address/AddressTxs.pw.tsx
+2
-3
TokenSelect.pw.tsx
ui/address/tokenSelect/TokenSelect.pw.tsx
+3
-2
BlockDetails.pw.tsx
ui/block/BlockDetails.pw.tsx
+3
-2
LatestBlocks.pw.tsx
ui/home/LatestBlocks.pw.tsx
+3
-2
LatestTxs.pw.tsx
ui/home/LatestTxs.pw.tsx
+5
-4
Stats.pw.tsx
ui/home/Stats.pw.tsx
+2
-1
ChainIndicators.pw.tsx
ui/home/indicators/ChainIndicators.pw.tsx
+3
-2
Blocks.pw.tsx
ui/pages/Blocks.pw.tsx
+3
-2
Home.pw.tsx
ui/pages/Home.pw.tsx
+5
-4
Page.pw.tsx
ui/shared/Page/Page.pw.tsx
+2
-1
TokenTransfer.pw.tsx
ui/shared/TokenTransfer/TokenTransfer.pw.tsx
+2
-1
ProfileMenuDesktop.pw.tsx
ui/snippets/profileMenu/ProfileMenuDesktop.pw.tsx
+2
-2
TxDetails.pw.tsx
ui/tx/TxDetails.pw.tsx
+2
-1
TxInternals.pw.tsx
ui/tx/TxInternals.pw.tsx
+3
-2
No files found.
playwright/utils/buildApiUrl.ts
0 → 100644
View file @
d2051262
import
{
compile
}
from
'
path-to-regexp
'
;
import
type
{
ResourceName
}
from
'
lib/api/resources
'
;
import
{
RESOURCES
}
from
'
lib/api/resources
'
;
export
default
function
buildApiUrl
(
resourceName
:
ResourceName
,
pathParams
?:
Record
<
string
,
string
>
)
{
const
resource
=
RESOURCES
[
resourceName
];
return
compile
(
'
/proxy/poa/core
'
+
resource
.
path
)(
pathParams
);
}
ui/address/AddressInternalTxs.pw.tsx
View file @
d2051262
...
...
@@ -4,11 +4,12 @@ import React from 'react';
import
*
as
internalTxsMock
from
'
mocks/txs/internalTxs
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
import
AddressInternalTxs
from
'
./AddressInternalTxs
'
;
const
ADDRESS_HASH
=
internalTxsMock
.
base
.
from
.
hash
;
const
API_URL_TX_INTERNALS
=
`/node-api/addresses/
${
ADDRESS_HASH
}
/internal-transactions`
;
const
API_URL_TX_INTERNALS
=
buildApiUrl
(
'
address_internal_txs
'
,
{
id
:
ADDRESS_HASH
})
;
const
hooksConfig
=
{
router
:
{
query
:
{
id
:
ADDRESS_HASH
},
...
...
@@ -29,7 +30,5 @@ test('base view +@mobile', async({ mount, page }) => {
{
hooksConfig
},
);
await
page
.
waitForResponse
(
API_URL_TX_INTERNALS
),
await
expect
(
component
).
toHaveScreenshot
();
});
ui/address/AddressTxs.pw.tsx
View file @
d2051262
...
...
@@ -4,10 +4,11 @@ import React from 'react';
import
{
base
as
txMock
}
from
'
mocks/txs/tx
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
import
AddressTxs
from
'
./AddressTxs
'
;
const
API_URL
=
'
/node-api/addresses/0xd789a607CEac2f0E14867de4EB15b15C9FFB5859/transactions
'
;
const
API_URL
=
buildApiUrl
(
'
address_txs
'
,
{
id
:
'
0xd789a607CEac2f0E14867de4EB15b15C9FFB5859
'
})
;
const
hooksConfig
=
{
router
:
{
...
...
@@ -29,7 +30,5 @@ test('address txs +@mobile +@desktop-xl', async({ mount, page }) => {
{
hooksConfig
},
);
await
page
.
waitForResponse
(
API_URL
),
await
expect
(
component
).
toHaveScreenshot
();
});
ui/address/tokenSelect/TokenSelect.pw.tsx
View file @
d2051262
...
...
@@ -6,13 +6,14 @@ import * as coinBalanceMock from 'mocks/address/coinBalanceHistory';
import
*
as
tokenBalanceMock
from
'
mocks/address/tokenBalance
'
;
import
*
as
socketServer
from
'
playwright/fixtures/socketServer
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
import
MockAddressPage
from
'
ui/address/testUtils/MockAddressPage
'
;
import
TokenSelect
from
'
./TokenSelect
'
;
const
ASSET_URL
=
'
https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/poa/assets/0xb2a90505dc6680a7a695f7975d0d32EeF610f456/logo.png
'
;
const
TOKENS_API_URL
=
'
/node-api/addresses/1/token-balances
'
;
const
ADDRESS_API_URL
=
'
/node-api/addresses/1
'
;
const
TOKENS_API_URL
=
buildApiUrl
(
'
address_token_balances
'
,
{
id
:
'
1
'
})
;
const
ADDRESS_API_URL
=
buildApiUrl
(
'
address
'
,
{
id
:
'
1
'
})
;
const
hooksConfig
=
{
router
:
{
query
:
{
id
:
'
1
'
},
...
...
ui/block/BlockDetails.pw.tsx
View file @
d2051262
...
...
@@ -3,13 +3,14 @@ import React from 'react';
import
*
as
blockMock
from
'
mocks/blocks/block
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
import
BlockDetails
from
'
./BlockDetails
'
;
const
API_URL
=
'
/node-api/blocks/1
'
;
const
API_URL
=
buildApiUrl
(
'
block
'
,
{
id
:
'
1
'
})
;
const
hooksConfig
=
{
router
:
{
query
:
{
id
:
1
},
query
:
{
id
:
'
1
'
},
},
};
...
...
ui/home/LatestBlocks.pw.tsx
View file @
d2051262
...
...
@@ -5,11 +5,12 @@ import * as blockMock from 'mocks/blocks/block';
import
*
as
statsMock
from
'
mocks/stats/index
'
;
import
*
as
socketServer
from
'
playwright/fixtures/socketServer
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
import
LatestBlocks
from
'
./LatestBlocks
'
;
const
STATS_API_URL
=
'
/node-api/home-stats
'
;
const
BLOCKS_API_URL
=
'
/node-api/index/blocks
'
;
const
STATS_API_URL
=
buildApiUrl
(
'
homepage_stats
'
)
;
const
BLOCKS_API_URL
=
buildApiUrl
(
'
blocks
'
)
;
export
const
test
=
base
.
extend
<
socketServer
.
SocketServerFixture
>
({
createSocket
:
socketServer
.
createSocket
,
...
...
ui/home/LatestTxs.pw.tsx
View file @
d2051262
...
...
@@ -6,6 +6,7 @@ import * as statsMock from 'mocks/stats/index';
import
*
as
txMock
from
'
mocks/txs/tx
'
;
import
*
as
socketServer
from
'
playwright/fixtures/socketServer
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
import
LatestTxs
from
'
./LatestTxs
'
;
...
...
@@ -14,11 +15,11 @@ export const test = base.extend<socketServer.SocketServerFixture>({
});
test
(
'
default view +@mobile +@dark-mode
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
'
/node-api/home-stats
'
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
buildApiUrl
(
'
homepage_stats
'
)
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
statsMock
.
base
),
}));
await
page
.
route
(
'
/node-api/index/txs
'
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
buildApiUrl
(
'
homepage_txs
'
)
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
([
txMock
.
base
,
...
...
@@ -47,11 +48,11 @@ test.describe('socket', () => {
};
test
(
'
new item
'
,
async
({
mount
,
page
,
createSocket
})
=>
{
await
page
.
route
(
'
/node-api/home-stats
'
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
buildApiUrl
(
'
homepage_stats
'
)
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
statsMock
.
base
),
}));
await
page
.
route
(
'
/node-api/index/txs
'
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
buildApiUrl
(
'
homepage_txs
'
)
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
([
txMock
.
base
,
...
...
ui/home/Stats.pw.tsx
View file @
d2051262
...
...
@@ -4,10 +4,11 @@ import React from 'react';
import
*
as
statsMock
from
'
mocks/stats/index
'
;
import
contextWithEnvs
from
'
playwright/fixtures/contextWithEnvs
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
import
Stats
from
'
./Stats
'
;
const
API_URL
=
'
/node-api/home-stats
'
;
const
API_URL
=
buildApiUrl
(
'
homepage_stats
'
)
;
test
(
'
all items +@mobile +@dark-mode +@desktop-xl
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
API_URL
,
(
route
)
=>
route
.
fulfill
({
...
...
ui/home/indicators/ChainIndicators.pw.tsx
View file @
d2051262
...
...
@@ -4,11 +4,12 @@ import React from 'react';
import
*
as
dailyTxsMock
from
'
mocks/stats/daily_txs
'
;
import
*
as
statsMock
from
'
mocks/stats/index
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
import
ChainIndicators
from
'
./ChainIndicators
'
;
const
STATS_API_URL
=
'
/node-api/home-stats
'
;
const
TX_CHART_API_URL
=
'
/node-api/home-stats/charts/transactions
'
;
const
STATS_API_URL
=
buildApiUrl
(
'
homepage_stats
'
)
;
const
TX_CHART_API_URL
=
buildApiUrl
(
'
homepage_chart_txs
'
)
;
test
(
'
daily txs chart +@mobile +@dark-mode +@dark-mode-mobile
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
STATS_API_URL
,
(
route
)
=>
route
.
fulfill
({
...
...
ui/pages/Blocks.pw.tsx
View file @
d2051262
...
...
@@ -5,11 +5,12 @@ import * as blockMock from 'mocks/blocks/block';
import
*
as
statsMock
from
'
mocks/stats/index
'
;
import
*
as
socketServer
from
'
playwright/fixtures/socketServer
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
import
Blocks
from
'
./Blocks
'
;
const
BLOCKS_API_URL
=
'
/node-api/blocks
?type=block
'
;
const
STATS_API_URL
=
'
/node-api/home-stats
'
;
const
BLOCKS_API_URL
=
buildApiUrl
(
'
blocks
'
)
+
'
?type=block
'
;
const
STATS_API_URL
=
buildApiUrl
(
'
homepage_stats
'
)
;
const
hooksConfig
=
{
router
:
{
query
:
{
tab
:
'
blocks
'
},
...
...
ui/pages/Home.pw.tsx
View file @
d2051262
...
...
@@ -7,22 +7,23 @@ import * as statsMock from 'mocks/stats/index';
import
*
as
txMock
from
'
mocks/txs/tx
'
;
import
insertAdText
from
'
playwright/scripts/insertAdText
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
import
Home
from
'
./Home
'
;
test
(
'
default view -@default +@desktop-xl +@mobile +@dark-mode
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
'
/node-api/home-stats
'
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
buildApiUrl
(
'
homepage_stats
'
)
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
statsMock
.
base
),
}));
await
page
.
route
(
'
/node-api/index/blocks
'
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
buildApiUrl
(
'
homepage_blocks
'
)
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
([
blockMock
.
base
,
blockMock
.
base2
,
]),
}));
await
page
.
route
(
'
/node-api/index/txs
'
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
buildApiUrl
(
'
homepage_txs
'
)
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
([
txMock
.
base
,
...
...
@@ -30,7 +31,7 @@ test('default view -@default +@desktop-xl +@mobile +@dark-mode', async({ mount,
txMock
.
withTokenTransfer
,
]),
}));
await
page
.
route
(
'
/node-api/home-stats/charts/transactions
'
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
buildApiUrl
(
'
homepage_chart_txs
'
)
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
dailyTxsMock
.
base
),
}));
...
...
ui/shared/Page/Page.pw.tsx
View file @
d2051262
...
...
@@ -2,10 +2,11 @@ import { test, expect } from '@playwright/experimental-ct-react';
import
React
from
'
react
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
import
Page
from
'
./Page
'
;
const
API_URL
=
'
/node-api/index/indexing-status
'
;
const
API_URL
=
buildApiUrl
(
'
homepage_indexing_status
'
)
;
test
(
'
without indexing alert +@mobile
'
,
async
({
mount
})
=>
{
const
component
=
await
mount
(
...
...
ui/shared/TokenTransfer/TokenTransfer.pw.tsx
View file @
d2051262
...
...
@@ -4,10 +4,11 @@ import React from 'react';
import
*
as
tokenTransferMock
from
'
mocks/tokens/tokenTransfer
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
import
TokenTransfer
from
'
./TokenTransfer
'
;
const
API_URL
=
'
/node-api/transactions/1/token-transfers
'
;
const
API_URL
=
buildApiUrl
(
'
tx_token_transfers
'
,
{
id
:
'
1
'
})
;
test
(
'
without tx info +@mobile
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
API_URL
,
(
route
)
=>
route
.
fulfill
({
...
...
ui/snippets/profileMenu/ProfileMenuDesktop.pw.tsx
View file @
d2051262
import
{
test
,
expect
}
from
'
@playwright/experimental-ct-react
'
;
import
React
from
'
react
'
;
import
{
RESOURCES
}
from
'
lib/api/resources
'
;
import
*
as
profileMock
from
'
mocks/user/profile
'
;
import
authFixture
from
'
playwright/fixtures/auth
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
import
ProfileMenuDesktop
from
'
./ProfileMenuDesktop
'
;
...
...
@@ -34,7 +34,7 @@ test.describe('auth', () => {
});
extendedTest
(
'
+@dark-mode
'
,
async
({
mount
,
page
})
=>
{
await
page
.
route
(
'
/proxy/poa/core
'
+
RESOURCES
.
user_info
.
path
,
(
route
)
=>
route
.
fulfill
({
await
page
.
route
(
buildApiUrl
(
'
user_info
'
)
,
(
route
)
=>
route
.
fulfill
({
status
:
200
,
body
:
JSON
.
stringify
(
profileMock
.
base
),
}));
...
...
ui/tx/TxDetails.pw.tsx
View file @
d2051262
...
...
@@ -3,10 +3,11 @@ import React from 'react';
import
*
as
txMock
from
'
mocks/txs/tx
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
import
TxDetails
from
'
./TxDetails
'
;
const
API_URL
=
'
/node-api/transactions/1
'
;
const
API_URL
=
buildApiUrl
(
'
tx
'
,
{
id
:
'
1
'
})
;
const
hooksConfig
=
{
router
:
{
query
:
{
id
:
1
},
...
...
ui/tx/TxInternals.pw.tsx
View file @
d2051262
...
...
@@ -4,12 +4,13 @@ import React from 'react';
import
*
as
internalTxsMock
from
'
mocks/txs/internalTxs
'
;
import
*
as
txMock
from
'
mocks/txs/tx
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
buildApiUrl
from
'
playwright/utils/buildApiUrl
'
;
import
TxInternals
from
'
./TxInternals
'
;
const
TX_HASH
=
txMock
.
base
.
hash
;
const
API_URL_TX
=
`/node-api/transactions/
${
TX_HASH
}
`
;
const
API_URL_TX_INTERNALS
=
`/node-api/transactions/
${
TX_HASH
}
/internal-transactions`
;
const
API_URL_TX
=
buildApiUrl
(
'
tx
'
,
{
id
:
TX_HASH
})
;
const
API_URL_TX_INTERNALS
=
buildApiUrl
(
'
tx_internal_txs
'
,
{
id
:
TX_HASH
})
;
const
hooksConfig
=
{
router
:
{
query
:
{
id
:
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