Skip to content
This repository has been archived by the owner on Aug 18, 2024. It is now read-only.

Added mocap tests & fixed tests #40

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 73 additions & 1 deletion src/bot/bot-class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { getOS } from './utils/getOS'
import { makeAdmin } from './utils/make-user-admin'
import { PageUtils } from './utils/pageUtils'
import { error } from 'cli'
import { Timeout } from '@feathersjs/errors'

type BotProps = {
verbose?: Boolean
headless?: Boolean
Expand Down Expand Up @@ -60,6 +62,76 @@ export class EtherealEngineBot {
// this.activeChannel = activeChannelMatch[1];
// }
}

async enableCameraForMotionCapture() {
const motionCaptureButton = await this.page.waitForSelector('#UserPoseTracking', { timeout: 5000 }).catch(() => null)
if (motionCaptureButton) {
await motionCaptureButton.click();
await this.delay(3000)

const pages = await this.browser.pages()
const newPage = pages[pages.length - 1]
await this.delay(5000)

const captureButton = await newPage.waitForSelector('button[data-tip="Capture"]', { timeout: 5000 }).catch(() => null)
if (captureButton) {
await captureButton.click()
console.log("Clicked Capture button");

await this.delay(3000)

const settingsButton = await newPage.waitForSelector('button[data-tip="Settings"]', { timeout: 5000 }).catch(() => null)
if (settingsButton) {
await settingsButton.click()
await this.delay(2000)

const debugTabSelector = await newPage.waitForSelector('.tabs-boxed .tab:nth-child(3)', { timeout: 5000 }).catch(() => null)
if (debugTabSelector) {
await debugTabSelector.click()
await this.delay(2000)

const throttleSendCheckbox = await newPage.waitForSelector('li.cursor-pointer.label input[type="checkbox"]', { timeout: 5000 }).catch(() => null)
if (throttleSendCheckbox) {
await throttleSendCheckbox.click()
await this.delay(2000)
}

const closeButtonSelector = await newPage.waitForSelector('div.fixed button.btn', { timeout: 5000 }).catch(() => null)
await closeButtonSelector?.click()
await this.delay(2000)
}

const enableCameraSelector = await newPage.waitForSelector('button.btn[data-tip="Camera"]', { timeout: 5000 }).catch(() => null)
await enableCameraSelector?.click()
await this.delay(1000)

const poseButton = await newPage.waitForSelector('button.btn[data-tip="pose"]', { timeout: 5000 }).catch(() => null)
await poseButton?.click()
await this.delay(2000)

return newPage
}
}
}
}

async enablePlaybackForMotionCapture() {

let newPage = await this.enableCameraForMotionCapture()
if (newPage) {
const recordButton = await newPage.waitForSelector('button.btn[data-tip="Record"]', { timeout: 5000 }).catch(() => null)
await recordButton?.click()
console.log("Clicked record button")
await this.delay(2000)

const enablePlaybackSelector = await newPage.waitForSelector('button.btn[data-tip="Playback"]', { timeout: 5000 }).catch(() => null)
await enablePlaybackSelector?.click()
console.log("Clicked Playback button")
await this.delay(2000)
}

}

async clickAllButtons() {
const trigger1 = await this.page.waitForSelector('[aria-label="Emote"]')
if (trigger1) {
Expand Down Expand Up @@ -478,7 +550,7 @@ export class EtherealEngineBot {
context.overridePermissions(parsedUrl.origin, ['microphone', 'camera'])

console.log('Going to ' + url)
await this.page.goto(url, { waitUntil: 'domcontentloaded', timeout: 60 * 1000 })
await this.page.goto(url, { waitUntil: 'domcontentloaded', timeout: 200 * 1000 })

const granted = await this.page.evaluate(async () => {
// @ts-ignore
Expand Down