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

Commit

Permalink
Added new test
Browse files Browse the repository at this point in the history
  • Loading branch information
ashish-aesthisia committed Nov 7, 2023
1 parent 73f82b7 commit cb02492
Show file tree
Hide file tree
Showing 6 changed files with 199 additions and 0 deletions.
31 changes: 31 additions & 0 deletions e2e/dev/all-editor-action.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import assert from 'assert'
import { Vector3 } from 'three'
import { EtherealEngineBot } from 'ee-bot/src/bot/bot-class'
import { BotHooks } from 'ee-bot/src/enums/BotHooks'

const vector3 = new Vector3()

//const domain = process.env.APP_HOST
const domain = 'localhost:3000'
const locationName = 'apartment'
const sqrt2 = Math.sqrt(2)

describe('My Bot Tests', () => {
const bot = new EtherealEngineBot({ name: 'bot', headless:false, verbose: true })
before(async () => {
await bot.launchBrowser()
await bot.enterLocation(`https://${domain}/location/${locationName}`)
await bot.awaitHookPromise(BotHooks.LocationLoaded)
await bot.clickAllButtons()
})

after(async () => {
await bot.quit()
})

it('Can spawn in the world', async () => {
const pos = await bot.awaitHookPromise(BotHooks.GetPlayerPosition)
// assert(vector3.copy(pos).length() < sqrt2 * 2) // sqrt2 * 2 is the default size of our spawn area
})
})

39 changes: 39 additions & 0 deletions e2e/dev/alldirection.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import assert from 'assert'
import { Vector3 } from 'three'
import { EtherealEngineBot } from 'ee-bot/src/bot/bot-class'
import { BotHooks } from 'ee-bot/src/enums/BotHooks'

//const vector3 = new Vector3()

//const domain = process.env.APP_HOST
const domain = 'localhost:3000'
const locationName = 'apartment'
const sqrt2 = Math.sqrt(2)

describe('My Bot Tests', () => {
const bot = new EtherealEngineBot({ name: 'bot', headless:false, verbose: true })
before(async () => {
await bot.launchBrowser()
await bot.enterLocation(`https://${domain}/location/${locationName}`)
await bot.awaitHookPromise(BotHooks.LocationLoaded)
await bot.moveBot('forward', 2000)
await bot.moveBot('backward',2000)
await bot.moveBot('left',2000)
await bot.moveBot('right',2000)
await bot.moveBot('jump',2000)
await bot.moveBot('up',2000)
await bot.moveBot('down',2000)
await bot.moveBot('arrowleft',1000)
await bot.moveBot('arrowright',1000)
})

after(async () => {
await bot.quit()
})

it('Can spawn in the world', async () => {
const pos = await bot.awaitHookPromise(BotHooks.GetPlayerPosition)
//assert(vector3.copy(pos).length() < sqrt2 * 2) // sqrt2 * 2 is the default size of our spawn area
})
})

31 changes: 31 additions & 0 deletions e2e/dev/emote.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import assert from 'assert'
import { Vector3 } from 'three'
import { EtherealEngineBot } from 'ee-bot/src/bot/bot-class'
import { BotHooks } from 'ee-bot/src/enums/BotHooks'

//const vector3 = new Vector3()

//const domain = process.env.APP_HOST
const domain = 'localhost:3000'
const locationName = 'apartment'
const sqrt2 = Math.sqrt(2)

describe('My Bot Tests', () => {
const bot = new EtherealEngineBot({ name: 'bot', headless:false, verbose: true })
before(async () => {
await bot.launchBrowser()
await bot.enterLocation(`https://${domain}/location/${locationName}`)
await bot.awaitHookPromise(BotHooks.LocationLoaded)
await bot.clickEmoteButtonAndSelectEmote()
})

after(async () => {
await bot.quit()
})

it('Can spawn in the world', async () => {
const pos = await bot.awaitHookPromise(BotHooks.GetPlayerPosition)
//assert(vector3.copy(pos).length() < sqrt2 * 2) // sqrt2 * 2 is the default size of our spawn area
})
})

31 changes: 31 additions & 0 deletions e2e/dev/moveforward.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import assert from 'assert'
import { Vector3 } from 'three'
import { EtherealEngineBot } from 'ee-bot/src/bot/bot-class'
import { BotHooks } from 'ee-bot/src/enums/BotHooks'

//const vector3 = new Vector3()

//const domain = process.env.APP_HOST
const domain = 'localhost:3000'
const locationName = 'apartment'
const sqrt2 = Math.sqrt(2)

describe('My Bot Tests', () => {
const bot = new EtherealEngineBot({ name: 'bot', headless:false, verbose: true })
before(async () => {
await bot.launchBrowser()
await bot.enterLocation(`https://${domain}/location/${locationName}`)
await bot.awaitHookPromise(BotHooks.LocationLoaded)
await bot.moveBot('forward',2000)
})

after(async () => {
await bot.quit()
})

it('Can spawn in the world', async () => {
const pos = await bot.awaitHookPromise(BotHooks.GetPlayerPosition)
//assert(vector3.copy(pos).length() < sqrt2 * 2) // sqrt2 * 2 is the default size of our spawn area
})
})

34 changes: 34 additions & 0 deletions e2e/dev/physics-triggers.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import assert from 'assert'
import { Vector3 } from 'three'
import { EtherealEngineBot } from 'ee-bot/src/bot/bot-class'
import { BotHooks } from 'ee-bot/src/enums/BotHooks'
import { makeAdmin } from 'ee-bot/src/bot/utils/make-user-admin'

const vector3 = new Vector3()

//const domain = process.env.APP_HOST
const domain = 'localhost:3000'
const locationName = 'default'
const sqrt2 = Math.sqrt(2)

describe('My Bot Tests', () => {
const bot = new EtherealEngineBot({ name: 'bot', headless:false, verbose: true })
before(async () => {
await bot.launchBrowser()
//await bot.enterLocation(`https://${domain}`)
//await bot.awaitHookPromise(BotHooks.LocationLoaded)
await bot.enterEditor(`https://${domain}/studio/default-project/apartment`,`https://${domain}` )
await bot.physics_triggers()
await bot.enterLocation(`https://${domain}/location/${locationName}`)
await bot.awaitHookPromise(BotHooks.LocationLoaded)
await bot.moveBot('forward',2000)
})

after(async () => {
await bot.quit()
})

it('Can spawn in the world', async () => {
})
})

33 changes: 33 additions & 0 deletions e2e/dev/portal.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import assert from 'assert'
import { Vector3 } from 'three'
import { EtherealEngineBot } from 'ee-bot/src/bot/bot-class'
import { BotHooks } from 'ee-bot/src/enums/BotHooks'

const vector3 = new Vector3()

//const domain = process.env.APP_HOST
const domain = 'localhost:3000'
const locationName = 'apartment'
const sqrt2 = Math.sqrt(2)

describe('My Bot Tests', () => {
const bot = new EtherealEngineBot({ name: 'bot', headless:false, verbose: true })
before(async () => {
await bot.launchBrowser()
await bot.enterLocation(`https://${domain}/location/${locationName}`)
await bot.awaitHookPromise(BotHooks.LocationLoaded)
await bot.moveBot('forward',3000)
await bot.moveBot('left',2000)
await bot.moveBot('backward',4000)
})

after(async () => {
await bot.quit()
})

it('Can spawn in the world', async () => {
const pos = await bot.awaitHookPromise(BotHooks.GetPlayerPosition)
// assert(vector3.copy(pos).length() < sqrt2 * 2) // sqrt2 * 2 is the default size of our spawn area
})
})

0 comments on commit cb02492

Please sign in to comment.