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

Converted wysiwyg jasmine file to jest test fixes #784 #785

Merged
merged 9 commits into from Jan 25, 2022

Conversation

NARUDESIGNS
Copy link
Collaborator

@NARUDESIGNS NARUDESIGNS commented Jan 11, 2022

Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!

  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with grunt jasmine
  • code is in uniquely-named feature branch and has no merge conflicts
  • PR is descriptively titled
  • PR body includes fixes #0000-style reference to original issue #
  • ask @publiclab/reviewers for help, in a comment below

We're happy to help you get this ready -- don't be afraid to ask for help, and don't be discouraged if your tests fail at first!

If tests do fail, click on the red X to learn why by reading the logs.

Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software

We have a loose schedule of reviewing and pulling in changes every Tuesday and Friday, and publishing changes on Fridays.

Thanks!

@gitpod-io
Copy link

gitpod-io bot commented Jan 11, 2022

@jywarren
Copy link
Member

Hi, it looks like, since we recently merged in some new changes to the main branch, you need to rebase your work on top of the latest main. You can do that by following the process outlined here, but you may be able to skip step 2 if your main is still in sync with publiclab's main: https://publiclab.org/wiki/contributing-to-public-lab-software#Rewinding+the+master+branch

In general there are more tips and guides on rebasing here: https://publiclab.org/wiki/developers#Resources

Thanks!

@jywarren
Copy link
Member

Looks like you're seeing real test failures now, not just an error before running. Let me know if you need help with these!

@NARUDESIGNS
Copy link
Collaborator Author

NARUDESIGNS commented Jan 11, 2022

I ran the tests on my local machine and it all passed. How can I run it here please?
Or can you tell me the error it throws in the log?
@jywarren

@jywarren
Copy link
Member

Sure - it's here: https://github.com/publiclab/PublicLab.Editor/runs/4778470519?check_suite_focus=true#step:7:49

What i do is click the Details link, then click the line in the log with the red error icon and it expands, then i search for "FAIL" to find individual failures. The log is tough to read so the search function really helps!

image

@jywarren
Copy link
Member

One looks like a timeout, which is a little unexpected. Let's try to figure out why the others are true/false failures, and maybe the timeout will resolve itself? We can also just re-run it to see if it was something intermittent if it really is supposed to run smoothly. Finally, we could lengthen the timeout limit to see if it helps! But, my guess is it should be enough time, we're just waiting for local asynchronous code to run, which should be pretty fast.

@NARUDESIGNS
Copy link
Collaborator Author

This is a bit confusing. Line 49 refers to bold.test.js, all these tests passed before I started learning about them. I wonder how it is failing now when no changes was made to it.
@jywarren

@jywarren
Copy link
Member

Ah, ok. So these test failures are totally unconnected to this PR. That's usually a signal we should a) restart them and b) look at other unrelated reasons the tests could be flaky, but in a separate issue. Would you mind opening one and linking specifically to this run, so we can check the logs? This URL shouldn't change even if we start the tests over:

https://github.com/publiclab/PublicLab.Editor/runs/4778470519

And you can link to this PR as an example of one where this happened.

@jywarren
Copy link
Member

Yes, so confirming, this does seem to be intermittent, and unfortunately this time the CustomInsertTest failed:

FAIL test/ui-testing/CustomInsert.test.js (10.573 s)
  Custom Insert text
    ✕ Add Custom Insert text in rich text mode (10002 ms)

  ● Custom Insert text › Add Custom Insert text in rich text mode

    : Timeout - Async callback was not invoked within the 10000 ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 10000 ms timeout specified by jest.setTimeout.Error:

       7 | 
       8 | describe('Custom Insert text', () => {
    >  9 |   test('Add Custom Insert text in rich text mode', async () => {
         |   ^

My guess is we may need to restart it again, but also copy these errors into that new tracking issue and try to work the problem there. I'll also try running it in GitPod to see!

@jywarren jywarren closed this Jan 11, 2022
@jywarren jywarren reopened this Jan 11, 2022
@@ -0,0 +1,53 @@
const timeout = process.env.SLOWMO ? 60000 : 10000;
Copy link
Member

Choose a reason for hiding this comment

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

We can try increasing this to above 10 seconds for all tests...?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure we could do that. But may I ask please, why do you think we should increase the timeout? Did you experience any timeout recently?
@jywarren

Copy link
Member

Choose a reason for hiding this comment

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

Based on the message in the logs:

: Timeout - Async callback was not invoked within the 10000 ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 10000 ms timeout specified by jest.setTimeout.Error:

I am guessing that for some reason it took longer. It's worth a try!

Copy link
Member

Choose a reason for hiding this comment

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

And that was the same as with one of the earlier bold test failures!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh ok, I get. I think I got that error sometimes and when I ran the test again it works fine. But it's ok, we could increase the timeout value to say 15000ms or 20000ms.
Is that much or enough, what do you think?

@jywarren
Copy link
Member

jywarren commented Jan 11, 2022 via email

@NARUDESIGNS
Copy link
Collaborator Author

Alright. Lastly, can we try running that particular test again here?
Can you please teach me how to do it so I can try running again it to see if I'd always get that error? (just curious)

@jywarren
Copy link
Member

For sure. Either you close and reopen the PR, or you can open the checks and you'll see a button:

image

Where it says Cancel workflow it'll later say "re-run" (once it's done). You can do it there too. You could cancel too but i'm always surprised by how long it takes to cancel.

@jywarren
Copy link
Member

OK, i just pushed a commit lengthening all Jest test timeouts to 15 seconds instead of 10. Let's see... 🤞

@jywarren
Copy link
Member

Well, 15 seconds doesn't seem to have worked :-(

This is weird because it just started happening, right? A variety of earlier PRs didn't see this issue?

I'm going to check if somehow there's an error happening inside the async test and not getting logged out. Maybe it's not a timeout but an error somehow...

@jywarren
Copy link
Member

I think our next step is to research what's causing this timeout error. I started searching in https://github.com/facebook/jest/search?q=Timeout+-+Async+callback+was+not+invoked+within&type=issues - and bearing in mind https://jestjs.io/docs/asynchronous

I can try again later in the week!

@NARUDESIGNS
Copy link
Collaborator Author

Well, 15 seconds doesn't seem to have worked :-(

This is weird because it just started happening, right? A variety of earlier PRs didn't see this issue?

I'm going to check if somehow there's an error happening inside the async test and not getting logged out. Maybe it's not a timeout but an error somehow...

The PRs I created didn't have this issues and also my local tests passes as well. Where are you seeing these? I'm a little confused 🤕

@jywarren
Copy link
Member

Just copying in a note here:

I think we need to read through some issues in the Jest repository, searching for keywords to find something similar to what we're seeing. We may also want to search a bit in Stack Overflow. Just trying to find someone who's seen something similar! We could also try to run things more verbosely so we get more log output as well... to try to determine when it's failing.

@jywarren
Copy link
Member

Ideas

@NARUDESIGNS
Copy link
Collaborator Author

NARUDESIGNS commented Jan 25, 2022

Hey @jywarren I think the solution is solid and we got all our answers. I just pasted the changes from #804, reduced the timeout from 60000 to 10000, added comment to explain that part and pushed here which was the original PR and it passes the test.
I think we solved it!

More info @ #804

@jywarren jywarren merged commit 70feac2 into main Jan 25, 2022
@jywarren
Copy link
Member

Super well done! This was a tough and mysterious one but you did great. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants