Skip to content

Commit

Permalink
Playwright test runner
Browse files Browse the repository at this point in the history
adeira-source-id: a0868c7a6fdc712a89384f1815fd349c4d5a48d3
  • Loading branch information
itsdouges authored and triplex-bot committed Oct 22, 2023
1 parent 30bde7f commit 07736aa
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 21 deletions.
15 changes: 1 addition & 14 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,7 @@
{ "argsIgnorePattern": "^_" }
],
"header/header": ["error", "scripts/header.js"],
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": [
"**/__test__/**",
"**/__tests__/**",
"**/hook*.js",
"**/*.d.ts",
"**/main-dev-only.ts",
"**/*.config.mjs",
"**/*.config.js"
]
}
],
"import/no-extraneous-dependencies": "off",
"import/no-unresolved": "off",
"no-extra-parens": "off",
"no-inner-declarations": "off",
Expand Down
5 changes: 5 additions & 0 deletions examples/test-fixture/.triplex/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://triplex.dev/config.schema.json",
"components": ["../src/geometry/**/*.tsx"],
"files": ["../src/**/*.tsx"]
}
Empty file.
19 changes: 19 additions & 0 deletions examples/test-fixture/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@example/test-runner",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "echo \"Not implemented\"",
"typedef": "echo \"Not implemented\""
},
"dependencies": {
"@react-three/drei": "^9.56.27",
"@react-three/fiber": "^8.14.5",
"@react-three/rapier": "^1.1.1",
"@types/react": "^18.0.0",
"@types/three": "^0.157.0",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"three": "^0.157.0"
}
}
Binary file added examples/test-fixture/public/assets/pmndrs.glb
Binary file not shown.
45 changes: 45 additions & 0 deletions examples/test-fixture/src/geometry/box.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Copyright (c) Michael Dougall. All rights reserved.
*
* This source code is licensed under the GPL-3.0 license found in the LICENSE
* file in the root directory of this source tree.
*/
import { Vector3Tuple } from "three";

function Box({
color,
position,
rotation,
scale,
size = 1,
}: {
color?: "red" | "green" | "blue";
position?: Vector3Tuple | number;
rotation?: Vector3Tuple;
scale?: Vector3Tuple | number;
/**
* @min 1
* @max 2
*/
size?: number;
}) {
const ok = {};
return (
<group scale={scale} visible={true}>
<mesh
{...ok}
name="hello-world"
onClick={() => {}}
position={position}
rotation={rotation}
userData={{ hello: true }}
visible={true}
>
<boxGeometry args={[size, size, size]} />
<meshStandardMaterial color={color} key={color} />
</mesh>
</group>
);
}

export default Box;
15 changes: 15 additions & 0 deletions examples/test-fixture/src/scene.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Copyright (c) Michael Dougall. All rights reserved.
*
* This source code is licensed under the GPL-3.0 license found in the LICENSE
* file in the root directory of this source tree.
*/
import Box from "./geometry/box";

export default function Scene() {
return (
<>
<Box />
</>
);
}
23 changes: 23 additions & 0 deletions examples/test-fixture/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"baseUrl": ".",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"incremental": true,
"isolatedModules": true,
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "es2022"],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
"paths": {
"@/*": ["./src/*"]
},
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
"types": ["@react-three/fiber"]
},
"include": ["."],
"exclude": ["node_modules"]
}
3 changes: 3 additions & 0 deletions packages/editor/src/ds/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const Button = forwardRef<
isSelected?: boolean;
onClick?: () => void;
size?: "default" | "tight";
testId?: string;
variant?: "default" | "inverse";
}
>(
Expand All @@ -96,6 +97,7 @@ export const Button = forwardRef<
isSelected,
onClick,
size = "default",
testId,
variant = "default",
},
ref
Expand All @@ -118,6 +120,7 @@ export const Button = forwardRef<
"flex items-center gap-1.5 text-sm",
className,
])}
data-testid={testId}
disabled={disabled}
onClick={onClick}
ref={ref}
Expand Down
5 changes: 4 additions & 1 deletion packages/editor/src/ui/title-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export function TitleBar() {
<div>
<EditorMenu />
</div>
<span className="place-self-center text-sm text-neutral-300">
<span
className="place-self-center text-sm text-neutral-300"
data-testid="titlebar"
>
{windowTitle}
</span>
<div />
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function WelcomeScreen() {
"absolute right-0 ml-auto flex h-8 items-center pr-2.5 text-xs text-neutral-300",
])}
>
{version}
{process.env.FORCE_EDITOR_TEST_FIXTURE ? "local_test" : version}
</span>

<ProgressBar />
Expand Down
16 changes: 11 additions & 5 deletions packages/editor/vite.config.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
/**
* Copyright (c) Michael Dougall. All rights reserved.
*
* This source code is licensed under the GPL-3.0 license found in the LICENSE
* file in the root directory of this source tree.
*/
import { resolve } from "node:path";
import react from "@vitejs/plugin-react";
import { resolve } from "path";

/**
* @type {import("vite").UserConfig}
*/
export default {
base: "./",
define: {
__TRIPLEX_TARGET__: `"${process.env.TRIPLEX_TARGET}"`,
},
plugins: [react()],
build: {
rollupOptions: {
input: {
Expand All @@ -18,4 +20,8 @@ export default {
},
},
},
define: {
__TRIPLEX_TARGET__: `"${process.env.TRIPLEX_TARGET}"`,
},
plugins: [react()],
};

0 comments on commit 07736aa

Please sign in to comment.