magic-test / magic-test-laravel

MIT License
456 stars 21 forks source link

It's closing for no reason #27

Open mateusgalasso opened 3 years ago

mateusgalasso commented 3 years ago

I just run php artisan magic image

The browser open and close My test: image

mateusjatenee commented 3 years ago

Hey! Can you check which version are you running under composer.lock?

mateusgalasso commented 3 years ago

Hey! Can you check which version are you running under composer.lock?

0.3.0

mateusgalasso commented 3 years ago

Hey! Can you check which version are you running under composer.lock?

"magic-test/magic-test-laravel": "^0.3.0",

solracnet commented 3 years ago

When this happens to me (with Java and Selenium) it is because of the different version between the browser and the driver.

mateusjatenee commented 3 years ago

@stonkeep hmmm. Which version of Chrome are you running?

fs-csmith commented 3 years ago

I am having the same issue, when running magic, the browser appears for a couple hundred milliseconds and immediately disappears. If I insert a few assertions, the browser will stay open long enough to run the assertions, but as soon as it hits the magic function, the browser disappears.

I am running this in a Laragon (4.0.16.190914) environment on Windows. Apache 2.4.47 win64 VS16 PHP 7.4.19 VC15 MagicTest 0.14 Laravel 8.38.0 Chrome Driver 90.0.4430.24 Chrome 90.0.4430.212

Do you have any suggestions for where I can work to start troubleshooting this? Any assistance would be greatly appreciated.

Sanoj32 commented 3 years ago

Any updates for this issue? I am experiencing the same thing.

mateusgalasso commented 3 years ago

@stonkeep hmmm. Which version of Chrome are you running?

The Last one

mateusjatenee commented 3 years ago

@fs-csmith please update your Magic Test dependency

mateusjatenee commented 3 years ago

Any updates for this issue? I am experiencing the same thing.

Please make sure you're on the latest version of the package. What do you see on composer list?

mateusjatenee commented 3 years ago

@stonkeep hmmm. Which version of Chrome are you running?

The Last one

I need to know the exact version please

fs-csmith commented 3 years ago

@fs-csmith please update your Magic Test dependency

Thank you for your reply. To the best of my knowledge I am on the most current versions. Chrome recently updated so that version has changed since my last post. Currently, I am running:

Laragon (4.0.16.190914) environment on Windows. Apache 2.4.47 win64 VS16 PHP 7.4.19 VC15 Laravel 8.38.0 Chrome Driver 90.0.4430.24 Chrome 91.0.4472.77 MagicTest 0.14

To eliminate the Laragon environment, I tried running on php artisan serve and got the same behavior. I appreciate your help.

fs-csmith commented 3 years ago

To be more clear when running magic in my terminal, I get a message DevTools listening on ws://.... followed by a handful of errors

[10:25:53.854] USB: usb_device_handle_win.cc:1058 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)

I initially ignored the errors as they seemed to be issues with the chromedriver that just needed to be cleaned up by them, but perhaps it is applicable to this issue?

And, I get the error even when no devices are connected.

mateusjatenee commented 3 years ago

@fs-csmith I got access to a Windows computer and I'll try to reproduce your bug. Thanks for following the thread!

Super-Saiyan-Mohamed commented 3 years ago

Hello @mateusjatenee ,

Is there any update on this issue?

Thank You.

mateusjatenee commented 3 years ago

Hello @mateusjatenee ,

Is there any update on this issue?

Thank You.

Hey Mohamed,

I've tried it on Windows and it worked fine. My time is a bit tight to pursue this further on Windows since I don't use it, so any help is very much appreciated.

DanielvdSpoel commented 3 years ago

@mateusjatenee I have the same issue, I just see the chrome window briefly and then it closes. Chrome version is 93.0.4577.82 (Official Build) (64-bit). Version of magic test is 0.14

mateusjatenee commented 3 years ago

@mateusjatenee I have the same issue, I just see the chrome window briefly and then it closes.

Chrome version is 93.0.4577.82 (Official Build) (64-bit). Version of magic test is 0.14

Thanks Daniel. Are you on Windows?

DanielvdSpoel commented 3 years ago

@mateusjatenee I have the same issue, I just see the chrome window briefly and then it closes. Chrome version is 93.0.4577.82 (Official Build) (64-bit). Version of magic test is 0.14

Thanks Daniel. Are you on Windows?

Yes I am on windows, fresh laravel application. It opens, i see the default laravel welcome page and then it closes. Feels like it doesn't 'detect' the magic call

DanielvdSpoel commented 3 years ago

I have an example repository that didn't work for me and a colleague. Maby it's handy for you debugging: https://github.com/DanielvdSpoel/magictesten

khairu-aqsara commented 3 years ago

is there any update on this? I having same issue here, the browser suddenly closed, I using same Chrome driver version with my installed Chrome 95.0.4638.54 and ChromeDriver 95.0.4638.17 it just a bit different with build number

DanielvdSpoel commented 3 years ago

@mateusjatenee do you have a update on this?

mateusgalasso commented 2 years ago

I haven't tested it again

mateusjatenee commented 2 years ago

@stonkeep @DanielvdSpoel Sorry, I don't have a Windows machine to test. I will ask a few colleagues to maybe reproduce the error and help me figure out what it is.

huszerldani commented 2 years ago

