Skip to content

Commit

Permalink
Merge branch 'edge' into protocol_designer-migrate-webpack-to-vite
Browse files Browse the repository at this point in the history
  • Loading branch information
mjhuff committed Mar 6, 2024
2 parents b5a6e7d + d6d9416 commit ea8b026
Show file tree
Hide file tree
Showing 43 changed files with 1,583 additions and 21 deletions.
2 changes: 1 addition & 1 deletion api/docs/v2/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
# use rst_prolog to hold the subsitution
# update the apiLevel value whenever a new minor version is released
rst_prolog = f"""
.. |apiLevel| replace:: 2.16
.. |apiLevel| replace:: 2.17
.. |release| replace:: {release}
"""

Expand Down
2 changes: 1 addition & 1 deletion api/docs/v2/versioning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ The maximum supported API version for your robot is listed in the Opentrons App

If you upload a protocol that specifies a higher API level than the maximum supported, your robot won't be able to analyze or run your protocol. You can increase the maximum supported version by updating your robot software and Opentrons App.

Opentrons robots running the latest software (7.1.0) support the following version ranges:
Opentrons robots running the latest software (7.2.0) support the following version ranges:

* **Flex:** version 2.15–|apiLevel|.
* **OT-2:** versions 2.0–|apiLevel|.
Expand Down
2 changes: 1 addition & 1 deletion api/src/opentrons/hardware_control/ot3api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,7 @@ async def _home_axis(self, axis: Axis) -> None:
self._log.warning(
f"Stall on {axis} during fast home, encoder may have missed an overflow"
)
await self.refresh_positions()
await self.refresh_positions(acquire_lock=False)

await self._backend.home([axis], self.gantry_load)
else:
Expand Down
2 changes: 1 addition & 1 deletion app/src/App/OnDeviceDisplayApp.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//test
//testttttt

Check failure on line 1 in app/src/App/OnDeviceDisplayApp.tsx

View workflow job for this annotation

GitHub Actions / js checks

Expected space or tab after '//' in comment

Check failure on line 1 in app/src/App/OnDeviceDisplayApp.tsx

View workflow job for this annotation

GitHub Actions / js checks

Expected space or tab after '//' in comment
import * as React from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { Switch, Route, Redirect } from 'react-router-dom'
Expand Down
28 changes: 28 additions & 0 deletions app/src/App/__tests__/OnDeviceDisplayAppFallback.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,39 @@ import { OnDeviceDisplayAppFallback } from '../OnDeviceDisplayAppFallback'
import type { FallbackProps } from 'react-error-boundary'
import type {Mock} from 'vitest'

