Skip to content
Snippets Groups Projects
Unverified Commit 98948744 authored by Matiss Janis Aboltins's avatar Matiss Janis Aboltins Committed by GitHub
Browse files

:white_check_mark: change unit test usage of notes field (#780)

Added an extra `waitFor` after a flaky unit test step.

I'm not really super happy with this workaround.. but it does make the
test much more stable (re-ran 5x and no failures:
https://github.com/actualbudget/actual/actions/runs/4455134799).

I think there is some internal timeout happening somewhere which is
causing this issue.. But not really sure where. And this will hopefully
get auto-fixed once we migrate to a new table. :fingers_crossed:
parent 2903fd00
No related branches found
No related tags found
No related merge requests found
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { render, screen, fireEvent } from '@testing-library/react'; import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import userEvent from '@testing-library/user-event'; import userEvent from '@testing-library/user-event';
import { format as formatDate, parse as parseDate } from 'date-fns'; import { format as formatDate, parse as parseDate } from 'date-fns';
...@@ -359,6 +359,9 @@ describe('Transactions', () => { ...@@ -359,6 +359,9 @@ describe('Transactions', () => {
// When reaching the bottom it shouldn't error // When reaching the bottom it shouldn't error
input = await editField(container, 'notes', 4); input = await editField(container, 'notes', 4);
await userEvent.type(input, '[Enter]'); await userEvent.type(input, '[Enter]');
await waitFor(() => {
expect(container.querySelector('input')).toBeNull();
});
// When reaching the top it shouldn't error // When reaching the top it shouldn't error
input = await editField(container, 'notes', 0); input = await editField(container, 'notes', 0);
......
---
category: Maintenance
authors: [MatissJanis]
---
Add `waitFor` to a flaky unit test to make it more stable
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment