Skip to content

Commit

Permalink
Modularize tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jan 28, 2025
1 parent 19d592b commit 2109457
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 31 deletions.
32 changes: 1 addition & 31 deletions products/jbrowse-web/src/tests/VcfMatrix.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test('matrix', async () => {
expectCanvasMatch(await findByTestId(/prerendered_canvas/, ...opts))
}, 40000)

test('matrix phased', async () => {
test('mphased', async () => {
const { view, findByTestId, findByText } = await createView()
await view.navToLocString('ctgA')
fireEvent.click(await findByTestId(hts('volvox_test_vcf'), ...opts))
Expand All @@ -38,33 +38,3 @@ test('matrix phased', async () => {
fireEvent.click(await findByText('Force load', ...opts))
expectCanvasMatch(await findByTestId(/prerendered_canvas/, ...opts))
}, 40000)

test('regular', async () => {
const { view, findByTestId, findByText, findAllByTestId } = await createView()

await view.navToLocString('ctgA')
fireEvent.click(await findByTestId(hts('volvox_test_vcf'), ...opts))

fireEvent.click(await findByTestId('track_menu_icon', ...opts))
fireEvent.click(await findByText('Display types', ...opts))
fireEvent.click(await findByText('Multi-variant display (regular)', ...opts))
fireEvent.click(await findByText('Force load', ...opts))
expectCanvasMatch((await findAllByTestId(/prerendered_canvas/, ...opts))[0]!)
}, 40000)

test('regular phased', async () => {
const { view, findByTestId, findByText, findAllByTestId } = await createView()

await view.navToLocString('ctgA')
fireEvent.click(await findByTestId(hts('volvox_test_vcf'), ...opts))

fireEvent.click(await findByTestId('track_menu_icon', ...opts))
fireEvent.click(await findByText('Display types', ...opts))
fireEvent.click(await findByText('Multi-variant display (regular)', ...opts))

// Using the track menu twice not working currently, manually poke this setting
view.tracks[0].displays[0].setPhasedMode('phased')

fireEvent.click(await findByText('Force load', ...opts))
expectCanvasMatch((await findAllByTestId(/prerendered_canvas/, ...opts))[0]!)
}, 40000)
44 changes: 44 additions & 0 deletions products/jbrowse-web/src/tests/VcfMatrixRegular.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { fireEvent } from '@testing-library/react'

import { createView, doBeforeEach, expectCanvasMatch, hts, setup } from './util'

setup()

beforeEach(() => {
doBeforeEach()
})

const delay = { timeout: 30000 }
const opts = [{}, delay]

test('regular', async () => {
const { view, findByTestId, findByText, findAllByTestId } = await createView()

await view.navToLocString('ctgA')
fireEvent.click(await findByTestId(hts('volvox_test_vcf'), ...opts))

fireEvent.click(await findByTestId('track_menu_icon', ...opts))
fireEvent.click(await findByText('Display types', ...opts))
fireEvent.click(await findByText('Multi-variant display (regular)', ...opts))
await new Promise(res => setTimeout(res, 1000))
fireEvent.click(await findByText('Force load', ...opts))

expectCanvasMatch((await findAllByTestId(/prerendered_canvas/, ...opts))[0]!)
}, 40000)

test('rphased', async () => {
const { view, findByTestId, findByText, findAllByTestId } = await createView()

await view.navToLocString('ctgA')
fireEvent.click(await findByTestId(hts('volvox_test_vcf'), ...opts))

fireEvent.click(await findByTestId('track_menu_icon', ...opts))
fireEvent.click(await findByText('Display types', ...opts))
fireEvent.click(await findByText('Multi-variant display (regular)', ...opts))

// Using the track menu twice not working currently, manually poke this setting
view.tracks[0].displays[0].setPhasedMode('phased')

fireEvent.click(await findByText('Force load', ...opts))
expectCanvasMatch((await findAllByTestId(/prerendered_canvas/, ...opts))[0]!)
}, 40000)

0 comments on commit 2109457

Please sign in to comment.