Skip to content

Commit

Permalink
Add frontend tests for the reset connector offsets button
Browse files Browse the repository at this point in the history
  • Loading branch information
NOZAIS Julien committed Oct 4, 2024
1 parent d9d269b commit 971c2c9
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ describe('Actions', () => {
expect(screen.getByText('Resume')).toBeInTheDocument();
expect(screen.queryByText('Pause')).not.toBeInTheDocument();
expect(screen.queryByText('Stop')).not.toBeInTheDocument();
expect(screen.queryByText('Reset Connector Offsets')).toBeInTheDocument();
expect(screen.getByText('Reset Connector Offsets')).toBeDisabled();
expectActionButtonsExists();
});

it('renders buttons when stopped', async () => {
(useConnector as jest.Mock).mockImplementation(() => ({
data: setConnectorStatus(connector, ConnectorState.PAUSED),
}));
renderComponent();
await afterClickRestartButton();
expect(screen.getAllByRole('menuitem').length).toEqual(4);
expect(screen.getByText('Resume')).toBeInTheDocument();
expect(screen.queryByText('Pause')).not.toBeInTheDocument();
expect(screen.queryByText('Stop')).not.toBeInTheDocument();
expect(screen.queryByText('Reset Connector Offsets')).toBeInTheDocument();
expect(screen.getByText('Reset Connector Offsets')).not.toBeDisabled();
expectActionButtonsExists();
});

Expand All @@ -97,6 +114,8 @@ describe('Actions', () => {
expect(screen.queryByText('Resume')).not.toBeInTheDocument();
expect(screen.queryByText('Pause')).not.toBeInTheDocument();
expect(screen.queryByText('Stop')).not.toBeInTheDocument();
expect(screen.queryByText('Reset Connector Offsets')).toBeInTheDocument();
expect(screen.getByText('Reset Connector Offsets')).toBeDisabled();
expectActionButtonsExists();
});

Expand All @@ -110,6 +129,8 @@ describe('Actions', () => {
expect(screen.queryByText('Resume')).not.toBeInTheDocument();
expect(screen.queryByText('Pause')).not.toBeInTheDocument();
expect(screen.queryByText('Stop')).not.toBeInTheDocument();
expect(screen.queryByText('Reset Connector Offsets')).toBeInTheDocument();
expect(screen.getByText('Reset Connector Offsets')).toBeDisabled();
expectActionButtonsExists();
});

Expand All @@ -123,6 +144,8 @@ describe('Actions', () => {
expect(screen.queryByText('Resume')).not.toBeInTheDocument();
expect(screen.getByText('Pause')).toBeInTheDocument();
expect(screen.getByText('Stop')).toBeInTheDocument();
expect(screen.queryByText('Reset Connector Offsets')).toBeInTheDocument();
expect(screen.getByText('Reset Connector Offsets')).toBeDisabled();
expectActionButtonsExists();
});

Expand Down

0 comments on commit 971c2c9

Please sign in to comment.