Skip to content

Commit

Permalink
Added scripts : bullet, factorial
Browse files Browse the repository at this point in the history
  • Loading branch information
yusungsim committed Feb 6, 2024
1 parent d0bf374 commit 2635341
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/online/bullet/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { delay } from '../../../dist/tests/test-utils.cjs'

export default async function test(analyser) {
const url = 'https://magnum.graphics/showcase/bullet/'
const page = await analyser.start(url, { headless: false })

const mainCanv = page.locator('#canvas')
await mainCanv.waitFor({state: 'visible'})

await mainCanv.click({
button: 'left',
position: {x: 100, y: 100},
delay: 100
})

await delay(10000)

return await analyser.stop()
}
27 changes: 27 additions & 0 deletions tests/online/factorial/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { delay } from '../../../dist/tests/test-utils.cjs'
import { expect } from 'playwright/test'

export default async function test(analyser) {
const url = 'https://www.hellorust.com/demos/factorial/index.html'
const page = await analyser.start(url, { headless: false })

const textInput = page.locator('#input')
await textInput.waitFor({state: 'visible'})

const numberOut = page.locator('#number-out')
await numberOut.waitFor({state: 'visible'})

await textInput.fill('')

await textInput.fill('0')
await expect(numberOut).toContainText('fact(0)', {timeout: 10000})

await textInput.fill('1')
await expect(numberOut).toContainText('fact(1)', {timeout: 10000})

await textInput.fill('2')
await expect(numberOut).toContainText('fact(2)', {timeout: 10000})


return await analyser.stop()
}

0 comments on commit 2635341

Please sign in to comment.