* Reapply "Add ping pong health, remove a timeout interval, fix up netwo… (#1771)
This reverts commit 1913519f68
.
* Fix build errors
* Add new error states to network status notification
* Remove unused variable
* Refactor to use Context API for network status
* Don't do any stream events if network is not ok
* Catch LSP errors on bad auth
* Show when authentication is bad (cookie header only)
* Fix formatting
* Fix up types
* Revert awaiting on lsp failure
* Fix tsc
* wip
* wip
* fmt
* Fix typing
* Incorporate ping health; yarn make:dev; faster video stream loss notice
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* run ci pls
* run ci pls
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* run ci pls again
* Remove unused variables
* Add new instructions on running Playwright anywhere
* Please the Playwright. Praise the Playwright.
* Correct a vitest
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* ci again
* Fix tests unrelated to this PR
* Fix flakiness in for segments tests
* Bump to 2 workers
* fmt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fmt
* fmt
* Fixups
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* ci
* Set workers to 1
* Wait for network status listeners before connecting
* Fix initial connection requirements and trying 2 workers again
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { fireEvent, render, screen } from '@testing-library/react'
|
|
import { BrowserRouter } from 'react-router-dom'
|
|
import { SettingsAuthProviderJest } from './SettingsAuthProvider'
|
|
import { CommandBarProvider } from './CommandBar/CommandBarProvider'
|
|
import {
|
|
NETWORK_HEALTH_TEXT,
|
|
NetworkHealthIndicator,
|
|
} from './NetworkHealthIndicator'
|
|
import { NetworkHealthState } from 'hooks/useNetworkStatus'
|
|
|
|
function TestWrap({ children }: { children: React.ReactNode }) {
|
|
// wrap in router and xState context
|
|
return (
|
|
<BrowserRouter>
|
|
<CommandBarProvider>
|
|
<SettingsAuthProviderJest>{children}</SettingsAuthProviderJest>
|
|
</CommandBarProvider>
|
|
</BrowserRouter>
|
|
)
|
|
}
|
|
|
|
// Our Playwright tests for this are much more comprehensive.
|
|
describe('NetworkHealthIndicator tests', () => {
|
|
test('Renders the network indicator', () => {
|
|
render(
|
|
<TestWrap>
|
|
<NetworkHealthIndicator />
|
|
</TestWrap>
|
|
)
|
|
|
|
fireEvent.click(screen.getByTestId('network-toggle'))
|
|
|
|
// Starts as disconnected
|
|
expect(screen.getByTestId('network')).toHaveTextContent(
|
|
NETWORK_HEALTH_TEXT[NetworkHealthState.Disconnected]
|
|
)
|
|
})
|
|
})
|