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
9c3d4369
Commit
9c3d4369
authored
Nov 29, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
TxsNewItemNotice test
parent
9ebdd138
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
87 additions
and
2 deletions
+87
-2
socketServer.ts
playwright/fixtures/socketServer.ts
+2
-0
TxsNewItemNotice.pw.tsx
ui/txs/TxsNewItemNotice.pw.tsx
+83
-0
TxsNewItemNotice.tsx
ui/txs/TxsNewItemNotice.tsx
+2
-2
TxsNewItemNotice.pw.tsx_default_2-new-items-in-validated-txs-list-1.png
...ce.pw.tsx_default_2-new-items-in-validated-txs-list-1.png
+0
-0
TxsNewItemNotice.pw.tsx_default_connection-loss-1.png
...s__/TxsNewItemNotice.pw.tsx_default_connection-loss-1.png
+0
-0
TxsNewItemNotice.pw.tsx_default_fetching-1.png
...eenshots__/TxsNewItemNotice.pw.tsx_default_fetching-1.png
+0
-0
TxsNewItemNotice.pw.tsx_default_new-item-in-validated-txs-list-1.png
...otice.pw.tsx_default_new-item-in-validated-txs-list-1.png
+0
-0
No files found.
playwright/fixtures/socketServer.ts
View file @
9c3d4369
...
@@ -55,6 +55,8 @@ export const joinChannel = async(socket: WebSocket, channelName: string) => {
...
@@ -55,6 +55,8 @@ export const joinChannel = async(socket: WebSocket, channelName: string) => {
});
});
};
};
export
function
sendMessage
(
socket
:
WebSocket
,
channel
:
Channel
,
msg
:
'
transaction
'
,
payload
:
{
transaction
:
number
}):
void
;
export
function
sendMessage
(
socket
:
WebSocket
,
channel
:
Channel
,
msg
:
'
pending_transaction
'
,
payload
:
{
pending_transaction
:
number
}):
void
;
export
function
sendMessage
(
socket
:
WebSocket
,
channel
:
Channel
,
msg
:
'
new_block
'
,
payload
:
NewBlockSocketResponse
):
void
;
export
function
sendMessage
(
socket
:
WebSocket
,
channel
:
Channel
,
msg
:
'
new_block
'
,
payload
:
NewBlockSocketResponse
):
void
;
export
function
sendMessage
(
socket
:
WebSocket
,
channel
:
Channel
,
msg
:
string
,
payload
:
unknown
):
void
{
export
function
sendMessage
(
socket
:
WebSocket
,
channel
:
Channel
,
msg
:
string
,
payload
:
unknown
):
void
{
socket
.
send
(
JSON
.
stringify
([
socket
.
send
(
JSON
.
stringify
([
...
...
ui/txs/TxsNewItemNotice.pw.tsx
0 → 100644
View file @
9c3d4369
import
{
test
as
base
,
expect
}
from
'
@playwright/experimental-ct-react
'
;
import
React
from
'
react
'
;
import
{
ROUTES
}
from
'
lib/link/routes
'
;
import
*
as
socketServer
from
'
playwright/fixtures/socketServer
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
TxsNewItemNotice
from
'
./TxsNewItemNotice
'
;
const
hooksConfig
=
{
router
:
{
pathname
:
ROUTES
.
txs
.
pattern
,
query
:
{},
},
};
export
const
test
=
base
.
extend
<
socketServer
.
SocketServerFixture
>
({
createSocket
:
socketServer
.
createSocket
,
});
test
.
describe
.
configure
({
mode
:
'
serial
'
});
test
(
'
new item in validated txs list
'
,
async
({
mount
,
createSocket
})
=>
{
const
component
=
await
mount
(
<
TestApp
withSocket
>
<
TxsNewItemNotice
/>
</
TestApp
>,
{
hooksConfig
},
);
const
socket
=
await
createSocket
();
const
channel
=
await
socketServer
.
joinChannel
(
socket
,
'
transactions:new_transaction
'
);
socketServer
.
sendMessage
(
socket
,
channel
,
'
transaction
'
,
{
transaction
:
1
});
await
expect
(
component
).
toHaveScreenshot
();
});
test
(
'
2 new items in validated txs list
'
,
async
({
mount
,
page
,
createSocket
})
=>
{
const
component
=
await
mount
(
<
TestApp
withSocket
>
<
TxsNewItemNotice
/>
</
TestApp
>,
{
hooksConfig
},
);
const
socket
=
await
createSocket
();
const
channel
=
await
socketServer
.
joinChannel
(
socket
,
'
transactions:new_transaction
'
);
socketServer
.
sendMessage
(
socket
,
channel
,
'
transaction
'
,
{
transaction
:
1
});
socketServer
.
sendMessage
(
socket
,
channel
,
'
transaction
'
,
{
transaction
:
1
});
await
page
.
waitForSelector
(
'
text=2 more
'
);
await
expect
(
component
).
toHaveScreenshot
();
});
test
(
'
connection loss
'
,
async
({
mount
,
createSocket
})
=>
{
const
component
=
await
mount
(
<
TestApp
withSocket
>
<
TxsNewItemNotice
/>
</
TestApp
>,
{
hooksConfig
},
);
const
socket
=
await
createSocket
();
await
socketServer
.
joinChannel
(
socket
,
'
transactions:new_transaction
'
);
socket
.
close
();
await
expect
(
component
).
toHaveScreenshot
();
});
test
(
'
fetching
'
,
async
({
mount
,
createSocket
})
=>
{
const
component
=
await
mount
(
<
TestApp
withSocket
>
<
TxsNewItemNotice
/>
</
TestApp
>,
{
hooksConfig
},
);
const
socket
=
await
createSocket
();
await
socketServer
.
joinChannel
(
socket
,
'
transactions:new_transaction
'
);
await
expect
(
component
).
toHaveScreenshot
();
});
ui/txs/TxsNewItemNotice.tsx
View file @
9c3d4369
...
@@ -8,7 +8,7 @@ interface InjectedProps {
...
@@ -8,7 +8,7 @@ interface InjectedProps {
}
}
interface
Props
{
interface
Props
{
children
:
(
props
:
InjectedProps
)
=>
JSX
.
Element
;
children
?
:
(
props
:
InjectedProps
)
=>
JSX
.
Element
;
className
?:
string
;
className
?:
string
;
}
}
...
@@ -51,7 +51,7 @@ const TxsNewItemNotice = ({ children, className }: Props) => {
...
@@ -51,7 +51,7 @@ const TxsNewItemNotice = ({ children, className }: Props) => {
);
);
})();
})();
return
children
({
content
})
;
return
children
?
children
({
content
})
:
content
;
};
};
export
default
chakra
(
TxsNewItemNotice
);
export
default
chakra
(
TxsNewItemNotice
);
ui/txs/__screenshots__/TxsNewItemNotice.pw.tsx_default_2-new-items-in-validated-txs-list-1.png
0 → 100644
View file @
9c3d4369
4.67 KB
ui/txs/__screenshots__/TxsNewItemNotice.pw.tsx_default_connection-loss-1.png
0 → 100644
View file @
9c3d4369
4.14 KB
ui/txs/__screenshots__/TxsNewItemNotice.pw.tsx_default_fetching-1.png
0 → 100644
View file @
9c3d4369
3.45 KB
ui/txs/__screenshots__/TxsNewItemNotice.pw.tsx_default_new-item-in-validated-txs-list-1.png
0 → 100644
View file @
9c3d4369
4.48 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