Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Fix testing-library/await-async-queries violations #82747

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,6 @@ export default typescript.config([
files: ['**/*.spec.{tsx,jsx}', 'tests/js/**/*.{tsx,jsx}'],
...testingLibrary.configs['flat/react'],
rules: {
'testing-library/await-async-queries': 'warn', // TODO(ryan953): Fix the violations, then delete this line
'testing-library/no-await-sync-events': 'warn', // TODO(ryan953): Fix the violations, then delete this line
'testing-library/no-await-sync-queries': 'warn', // TODO(ryan953): Fix the violations, then delete this line
'testing-library/no-container': 'warn', // TODO(ryan953): Fix the violations, then delete this line
Expand Down
61 changes: 36 additions & 25 deletions static/app/views/performance/newTraceDetails/trace.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,14 @@ async function keyboardNavigationTestSetup() {
const virtualizedScrollContainer = getVirtualizedScrollContainer();

// Awaits for the placeholder rendering rows to be removed
await findAllByText(virtualizedContainer, /transaction-op-/i, undefined, {
timeout: 5000,
}).catch(e => {
try {
await findAllByText(virtualizedContainer, /transaction-op-/i, undefined, {
timeout: 5000,
});
} catch (e) {
printVirtualizedList(virtualizedContainer);
throw e;
});
}
return {...value, virtualizedContainer, virtualizedScrollContainer};
}

Expand Down Expand Up @@ -340,12 +342,14 @@ async function pageloadTestSetup() {
const virtualizedScrollContainer = getVirtualizedScrollContainer();

// Awaits for the placeholder rendering rows to be removed
await findAllByText(virtualizedContainer, /transaction-op-/i, undefined, {
timeout: 5000,
}).catch(e => {
try {
await findAllByText(virtualizedContainer, /transaction-op-/i, undefined, {
timeout: 5000,
});
} catch (e) {
printVirtualizedList(virtualizedContainer);
throw e;
});
}
return {...value, virtualizedContainer, virtualizedScrollContainer};
}

Expand Down Expand Up @@ -396,13 +400,14 @@ async function nestedTransactionsTestSetup() {
const virtualizedScrollContainer = getVirtualizedScrollContainer();

// Awaits for the placeholder rendering rows to be removed
await findAllByText(virtualizedContainer, /transaction-op-/i, undefined, {
timeout: 5000,
}).catch(e => {
try {
await findAllByText(virtualizedContainer, /transaction-op-/i, undefined, {
timeout: 5000,
});
} catch (e) {
printVirtualizedList(virtualizedContainer);
throw e;
});

}
return {...value, virtualizedContainer, virtualizedScrollContainer};
}

Expand Down Expand Up @@ -451,12 +456,14 @@ async function searchTestSetup() {
const virtualizedScrollContainer = getVirtualizedScrollContainer();

// Awaits for the placeholder rendering rows to be removed
await findAllByText(virtualizedContainer, /transaction-op-/i, undefined, {
timeout: 5000,
}).catch(e => {
try {
await findAllByText(virtualizedContainer, /transaction-op-/i, undefined, {
timeout: 5000,
});
} catch (e) {
printVirtualizedList(virtualizedContainer);
throw e;
});
}
return {...value, virtualizedContainer, virtualizedScrollContainer};
}

Expand Down Expand Up @@ -509,12 +516,14 @@ async function simpleTestSetup() {
const virtualizedScrollContainer = getVirtualizedScrollContainer();

// Awaits for the placeholder rendering rows to be removed
await findAllByText(virtualizedContainer, /transaction-op-/i, undefined, {
timeout: 5000,
}).catch(e => {
try {
await findAllByText(virtualizedContainer, /transaction-op-/i, undefined, {
timeout: 5000,
});
} catch (e) {
printVirtualizedList(virtualizedContainer);
throw e;
});
}
return {...value, virtualizedContainer, virtualizedScrollContainer};
}

Expand Down Expand Up @@ -719,12 +728,14 @@ async function completeTestSetup() {
const virtualizedScrollContainer = getVirtualizedScrollContainer();

// Awaits for the placeholder rendering rows to be removed
await findAllByText(virtualizedContainer, /transaction-op-/i, undefined, {
timeout: 5000,
}).catch(e => {
try {
await findAllByText(virtualizedContainer, /transaction-op-/i, undefined, {
timeout: 5000,
});
} catch (e) {
printVirtualizedList(virtualizedContainer);
throw e;
});
}
return {...value, virtualizedContainer, virtualizedScrollContainer};
}

Expand Down
Loading