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

when running vitest(using react-testing-library-dom) in git action, action exceeded the maximum execution time of xx minutes #1299

Closed
JayKim88 opened this issue Apr 11, 2024 · 7 comments

Comments

@JayKim88
Copy link

JayKim88 commented Apr 11, 2024

  • @testing-library/dom version: ^9.3.1
  • Testing Framework and version: vitest, 1.3.0
  • DOM Environment: jsdom ^22.1.0

Relevant code or config:

// error occurs in a code using synchronous method to find an element.
it('~~~~', () => {
...
 await userEvent.click(totalCheckBoxInTable); // this makes changes in UI

const combineBtn = screen.getAllByText('합포장')[0]; // here, cannot find element in git action ending up with spending whole testing time with fail.
...
})

What you did:

In git action, it fails with the comment as
"The job running on runner GitHub Actions XX has exceeded the maximum execution time of XX minutes."

As shown in the reproduction image, after combineOrders.test.tsx is passed, and it is stuck in the next test spending the whole test time ending up with test fail.

After testing this, I found that this error occurs in case that test tries to find a element by synchronous method such as getByText, getBy-. In local environment, it occurs error as intended if not found.
If I replace these methods with asynchronous method like findby-, it works well locally and in git action.

What happened:

git-action-error-image

Reproduction:

Problem description:

Explained in What you did.

Suggested solution:

I haven't found a solution for it.
Are there anybody who experienced this case ?
I hope to know why this happens and how to fix it accordingly.
I expect it must make error and fail as soon as it's impossible to find a target element.

Thank you all !

(By any chance, if it should be posted as Support Question, please let me know🙏)

Copy link

Uh oh! @JayKim88, the image you shared is missing helpful alt text. Check your issue body.

Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image.

Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.

@MatanBobi
Copy link
Member

Hi @JayKim88, thanks for opening this.
Unfortunately this issue doesn't have enough for us to start investigating. Usually, getAllBy queries throw an error when elements can't be found so I highly don't think that's the command causing the issue.

Can you please share a minimal reproduction of this issue using our template?

Thanks.

@JayKim88
Copy link
Author

@MatanBobi Thank you for your reply. The error takes place in git action when i try to push a PR(But locally, it works well.), thus, by using the template as you kindly suggested, can I make reproduction of git action as well? Or is it enough for you to get a part of codes like below? also i'm able to provide you with a short video showing the error.

...
on:
  pull_request:
    branches:
      - staging
...
jobs:
            check_and_test:
              timeout-minutes: 10
              runs-on: ubuntu-latest
              steps:
                ...
                - name: Codegen and check type and test code
                  run: |
                    export NODE_OPTIONS="--max-old-space-size=4096"
                    pnpm i --frozen-lockfile
                    pnpm tsc --noEmit
                    pnpm test run // this is 
                    pnpm codegen

Thank you..!

@MatanBobi
Copy link
Member

MatanBobi commented Apr 14, 2024

You can create a repo based on the template I've added and define the github action there :)

@JayKim88
Copy link
Author

You can create a repo based on the template I've added and define the github action there :)

okay..! Will create one and share accordingly~.

@JayKim88
Copy link
Author

JayKim88 commented May 7, 2024

You can create a repo based on the template I've added and define the github action there :)

okay..! Will create one and share accordingly~.

@MatanBobi I've tried and realized that I cannot apply the complexity of our product's code to the demo thus impossible to reproduce the error.

@MatanBobi
Copy link
Member

Unfortunately, without a proper reproduction we won't be able to investigate and try to assist here.
I'm closing this one as there's no actionable work item for us. If you will find a way to reproduce this, please feel free to re-open this and share the reproduction. We'd love to help.

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

No branches or pull requests

2 participants