Same problem here. I am using Laragon and Laravel 8 on Windows. I tried an older chromedriver... When i start magic chrome appears and disappears two times

ITMobilityControl commented 1 year ago

This is probably because Windows doesn't support TTY. I think this manages the terminal connections. So when the magic test starts it tries to create a new Psy Shell (to ask for input). But since there is no TTY, it just skips this part and closes the browser (because it thinks it has completed the magic test steps).

This problem only exists on Windows itself (with for example Laragon). If you try this via WSL (Windows Subsystem for Linux), it'll probably work since that does have TTY support.

I've tried some ways to make this work with Windows/Laragon but I just can't get the MagicTestManager run function to 'talk' to the CMDER that Laragon uses.

TLDR; Windows/Laragon does not support TTY which does not boot the shell to ask for input.

A805532 commented 1 year ago

Hello @mateusjatenee , It is not working for me also. I have Windows 10 Enterprise machine. I my case browser is closing automatically. I checked it is working fine in Linux machine, and it is a very good innovation. Can you help me to setup magic-test in Windows 10 machine?

ITMobilityControl commented 1 year ago

@prakashhalder what applications are you using? For example Laragon or WSL (Windows Subsystem for Linux)?

A805532 commented 1 year ago

@prakashhalder what applications are you using? For example Laragon or WSL (Windows Subsystem for Linux)?

I am using xampp

ITMobilityControl commented 1 year ago

I am using xampp

Is this message popping up in your console by any chance? "TTY mode is not supported on Windows platform."

A805532 commented 1 year ago

I am using xampp

Is this message popping up in your console by any chance? "TTY mode is not supported on Windows platform."

Yes, I am getting "Warning: TTY mode is not supported on Windows platform." How can I solve this problem

ITMobilityControl commented 1 year ago

I am using xampp

Is this message popping up in your console by any chance? "TTY mode is not supported on Windows platform."

Yes, I am getting "Warning: TTY mode is not supported on Windows platform." How can I solve this problem

See my comment:

This is probably because Windows doesn't support TTY. I think this manages the terminal connections. So when the magic test starts it tries to create a new Psy Shell (to ask for input). But since there is no TTY, it just skips this part and closes the browser (because it thinks it has completed the magic test steps).

This problem only exists on Windows itself (with for example Laragon). If you try this via WSL (Windows Subsystem for Linux), it'll probably work since that does have TTY support.

I've tried some ways to make this work with Windows/Laragon but I just can't get the MagicTestManager run function to 'talk' to the CMDER that Laragon uses.

TLDR; Windows/Laragon does not support TTY which does not boot the shell to ask for input.

You can't fix this problem on Windows, because it simply does not support it. Only way you can get it to work on Windows is by installing WSL. See: https://learn.microsoft.com/en-us/windows/wsl/install

A805532 commented 1 year ago

I am using xampp

Is this message popping up in your console by any chance? "TTY mode is not supported on Windows platform."

Yes, I am getting "Warning: TTY mode is not supported on Windows platform." How can I solve this problem

Still I am unable using WSl, I am getting error like Facebook\WebDriver\Exception\UnknownErrorException: unknown error: Chrome failed to start: exited abnormally. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /snap/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

ITMobilityControl commented 1 year ago

This is a whole other error. You can try a few things:

  1. Remove the current chrome drivers from the Laravel dusk folder in vendor.
  2. Add the --disable-dev-shm-usage option.
  3. Google around and see what fixes it for you :)
A805532 commented 1 year ago

This is a whole other error. You can try a few things:

1. Remove the current chrome drivers from the Laravel dusk folder in vendor.

2. Add the --disable-dev-shm-usage option.

3. Google around and see what fixes it for you :)

Thanks for your response. Those steps which you have mentioned working well, all issues have gone. But we are getting blank chrom browser, no data. I am using docker. magic

Can you help me regarding this?

ITMobilityControl commented 1 year ago

Have you followed the installation steps for magic tests? Something like:

    public function testBasicExample()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit('/')
                    ->magic();
        });
    }

If this is the case, please share more information on what you are trying to test and with what code.

A805532 commented 1 year ago

Have you followed the installation steps for magic tests? Something like:

    public function testBasicExample()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit('/')
                    ->magic();
        });
    }

If this is the case, please share more information on what you are trying to test and with what code.

Hello, Thanks for your quick response. Still I am facing issue, I have followed the steps which were mentioned in the document. It was working fine Linux machine but issue in WSL, I have also adjust the setting which you have mentioned in this discussion, still I am getting blank chrom browser. I am attaching all the information with this response. Please once more if is there any solution. magic-5 magic-4 magic-3 magic-2

magic-1

ITMobilityControl commented 1 year ago

@prakashhalder sadly I cannot help you further without debugging the project myself. I would recommend diving into the magic test package and trying to find where it stops or doesn't give any more output.

mateusjatenee commented 1 year ago

@ITMobilityControl Appreciate your help here. 🙏🏻

I'll have access to a Windows machine for a few days and I'll try to debug this. It's really hard since it isn't reproducible in Linux/Mac, and apparently doesn't happen in WSL.

A805532 commented 1 year ago

@ITMobilityControl Appreciate your help here. 🙏🏻

I'll have access to a Windows machine for a few days and I'll try to debug this. It's really hard since it isn't reproducible in Linux/Mac, and apparently doesn't happen in WSL.

@ITMobilityControl Is there any update?