Set up end-to-end tests (#85)

This commit is contained in:
Aria 2022-02-28 13:15:27 +01:00 committed by GitHub
parent 3c369b435e
commit d0965d17e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 1470 additions and 108 deletions

View file

@ -17,7 +17,7 @@ export function createBundles(watch: boolean) {
loader: {'.png': 'file', '.svg': 'dataurl'},
bundle: true,
sourcemap: true,
define: definedGlobals,
define: {...definedGlobals, __IS_VISUAL_REGRESSION_TESTING: 'false'},
watch,
external: [
'@theatre/dataverse',

View file

@ -1,5 +1,6 @@
interface Window {
__REDUX_DEVTOOLS_EXTENSION__?: $IntentionalAny
__IS_VISUAL_REGRESSION_TESTING?: boolean
}
interface NodeModule {

View file

@ -25,12 +25,15 @@ export default class UI {
pointer-events: none;
z-index: 100;
`
this.containerShadow = this.containerEl.attachShadow({
mode: 'open',
// To see why I had to cast this value to HTMLElement, take a look at its
// references of this prop. There are a few functions that actually work
// with a ShadowRoot but are typed to accept HTMLElement
}) as $IntentionalAny as ShadowRoot & HTMLElement
this.containerShadow =
window.__IS_VISUAL_REGRESSION_TESTING === true
? (document.getElementById('root') as $IntentionalAny)
: (this.containerEl.attachShadow({
mode: 'open',
// To see why I had to cast this value to HTMLElement, take a look at its
// references of this prop. There are a few functions that actually work
// with a ShadowRoot but are typed to accept HTMLElement
}) as $IntentionalAny as ShadowRoot & HTMLElement)
}
render() {

View file

@ -85,7 +85,11 @@ export default function UIRoot() {
return !initialised ? null : (
<StyleSheetManager
disableVendorPrefixes
target={getStudio()!.ui.containerShadow}
target={
window.__IS_VISUAL_REGRESSION_TESTING === true
? undefined
: getStudio()!.ui.containerShadow
}
>
<>
<GlobalStyle />

View file

@ -109,7 +109,7 @@ const DetailPanel: React.FC<{}> = (props) => {
if (obj) {
return (
<Container>
<Content>
<Content data-testid="DetailPanel-Object">
<Header>
<Title
title={`${obj.sheet.address.sheetId}: ${obj.sheet.address.sheetInstanceId} > ${obj.address.objectKey}`}

View file

@ -166,7 +166,10 @@ const OutlinePanel: React.FC<{}> = (props) => {
<Container>
<TriggerContainer>
{triggerTooltip}
<TriggerButton ref={triggerButtonRef as $IntentionalAny}>
<TriggerButton
ref={triggerButtonRef as $IntentionalAny}
data-testid="OutlinePanel-TriggerButton"
>
<VscListTree />
</TriggerButton>
{conflicts.length > 0 ? (
@ -177,7 +180,7 @@ const OutlinePanel: React.FC<{}> = (props) => {
{/* <Title>Outline</Title> */}
</TriggerContainer>
<Content>
<Body>
<Body data-testid="OutlinePanel-Content">
<ProjectsList />
</Body>
</Content>