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

Running a basic test for TestCafe seems to run indefinitely displaying a spinning set of green dots #231

Open
genosis opened this issue Jun 29, 2023 · 1 comment

Comments

@genosis
Copy link

genosis commented Jun 29, 2023

Currently, I am trying to run a basic sample test to confirm TestCafe is configured and working properly. However, upon running the test from the command line it responds with a set of 3 green dots animated to run in a circle like a loading or hourglass prompt to indicate it is running. The problem is it seems to run indefinitely as I have waiting for 20 minutes or longer to be sure it wasn't just running slow. The only way to recover is to find the process in another window and kill it to free up Port 1337 that it is running on. I have added a console.log statement to troubleshoot but nothing is output, and I have tried to enable logging but have not found a way to do this thus far.

Some other details and background...
My main goal is to run TestCafe as the testing framework used by GT-UI (Guidewire Testing Framework - which uses TestCafe for it's automation).
I am running on MacOS Ventura 13.3.1 with the M1 processor currently.
I was previously running GT-UI and TestCafe without issue on my old Intel based Mac, however, after upgrading to a new Mac with the M1 processor I ran into issues as noted below...

Initially I ran into this error while attempting to run GT-UI tests via TestCafe:
ERROR NativeBinaryHasFailedError: The find-window process failed with the 1 exit code.

After some research I found an article mentioning a new version of TestCafe would resolve some issues with the M1 processor:
https://testcafe.io/403664/release-notes/framework/2021-12-22-testcafe-v1-18-0-released#upgrade-instructions

I upgraded to TestCafe version 1.19.0 (which I am currently on) followed all the steps in that article yet the error persisted.

After more troubleshooting and research I came across this article on that error:
#221

I performed the steps referenced there (some duplicated from the previous article) and the 'chmod +x' command seemed to change the behavior I was seeing. Now, instead of the 'NativeBinaryHasFailed' error being seen, now the test (running from GT-UI) seems to 'hang' much sooner in the process and no longer produces any error at all. The only way to recover is to find the process running on port 1337 and kill it...

At this point I had started working with Guidewire Support on this issue, however, they just directed me to try and run a test directly from TestCafe to rule out GT-UI having an issue.

So, at this point, I added a few simple sample tests (detailed below) to run directly via TestCafe from the command line as a troubleshooting step.

This is where the original problem noted above comes in....
Currently, when I attempt to run either of the sample tests directly from TestCafe from the command line I am getting the reply of the 3 green dots animated to run in a circle indicating the test is running. However, as stated above, this process seems to run indefinitely with no output or logging that I can find to get more info on what is going on.

Upon reporting this to Guidewire Support they mentioned that the Test 'hanging' when running directly from TestCafe or when running via GT-UI are a TestCafe issue and not a GT-UI issue and they recommended I file a support case with TestCafe, and here I am...

I would like to get some assistance with throubleshooting the hanging tests via initiating logging or debugging or some other method to get more details on exactly what is going on and why the test is hanging in order to resolve the issue.

Please let me know what can be done to further troubleshoot this issue...

Below are some supporting details:

~ Test 1 - firstTest.js (this is a test taken directly from the TestCafe getting started page)

import { Selector } from 'testcafe';

fixture('Getting Started')
.page('https://devexpress.github.io/testcafe/example');

test('My first test', async t => {
await t
.typeText('#developer-name', 'John Smith')
.click('#submit-button')
.expect(Selector('#article-header').innerText).eql('Thank you, John Smith!');
console.log("Test is running.........");
});

~ Test 2 - firstPageOpenTest.js (test taken from testcafe examples from repo: https://github.com/DevExpress/testcafe-examples/blob/master/examples/check-if-opened-with-testcafe/index.html)

import { Selector } from 'testcafe';

fixture Check to ensure that the page was opened with TestCafe
.page('./openPageTest.html');

test('Check to ensure that the page was opened with TestCafe', async t => {
console.log("Page Open test is running....");
await t.expect(Selector('#main').innerText).eql('The page was opened with TestCafe: yes');
});

~ Test 2 - related HTML file - (from same examples repo noted above)

<title>Check to ensure that the page was opened with TestCafe</title>
The page was opened with TestCafe:
<script> const resultSpan = document.getElementById('result'); const isInTestCafe = !!window['%testCafeDriverInstance%'];
resultSpan.textContent = isInTestCafe ? 'yes' : 'no';
</script>

~ Console output when attempting to run a test:

(py310) p@APL gt-ui (user/p/gw-releases-flaine) $ testcafe --version
1.19.0
(py310) p@APL gt-ui (user/p/gw-releases-flaine) $ testcafe -b
firefox
chrome
safari
(py310) p@APL gt-ui (user/p/gw-releases-flaine) $ testcafe firstTest.js

Please let me know of anything further I can provide to push this issue forward...

@github-actions
Copy link

github-actions bot commented Jul 3, 2023

Thank you for submitting this issue. Since you are using an outdated version of TestCafe, we recommend you update TestCafe to the latest version to check if this issue has been addressed. We constantly improve our tools, and there is a chance that this issue has been already resolved and/or is no longer reproducible in the latest version. We look forward to your response.

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

No branches or pull requests

2 participants