<<<<<<< HEAD
vi.mock('../../redux/shell')
vi.mock('../../redux/analytics')
vi.mock('../../redux/discovery', async (importOriginal) => {
const actual = await importOriginal<typeof getLocalRobot>()
return {
...actual,
getLocalRobot: vi.fn()
=======
jest.mock('../../redux/shell')
jest.mock('../../redux/analytics')
jest.mock('../../redux/discovery', () => {
const actual = jest.requireActual('../../redux/discovery')
return {
...actual,
getLocalRobot: jest.fn(),
>>>>>>> edge
}
})

const mockError = {
message: 'mock error',
} as Error
<<<<<<< HEAD
=======
const mockAppRestart = appRestart as jest.MockedFunction<typeof appRestart>
const mockUseTrackEvent = useTrackEvent as jest.MockedFunction<
typeof useTrackEvent
>
const mockGetLocalRobot = getLocalRobot as jest.MockedFunction<
typeof getLocalRobot
>
>>>>>>> edge

const render = (props: FallbackProps) => {
return renderWithProviders(<OnDeviceDisplayAppFallback {...props} />, {
Expand All @@ -37,6 +57,8 @@ let mockTrackEvent: Mock

const MOCK_ROBOT_SERIAL_NUMBER = 'OT123'

const MOCK_ROBOT_SERIAL_NUMBER = 'OT123'

describe('OnDeviceDisplayAppFallback', () => {
let props: FallbackProps

Expand All @@ -45,9 +67,15 @@ describe('OnDeviceDisplayAppFallback', () => {
error: mockError,
resetErrorBoundary: {} as any,
} as FallbackProps
<<<<<<< HEAD
mockTrackEvent = vi.fn()
when(vi.mocked(useTrackEvent)).calledWith().mockReturnValue(mockTrackEvent)
when(vi.mocked(getLocalRobot)).mockReturnValue({
=======
mockTrackEvent = jest.fn()
when(mockUseTrackEvent).calledWith().mockReturnValue(mockTrackEvent)
when(mockGetLocalRobot).mockReturnValue({
>>>>>>> edge
...mockConnectableRobot,
health: {
...mockConnectableRobot.health,
Expand Down
2 changes: 1 addition & 1 deletion app/src/atoms/MenuList/__tests__/OverflowBtn.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ describe('OverflowBtn', () => {

expect(getByRole('button')).toHaveStyleRule(
'box-shadow',
`0 0 0 3px ${String(COLORS.blue50)}`,
`0 0 0 3px ${String(COLORS.yellow50)}`,
{
modifier: ':focus-visible',
}
Expand Down
41 changes: 41 additions & 0 deletions app/src/atoms/buttons/__tests__/ToggleButton.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,17 @@ describe('ToggleButton', () => {

it('applies the correct states to the toggle on- disabled', () => {
props.disabled = true
<<<<<<< HEAD
render(props)
const button = screen.getByLabelText('toggle button')
expect(button).toHaveStyle(`color: ${COLORS.grey30}`)
=======
const { getByLabelText } = render(props)
const button = getByLabelText('toggle button')
expect(button).toHaveStyleRule('color', `${String(COLORS.grey30)}`, {
modifier: ':disabled',
})
>>>>>>> edge
})

it('calls mock function when clicking the toggle button - on', () => {
Expand All @@ -58,12 +66,45 @@ describe('ToggleButton', () => {
expect(button).toHaveAttribute('aria-checked', 'false')
})

<<<<<<< HEAD
it('applies the correct states to the toggle off- disabled', () => {
props.toggledOn = false
props.disabled = true
render(props)
const button = screen.getByLabelText('toggle button')
expect(button).toHaveStyle(`color: ${COLORS.grey30}`)
=======
it('applies the correct states to the toggle off- hover', () => {
props.toggledOn = false
const { getByLabelText } = render(props)
const button = getByLabelText('toggle button')
expect(button).toHaveStyleRule('color', `${String(COLORS.grey55)}`, {
modifier: ':hover',
})
})

it('applies the correct states to the toggle off- focus-visible', () => {
props.toggledOn = false
const { getByLabelText } = render(props)
const button = getByLabelText('toggle button')
expect(button).toHaveStyleRule(
'box-shadow',
`0 0 0 3px ${String(COLORS.yellow50)}`,
{
modifier: ':focus-visible',
}
)
})

it('applies the correct states to the toggle off- disabled', () => {
props.toggledOn = false
props.disabled = true
const { getByLabelText } = render(props)
const button = getByLabelText('toggle button')
expect(button).toHaveStyleRule('color', `${String(COLORS.grey30)}`, {
modifier: ':disabled',
})
>>>>>>> edge
})

it('calls mock function when clicking the toggle button - off', () => {
Expand Down
7 changes: 7 additions & 0 deletions app/src/molecules/LegacyModal/__tests__/LegacyModal.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import * as React from 'react'
<<<<<<< HEAD
import '@testing-library/jest-dom/vitest'
import { screen } from '@testing-library/react'
import { describe, it, expect, beforeEach } from 'vitest'
import { COLORS } from '@opentrons/components'
import { renderWithProviders } from '../../../__testing-utils__'
=======
import { screen } from '@testing-library/react'

import { COLORS, renderWithProviders } from '@opentrons/components'

>>>>>>> edge
import { LegacyModal } from '..'

const render = (props: React.ComponentProps<typeof LegacyModal>) => {
Expand Down
14 changes: 14 additions & 0 deletions app/src/organisms/AnalyticsSettingsModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import {

import { Modal, OutlineButton, SPACING } from '@opentrons/components'
import { AnalyticsToggle } from './AnalyticsToggle'
<<<<<<< HEAD
import { getModalPortalEl } from '../../App/portal'
=======
import { Portal } from '../../App/portal'
>>>>>>> edge
import type { Dispatch } from '../../redux/types'

// TODO(bc, 2021-02-04): i18n
Expand All @@ -22,8 +26,13 @@ export function AnalyticsSettingsModal(): JSX.Element | null {
const seen = useSelector(getAnalyticsOptInSeen)
const setSeen = (): unknown => dispatch(setAnalyticsOptInSeen())

Check warning on line 27 in app/src/organisms/AnalyticsSettingsModal/index.tsx

View check run for this annotation

Codecov / codecov/patch

app/src/organisms/AnalyticsSettingsModal/index.tsx#L27

Added line #L27 was not covered by tests

<<<<<<< HEAD
return !seen
? createPortal(
=======
return !seen ? (
<Portal>
>>>>>>> edge
<Modal onCloseClick={setSeen} heading={TITLE} alertOverlay>
<AnalyticsToggle />
<OutlineButton
Expand All @@ -33,7 +42,12 @@ export function AnalyticsSettingsModal(): JSX.Element | null {
>
{CONTINUE}
</OutlineButton>
<<<<<<< HEAD
</Modal>,
getModalPortalEl()
=======
</Modal>
</Portal>
>>>>>>> edge
) : null
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,32 @@ import { useCreateRunFromProtocol } from '../../ChooseRobotToRunProtocolSlideout
import { ChooseProtocolSlideout } from '../'
import { useNotifyService } from '../../../resources/useNotifyService'

<<<<<<< HEAD
vi.mock('../../ChooseRobotToRunProtocolSlideout/useCreateRunFromProtocol')
vi.mock('../../../redux/protocol-storage')
vi.mock('../../../organisms/Devices/hooks')
vi.mock('../../../redux/config')
vi.mock('../../../resources/useNotifyService')
=======
jest.mock('../../ChooseRobotToRunProtocolSlideout/useCreateRunFromProtocol')
jest.mock('../../../redux/protocol-storage')
jest.mock('../../../organisms/Devices/hooks')
jest.mock('../../../redux/config')
jest.mock('../../../resources/useNotifyService')

const mockGetStoredProtocols = getStoredProtocols as jest.MockedFunction<
typeof getStoredProtocols
>
const mockUseCreateRunFromProtocol = useCreateRunFromProtocol as jest.MockedFunction<
typeof useCreateRunFromProtocol
>
const mockUseTrackCreateProtocolRunEvent = useTrackCreateProtocolRunEvent as jest.MockedFunction<
typeof useTrackCreateProtocolRunEvent
>
const mockUseNotifyService = useNotifyService as jest.MockedFunction<
typeof useNotifyService
>
>>>>>>> edge

const render = (props: React.ComponentProps<typeof ChooseProtocolSlideout>) => {
return renderWithProviders(
Expand Down Expand Up @@ -46,7 +67,14 @@ describe('ChooseProtocolSlideout', () => {
vi.mocked(useTrackCreateProtocolRunEvent).mockReturnValue({
trackCreateProtocolRunEvent: mockTrackCreateProtocolRunEvent,
})
<<<<<<< HEAD
vi.mocked(useNotifyService).mockReturnValue({} as any)
=======
mockUseNotifyService.mockReturnValue({} as any)
})
afterEach(() => {
jest.resetAllMocks()
>>>>>>> edge
})

it('renders slideout if showSlideout true', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,36 @@ import { getNetworkInterfaces } from '../../../redux/networking'
import { ChooseRobotSlideout } from '..'
import { useNotifyService } from '../../../resources/useNotifyService'

<<<<<<< HEAD
vi.mock('../../../redux/discovery')
vi.mock('../../../redux/robot-update')
vi.mock('../../../redux/networking')
=======
jest.mock('../../../redux/discovery')
jest.mock('../../../redux/robot-update')
jest.mock('../../../redux/networking')
jest.mock('../../../resources/useNotifyService')

const mockGetConnectableRobots = getConnectableRobots as jest.MockedFunction<
typeof getConnectableRobots
>
const mockGetReachableRobots = getReachableRobots as jest.MockedFunction<
typeof getReachableRobots
>
const mockGetUnreachableRobots = getUnreachableRobots as jest.MockedFunction<
typeof getUnreachableRobots
>
const mockGetScanning = getScanning as jest.MockedFunction<typeof getScanning>
const mockStartDiscovery = startDiscovery as jest.MockedFunction<
typeof startDiscovery
>
const mockGetNetworkInterfaces = getNetworkInterfaces as jest.MockedFunction<
typeof getNetworkInterfaces
>
const mockUseNotifyService = useNotifyService as jest.MockedFunction<
typeof useNotifyService
>
>>>>>>> edge

const render = (props: React.ComponentProps<typeof ChooseRobotSlideout>) => {
return renderWithProviders(
Expand All @@ -41,6 +68,7 @@ const mockSetSelectedRobot = vi.fn()

describe('ChooseRobotSlideout', () => {
beforeEach(() => {
<<<<<<< HEAD
vi.mocked(getConnectableRobots).mockReturnValue([mockConnectableRobot])
vi.mocked(getUnreachableRobots).mockReturnValue([mockUnreachableRobot])
vi.mocked(getReachableRobots).mockReturnValue([mockReachableRobot])
Expand All @@ -53,6 +81,18 @@ describe('ChooseRobotSlideout', () => {
ethernet: null,
})
vi.mocked(useNotifyService).mockReturnValue({} as any)
=======
mockGetConnectableRobots.mockReturnValue([mockConnectableRobot])
mockGetUnreachableRobots.mockReturnValue([mockUnreachableRobot])
mockGetReachableRobots.mockReturnValue([mockReachableRobot])
mockGetScanning.mockReturnValue(false)
mockStartDiscovery.mockReturnValue({ type: 'mockStartDiscovery' } as any)
mockGetNetworkInterfaces.mockReturnValue({ wifi: null, ethernet: null })
mockUseNotifyService.mockReturnValue({} as any)
})
afterEach(() => {
jest.resetAllMocks()
>>>>>>> edge
})

it('renders slideout if isExpanded true', () => {
Expand Down
Loading

0 comments on commit ea8b026

Please sign in to comment.