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
f5eb6707
Commit
f5eb6707
authored
Nov 23, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add query context to tests
parent
10faf2dd
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
71 additions
and
39 deletions
+71
-39
TestApp.tsx
playwright/TestApp.tsx
+32
-0
AppError.pw.tsx
ui/shared/AppError/AppError.pw.tsx
+5
-5
Utilization.pw.tsx
ui/shared/Utilization/Utilization.pw.tsx
+9
-9
TxDecodedInputData.pw.tsx
ui/tx/TxDecodedInputData/TxDecodedInputData.pw.tsx
+13
-13
TxLogItem.pw.tsx
ui/tx/logs/TxLogItem.pw.tsx
+7
-7
TxLogTopic.pw.tsx
ui/tx/logs/TxLogTopic.pw.tsx
+5
-5
No files found.
playwright/
RenderWithChakra
.tsx
→
playwright/
TestApp
.tsx
View file @
f5eb6707
import
{
ChakraProvider
}
from
'
@chakra-ui/react
'
;
import
{
ChakraProvider
}
from
'
@chakra-ui/react
'
;
import
type
{
ColorMode
}
from
'
@chakra-ui/react
'
;
import
type
{
ColorMode
}
from
'
@chakra-ui/react
'
;
import
{
QueryClient
,
QueryClientProvider
}
from
'
@tanstack/react-query
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
theme
from
'
theme
'
;
import
theme
from
'
theme
'
;
...
@@ -9,12 +10,23 @@ type Props = {
...
@@ -9,12 +10,23 @@ type Props = {
colorMode
?:
ColorMode
;
colorMode
?:
ColorMode
;
}
}
const
RenderWithChakra
=
({
children
,
colorMode
=
'
light
'
}:
Props
)
=>
{
const
TestApp
=
({
children
,
colorMode
=
'
light
'
}:
Props
)
=>
{
const
[
queryClient
]
=
React
.
useState
(()
=>
new
QueryClient
({
defaultOptions
:
{
queries
:
{
refetchOnWindowFocus
:
false
,
retry
:
0
,
},
},
}));
return
(
return
(
<
ChakraProvider
theme=
{
{
...
theme
,
config
:
{
...
theme
.
config
,
initialColorMode
:
colorMode
}
}
}
>
<
ChakraProvider
theme=
{
{
...
theme
,
config
:
{
...
theme
.
config
,
initialColorMode
:
colorMode
}
}
}
>
<
QueryClientProvider
client=
{
queryClient
}
>
{
children
}
{
children
}
</
QueryClientProvider
>
</
ChakraProvider
>
</
ChakraProvider
>
);
);
};
};
export
default
RenderWithChakra
;
export
default
TestApp
;
ui/shared/AppError/AppError.pw.tsx
View file @
f5eb6707
import
{
test
,
expect
}
from
'
@playwright/experimental-ct-react
'
;
import
{
test
,
expect
}
from
'
@playwright/experimental-ct-react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
RenderWithChakra
from
'
playwright/RenderWithChakra
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
AppError
from
'
./AppError
'
;
import
AppError
from
'
./AppError
'
;
...
@@ -9,18 +9,18 @@ test.use({ viewport: { width: 900, height: 400 } });
...
@@ -9,18 +9,18 @@ test.use({ viewport: { width: 900, height: 400 } });
test
(
'
status code 404
'
,
async
({
mount
})
=>
{
test
(
'
status code 404
'
,
async
({
mount
})
=>
{
const
component
=
await
mount
(
const
component
=
await
mount
(
<
RenderWithChakra
>
<
TestApp
>
<
AppError
statusCode=
{
404
}
/>
<
AppError
statusCode=
{
404
}
/>
</
RenderWithChakra
>,
</
TestApp
>,
);
);
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
test
(
'
status code 500
'
,
async
({
mount
})
=>
{
test
(
'
status code 500
'
,
async
({
mount
})
=>
{
const
component
=
await
mount
(
const
component
=
await
mount
(
<
RenderWithChakra
>
<
TestApp
>
<
AppError
statusCode=
{
500
}
/>
<
AppError
statusCode=
{
500
}
/>
</
RenderWithChakra
>,
</
TestApp
>,
);
);
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
ui/shared/Utilization/Utilization.pw.tsx
View file @
f5eb6707
import
{
test
,
expect
}
from
'
@playwright/experimental-ct-react
'
;
import
{
test
,
expect
}
from
'
@playwright/experimental-ct-react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
RenderWithChakra
from
'
playwright/RenderWithChakra
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
Utilization
from
'
./Utilization
'
;
import
Utilization
from
'
./Utilization
'
;
...
@@ -9,36 +9,36 @@ test.use({ viewport: { width: 100, height: 50 } });
...
@@ -9,36 +9,36 @@ test.use({ viewport: { width: 100, height: 50 } });
test
(
'
green color scheme in light mode
'
,
async
({
mount
})
=>
{
test
(
'
green color scheme in light mode
'
,
async
({
mount
})
=>
{
const
component
=
await
mount
(
const
component
=
await
mount
(
<
RenderWithChakra
>
<
TestApp
>
<
Utilization
value=
{
0.423
}
/>
<
Utilization
value=
{
0.423
}
/>
</
RenderWithChakra
>,
</
TestApp
>,
);
);
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
test
(
'
green color scheme in dark mode
'
,
async
({
mount
})
=>
{
test
(
'
green color scheme in dark mode
'
,
async
({
mount
})
=>
{
const
component
=
await
mount
(
const
component
=
await
mount
(
<
RenderWithChakra
colorMode=
"dark"
>
<
TestApp
colorMode=
"dark"
>
<
Utilization
value=
{
0.423
}
/>
<
Utilization
value=
{
0.423
}
/>
</
RenderWithChakra
>,
</
TestApp
>,
);
);
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
test
(
'
gray color scheme in light mode
'
,
async
({
mount
})
=>
{
test
(
'
gray color scheme in light mode
'
,
async
({
mount
})
=>
{
const
component
=
await
mount
(
const
component
=
await
mount
(
<
RenderWithChakra
>
<
TestApp
>
<
Utilization
value=
{
0.423
}
colorScheme=
"gray"
/>
<
Utilization
value=
{
0.423
}
colorScheme=
"gray"
/>
</
RenderWithChakra
>,
</
TestApp
>,
);
);
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
test
(
'
gray color scheme in dark mode
'
,
async
({
mount
})
=>
{
test
(
'
gray color scheme in dark mode
'
,
async
({
mount
})
=>
{
const
component
=
await
mount
(
const
component
=
await
mount
(
<
RenderWithChakra
colorMode=
"dark"
>
<
TestApp
colorMode=
"dark"
>
<
Utilization
value=
{
0.423
}
colorScheme=
"gray"
/>
<
Utilization
value=
{
0.423
}
colorScheme=
"gray"
/>
</
RenderWithChakra
>,
</
TestApp
>,
);
);
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
ui/tx/TxDecodedInputData/TxDecodedInputData.pw.tsx
View file @
f5eb6707
...
@@ -2,7 +2,7 @@ import { test, expect } from '@playwright/experimental-ct-react';
...
@@ -2,7 +2,7 @@ import { test, expect } from '@playwright/experimental-ct-react';
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
*
as
mocks
from
'
mocks/txs/decodedInputData
'
;
import
*
as
mocks
from
'
mocks/txs/decodedInputData
'
;
import
RenderWithChakra
from
'
playwright/RenderWithChakra
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
{
DESKTOP
,
MOBILE
}
from
'
playwright/viewports
'
;
import
{
DESKTOP
,
MOBILE
}
from
'
playwright/viewports
'
;
import
TxDecodedInputData
from
'
./TxDecodedInputData
'
;
import
TxDecodedInputData
from
'
./TxDecodedInputData
'
;
...
@@ -12,27 +12,27 @@ test.describe('desktop', () => {
...
@@ -12,27 +12,27 @@ test.describe('desktop', () => {
test
(
'
dark color mode
'
,
async
({
mount
})
=>
{
test
(
'
dark color mode
'
,
async
({
mount
})
=>
{
const
component
=
await
mount
(
const
component
=
await
mount
(
<
RenderWithChakra
colorMode=
"dark"
>
<
TestApp
colorMode=
"dark"
>
<
TxDecodedInputData
data=
{
mocks
.
withIndexedFields
}
/>
<
TxDecodedInputData
data=
{
mocks
.
withIndexedFields
}
/>
</
RenderWithChakra
>,
</
TestApp
>,
);
);
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
test
(
'
with indexed fields
'
,
async
({
mount
})
=>
{
test
(
'
with indexed fields
'
,
async
({
mount
})
=>
{
const
component
=
await
mount
(
const
component
=
await
mount
(
<
RenderWithChakra
>
<
TestApp
>
<
TxDecodedInputData
data=
{
mocks
.
withIndexedFields
}
/>
<
TxDecodedInputData
data=
{
mocks
.
withIndexedFields
}
/>
</
RenderWithChakra
>,
</
TestApp
>,
);
);
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
test
(
'
without indexed fields
'
,
async
({
mount
})
=>
{
test
(
'
without indexed fields
'
,
async
({
mount
})
=>
{
const
component
=
await
mount
(
const
component
=
await
mount
(
<
RenderWithChakra
>
<
TestApp
>
<
TxDecodedInputData
data=
{
mocks
.
withoutIndexedFields
}
/>
<
TxDecodedInputData
data=
{
mocks
.
withoutIndexedFields
}
/>
</
RenderWithChakra
>,
</
TestApp
>,
);
);
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
...
@@ -43,27 +43,27 @@ test.describe('mobile', () => {
...
@@ -43,27 +43,27 @@ test.describe('mobile', () => {
test
(
'
dark color mode
'
,
async
({
mount
})
=>
{
test
(
'
dark color mode
'
,
async
({
mount
})
=>
{
const
component
=
await
mount
(
const
component
=
await
mount
(
<
RenderWithChakra
colorMode=
"dark"
>
<
TestApp
colorMode=
"dark"
>
<
TxDecodedInputData
data=
{
mocks
.
withIndexedFields
}
/>
<
TxDecodedInputData
data=
{
mocks
.
withIndexedFields
}
/>
</
RenderWithChakra
>,
</
TestApp
>,
);
);
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
test
(
'
with indexed fields
'
,
async
({
mount
})
=>
{
test
(
'
with indexed fields
'
,
async
({
mount
})
=>
{
const
component
=
await
mount
(
const
component
=
await
mount
(
<
RenderWithChakra
>
<
TestApp
>
<
TxDecodedInputData
data=
{
mocks
.
withIndexedFields
}
/>
<
TxDecodedInputData
data=
{
mocks
.
withIndexedFields
}
/>
</
RenderWithChakra
>,
</
TestApp
>,
);
);
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
test
(
'
without indexed fields
'
,
async
({
mount
})
=>
{
test
(
'
without indexed fields
'
,
async
({
mount
})
=>
{
const
component
=
await
mount
(
const
component
=
await
mount
(
<
RenderWithChakra
>
<
TestApp
>
<
TxDecodedInputData
data=
{
mocks
.
withoutIndexedFields
}
/>
<
TxDecodedInputData
data=
{
mocks
.
withoutIndexedFields
}
/>
</
RenderWithChakra
>,
</
TestApp
>,
);
);
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
...
...
ui/tx/logs/TxLogItem.pw.tsx
View file @
f5eb6707
...
@@ -3,7 +3,7 @@ import React from 'react';
...
@@ -3,7 +3,7 @@ import React from 'react';
import
*
as
addressMocks
from
'
mocks/address/address
'
;
import
*
as
addressMocks
from
'
mocks/address/address
'
;
import
*
as
inputDataMocks
from
'
mocks/txs/decodedInputData
'
;
import
*
as
inputDataMocks
from
'
mocks/txs/decodedInputData
'
;
import
RenderWithChakra
from
'
playwright/RenderWithChakra
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
{
DESKTOP
,
MOBILE
}
from
'
playwright/viewports
'
;
import
{
DESKTOP
,
MOBILE
}
from
'
playwright/viewports
'
;
import
TxLogItem
from
'
./TxLogItem
'
;
import
TxLogItem
from
'
./TxLogItem
'
;
...
@@ -25,7 +25,7 @@ const DATA = '0x0000000000000000000000000000000000000000000000000070265bf0112cee
...
@@ -25,7 +25,7 @@ const DATA = '0x0000000000000000000000000000000000000000000000000070265bf0112cee
test
(
'
with decoded input data
'
,
async
({
mount
})
=>
{
test
(
'
with decoded input data
'
,
async
({
mount
})
=>
{
const
component
=
await
mount
(
const
component
=
await
mount
(
<
RenderWithChakra
>
<
TestApp
>
<
TxLogItem
<
TxLogItem
index=
{
42
}
index=
{
42
}
decoded=
{
inputDataMocks
.
withIndexedFields
}
decoded=
{
inputDataMocks
.
withIndexedFields
}
...
@@ -33,14 +33,14 @@ const DATA = '0x0000000000000000000000000000000000000000000000000070265bf0112cee
...
@@ -33,14 +33,14 @@ const DATA = '0x0000000000000000000000000000000000000000000000000070265bf0112cee
topics=
{
TOPICS
}
topics=
{
TOPICS
}
data=
{
DATA
}
data=
{
DATA
}
/>
/>
</
RenderWithChakra
>,
</
TestApp
>,
);
);
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
test
(
'
without decoded input data
'
,
async
({
mount
})
=>
{
test
(
'
without decoded input data
'
,
async
({
mount
})
=>
{
const
component
=
await
mount
(
const
component
=
await
mount
(
<
RenderWithChakra
>
<
TestApp
>
<
TxLogItem
<
TxLogItem
index=
{
42
}
index=
{
42
}
decoded=
{
null
}
decoded=
{
null
}
...
@@ -48,14 +48,14 @@ const DATA = '0x0000000000000000000000000000000000000000000000000070265bf0112cee
...
@@ -48,14 +48,14 @@ const DATA = '0x0000000000000000000000000000000000000000000000000070265bf0112cee
topics=
{
TOPICS
}
topics=
{
TOPICS
}
data=
{
DATA
}
data=
{
DATA
}
/>
/>
</
RenderWithChakra
>,
</
TestApp
>,
);
);
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
test
(
'
dark color mode
'
,
async
({
mount
})
=>
{
test
(
'
dark color mode
'
,
async
({
mount
})
=>
{
const
component
=
await
mount
(
const
component
=
await
mount
(
<
RenderWithChakra
colorMode=
"dark"
>
<
TestApp
colorMode=
"dark"
>
<
TxLogItem
<
TxLogItem
index=
{
42
}
index=
{
42
}
decoded=
{
inputDataMocks
.
withIndexedFields
}
decoded=
{
inputDataMocks
.
withIndexedFields
}
...
@@ -63,7 +63,7 @@ const DATA = '0x0000000000000000000000000000000000000000000000000070265bf0112cee
...
@@ -63,7 +63,7 @@ const DATA = '0x0000000000000000000000000000000000000000000000000070265bf0112cee
topics=
{
TOPICS
}
topics=
{
TOPICS
}
data=
{
DATA
}
data=
{
DATA
}
/>
/>
</
RenderWithChakra
>,
</
TestApp
>,
);
);
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
...
...
ui/tx/logs/TxLogTopic.pw.tsx
View file @
f5eb6707
import
{
test
,
expect
}
from
'
@playwright/experimental-ct-react
'
;
import
{
test
,
expect
}
from
'
@playwright/experimental-ct-react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
RenderWithChakra
from
'
playwright/RenderWithChakra
'
;
import
TestApp
from
'
playwright/TestApp
'
;
import
{
MOBILE
}
from
'
playwright/viewports
'
;
import
{
MOBILE
}
from
'
playwright/viewports
'
;
import
TxLogTopic
from
'
./TxLogTopic
'
;
import
TxLogTopic
from
'
./TxLogTopic
'
;
...
@@ -10,9 +10,9 @@ test.use({ viewport: MOBILE });
...
@@ -10,9 +10,9 @@ test.use({ viewport: MOBILE });
test
(
'
address view
'
,
async
({
mount
})
=>
{
test
(
'
address view
'
,
async
({
mount
})
=>
{
const
component
=
await
mount
(
const
component
=
await
mount
(
<
RenderWithChakra
>
<
TestApp
>
<
TxLogTopic
hex=
"0x000000000000000000000000d789a607ceac2f0e14867de4eb15b15c9ffb5859"
index=
{
42
}
/>
<
TxLogTopic
hex=
"0x000000000000000000000000d789a607ceac2f0e14867de4eb15b15c9ffb5859"
index=
{
42
}
/>
</
RenderWithChakra
>,
</
TestApp
>,
);
);
await
component
.
locator
(
'
select[aria-label="Data type"]
'
).
selectOption
(
'
address
'
);
await
component
.
locator
(
'
select[aria-label="Data type"]
'
).
selectOption
(
'
address
'
);
...
@@ -21,9 +21,9 @@ test('address view', async({ mount }) => {
...
@@ -21,9 +21,9 @@ test('address view', async({ mount }) => {
test
(
'
hex view
'
,
async
({
mount
})
=>
{
test
(
'
hex view
'
,
async
({
mount
})
=>
{
const
component
=
await
mount
(
const
component
=
await
mount
(
<
RenderWithChakra
>
<
TestApp
>
<
TxLogTopic
hex=
"0x000000000000000000000000d789a607ceac2f0e14867de4eb15b15c9ffb5859"
index=
{
42
}
/>
<
TxLogTopic
hex=
"0x000000000000000000000000d789a607ceac2f0e14867de4eb15b15c9ffb5859"
index=
{
42
}
/>
</
RenderWithChakra
>,
</
TestApp
>,
);
);
await
component
.
locator
(
'
select[aria-label="Data type"]
'
).
selectOption
(
'
hex
'
);
await
component
.
locator
(
'
select[aria-label="Data type"]
'
).
selectOption
(
'
hex
'
);
...
...
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