-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: xr test automation #16204
base: master
Are you sure you want to change the base?
test: xr test automation #16204
Conversation
Building or testing the sandbox has failed. If the tests failed, results can be found here: |
Graph tools CI has failed you can find the test results at: https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/TOOLS/refs/pull/16204/merge/testResults/ |
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
Reviewer - this PR has made changes to one or more package.json files. |
I'm sorry, I thought I had created the pull request on my fork. |
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
Reviewer - this PR has made changes to one or more package.json files. |
this._xrSessionManager.referenceSpace = this._xrSessionManager.referenceSpace.getOffsetReferenceSpace(transform); | ||
let isIwerEmulator = false; | ||
// @ts-expect-error - augment Window interface | ||
if (window && window.xrDevice){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a robust condition to check if we are using Immersive Web Emulation Runtime?
if (window && window.xrDevice){ | ||
isIwerEmulator = true; | ||
} | ||
const offsetMatrix = isIwerEmulator ? transform.matrix : transform; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IWER doesn't accept an XRRigidTransform
object but a mat4
(gl-matrix) package. Maybe this is not compliant to WebXR Device API specifications (https://www.w3.org/TR/webxr/#xrreferencespace-interface).
@@ -358,6 +360,9 @@ export class RenderingComponent extends React.Component<IRenderingComponentProps | |||
globalObject.scene.then((s: Scene) => { | |||
this._scene = s; | |||
globalObject.scene = this._scene; | |||
if (Utilities.ReadBoolFromStore("record-xr-session", false)){ | |||
this._addRecordActions(); | |||
} | |||
}); | |||
} else { | |||
this._scene = globalObject.scene as Scene; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add this._addRecordActions
because XR session is always async.
@@ -113,12 +117,31 @@ export const evaluatePlaywrightVisTests = async (engineType = "webgl2", testFile | |||
page.on("console", logCallback); | |||
console.log("Running test: " + testCase.title, ". Meta: ", testCase.playgroundId || testCase.scriptToRun || testCase.sceneFilename); | |||
test.setTimeout(timeout); | |||
let xrActions = null; | |||
if (testCase.isWebXR){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inject Immersive Web Emulation Runtime only if the current is an XR test case (this keep away potential regressions to other test cases for injecting a variable in the global object).
xrSessionManager.onXRReady.add(() => { | ||
player = window.xrDevice.createActionPlayer(xrSessionManager.baseReferenceSpace, xrActions); | ||
// rewrite stop function otherwise IWER's stop function restore camera and controllers to initial position | ||
player.stop = () => { resolve(true) }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolve the promise once that the execution of recorded actions is over but don't stop the player because stopping the player means restore camera and controllers to initial position. Image scenario where you execute a lot of actions (e.g.: you move in the space) and you need to check/test the final view not the first one).
Building or testing the playground has failed. If the tests failed, results can be found here: |
Building or testing the sandbox has failed. If the tests failed, results can be found here: |
Graph tools CI has failed you can find the test results at: https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/TOOLS/refs/pull/16204/merge/testResults/ |
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
Reviewer - this PR has made changes to one or more package.json files. |
Building or testing the sandbox has failed. If the tests failed, results can be found here: |
Building or testing the playground has failed. If the tests failed, results can be found here: |
Graph tools CI has failed you can find the test results at: https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/TOOLS/refs/pull/16204/merge/testResults/ |
Hi and thanks for the PR! Playwright allows us to install extensions on CI agents, so this is the solution I would pursue. I don't want to make any changes to the XR classes just for the sake of testing. The changes made in this kind of PR should be minimal - XR should work the same as any other test just with an extra click on the XR button. Also, as a side note - dual screen would make more sense, because we do have sometimes issues of things rendering incorrectly on the second render pass. It's a future task of mine, but I still didn't dive too deep into that. There is also the fact that we are testing on browserstack (which might change the test scenario if they don't allow us to install plugins). |
Thank you for your response! I'm really glad to hear that this is one of your future tasks because i want to learn a lot from you! I am completely agree not wanting to modify XR classes just for testing purposes, my suggestion was just an assumption to get the job done.
Thank you for the tip! I hadn’t considered that rendering issues might occur on the second pass, definitely something to keep in mind. Feel free to close the pull request if you think it's appropriate. |
The following PR proposes a solution to integrate WebXR automated tests.
Forum link: https://forum.babylonjs.com/t/webxr-test-automation/56736.
HOW TO CREATE A NEW TEST:
npm run serve -w @tools/babylon-server
npm run serve -w @tools/playground
https://{YOUR_LOCAL_IP}:1337/?local=true
and accept authority certificates (required from HTTP calls by playground)https://{YOUR_LOCAL_IP}:1338/?local=true#F41V6N#2096
and accept authority certificatesF41V6N-2025-02-22_18_35_38.json
will be saved in your device (for Oculus Quest 3 the folder is /sdcard/Download)actions
attribute of your current test in packages/tools/tests/test/visualization/config.json, e.g.:npm run test:visualization:ui
(*) I have set
https: true
directly in common Webpack configuration (packages/dev/buildTools/dist/webpackTools.js) rather than use the launch scripts (.vscode/launch.json).(**) The test was executed on an Oculus Quest 3.