8000 Table flaky/failing tests fix by DKos95 · Pull Request #4458 · adobecom/milo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Table flaky/failing tests fix #4458

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

Merged
merged 2 commits into from
Jul 5, 2025
Merged

Table flaky/failing tests fix #4458

merged 2 commits into from
Jul 5, 2025

Conversation

DKos95
Copy link
Contributor
@DKos95 DKos95 commented Jun 24, 2025

@DKos95 DKos95 requested a review from a team as a code owner June 24, 2025 09:47
Copy link
Contributor
aem-code-sync bot commented Jun 24, 2025

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

Copy link
Contributor
aem-code-sync bot commented Jun 24, 2025
Page Scores Audits Google
📱 /?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI
🖥️ /?martech=off PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@DKos95 DKos95 requested a review from a team June 24, 2025 11:00
@DKos95 DKos95 force-pushed the table-flaky-tests-fix branch from 8e326b6 to 2a835c9 Compare June 24, 2025 12:54
@aem-code-sync aem-code-sync bot temporarily deployed to table-flaky-tests-fix June 24, 2025 12:54 Inactive
@aem-code-sync aem-code-sync bot temporarily deployed to table-flaky-tests-fix June 24, 2025 14:32 Inactive
@@ -12,7 +12,7 @@ setConfig(conf);
const config = getConfig();

describe('table and tablemetadata', () => {
beforeEach(() => {
before(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me this looks like it builds up test-state and is an anti-pattern. If we depend on whatever one test has done - it's likely wrong.
Maybe we should just wipe the innerHTML and recreate the markup on each run - to properly isolate each test?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should stay a beforeEach and l7 should be moved into the beforeEach block

Copy link
Contributor
@mokimo mokimo Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS: If the tests already been written in a way, that they depend on whatever the test before has done - Good luck 😆
(Might not be worth the hassle in this case to do a refactoring of the whole file, that can be pretty time consuming)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with beforeEach here is that it initializes every table before each test and if we don't have a check in the table.js if the events have been added then it will add them again and cause bad tests not because of the tests but because of table.js attaching a listener again, so either we add the check in table.js to not attach listeners if already attached or change how we do this specific test like i did in this commit.

PS: moving l7 to beforeEach won't help 😅

Copy link
Contributor
@mokimo mokimo Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if there are multiple table blocks on a page - wouldn't that also lead to the table block attaching multiple listeners? Maybe the tests hint at a (real) issue here actually 😁
Might be good to check, otherwise I think it's not worth spending too much time on the unit tests unless you have a lot of free time on your hand

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried adding 2 tables on 1 page and added a console log but it only attached 2 times https://table-flaky-tests-fix--milo--adobecom.aem.page/drafts/dusan/check-multiple-tables.

Copy link
Contributor

This pull request is not passing all required checks. Please see this discussion for information on how to get all checks passing. Inconsistent checks can be manually retried. If a test absolutely can not pass for a good reason, please add a comment with an explanation to the PR.

@DKos95 DKos95 force-pushed the table-flaky-tests-fix branch from e72dd19 to 08490a9 Compare June 25, 2025 13:15
@DKos95 DKos95 requested a review from a team June 25, 2025 13:18
@milo-pr-merge milo-pr-merge bot merged commit ed3fb5f into stage Jul 5, 2025
17 checks passed
@milo-pr-merge milo-pr-merge bot deleted the table-flaky-tests-fix branch July 5, 2025 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0