DevExpress / testcafe

A Node.js tool to automate end-to-end web testing.
https://testcafe.io
MIT License
9.82k stars 670 forks source link

Uncaught object "[object Object]" was thrown. Throw Error instead with every single action after switchToIframe with TestCafe versions >1.15.2 #6807

Closed anderconal closed 1 year ago

anderconal commented 2 years ago

What is your Scenario?

What is the Current behavior?

What is the Expected behavior?

What is your public website URL? (or attach your complete example)

What is your TestCafe test code?

import { Role, Selector } from "testcafe";
import { screen } from '@testing-library/testcafe';

const adminUserRole = Role(`https://id.whatever.com/login`, async t =>{
    await t.typeText(Selector('#username'), 'me@emailcom');
    await t.click(screen.getByText('Continue'))
    await t.typeText(Selector('#password'), '')
    await t.click(screen.getByText('Log in'));
})

fixture `example-1`
    .page`https://whatever.net/your-page`

test('Add read confirmation', async function(t){
    await t.setTestSpeed(0.5);
    await t.maximizeWindow();

    await t.useRole(adminUserRole);
    const dotdotdotSelector = Selector(screen.getByTestId('content-tools-dropdown-menu--trigger'));
    await t.click(dotdotdotSelector);

    const addReadConfSelector =  Selector(screen.getByText(/add read confirmation/i));
    await t.click(addReadConfSelector);

    const addIframeSelector = '[id^=\'my_iframe_id__\']';
    await t.expect(Selector(addIframeSelector).exists).ok();
    console.log('addIframeSelector exists before switch to iframe');
    await t.switchToIframe(Selector(addIframeSelector));
    console.log('switched to addIframeSelector');
    const confirmButton = Selector(screen.getByRole('button', { name: /confirm/i }));
    console.log('This is the last point that works. Every single interaction on the iframe will fail for TestCafe versions > 1.15.2 with Uncaught object "[object Object]" was thrown. Throw Error instead.');
    await t.click(confirmButton); // This fails with Uncaught object "[object Object]" was thrown. Throw Error instead.
    console.log('You can not arrive here. No action is working');
});

Your complete configuration file

{
  "clientScripts": [{ "module": "@testing-library/dom/dist/@testing-library/dom.umd.js" }],
  "screenshotPath": "./screenshots",
  "screenshotPathPattern": "${DATE}_${TIME}/${FIXTURE}.png",
  "skipJsErrors": true,
  "concurrency": 1,
  "takeOnFails": true,
  "disablePageCaching": true,
  "disableScreenshots": true
}

Your complete test report

Running tests in:

Screenshots

No response

Steps to Reproduce

  1. Clone the minimal working example from GitHub
  2. Follow the README.md instructions
  3. See the test fail

TestCafe version

1.15.3, 1.17.0, 1.18.0

Node.js version

12.12.0

Command-line arguments

node ./node_modules/testcafe/bin/testcafe.js chrome example-1.test.js

Browser name(s) and version(s)

Chrome 96.0.4664.110, Firefox 95.0

Platform(s) and version(s)

macOS 10.15.7

Other

No response

AlexanderMoiseev commented 2 years ago

Hi,

We need access to your project's GitHub repository to reproduce the issue, please send it to support@devexpress.com.

miherlosev commented 2 years ago

Hi @anderconal

Could you please give access to the repository with the example to @miherlosev?

anderconal commented 2 years ago

Hello!

First of all, thanks for your quick response.

You should have received an invitation:

See image: https://user-images.githubusercontent.com/19661411/148911720-bc5a9bff-7f98-4b10-826c-07dfd1bbb1be.png

Best,

Ander Conal

Sent with ProtonMail Secure Email.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Thursday, January 6th, 2022 at 4:47 PM, AlexanderMoiseev @.***> wrote:

Hi,

We need access to your project's GitHub repository to reproduce the issue, please send it to @.***

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you authored the thread.Message ID: @.***>

miherlosev commented 2 years ago

You should have received an invitation: [image.png]

I didn't see any notification. Please try adding access to the example's repository using steps from the following help article.

anderconal commented 2 years ago

Already sent the invitation. See:

image

And now to your user too:

image

Best,

Ander Conal

miherlosev commented 2 years ago

I run the shared example with the latest TestCafe version (v1.18.2-alpha.1), and all works fine. image

Try to run your tests with this version and let us know about the results.

anderconal commented 2 years ago

Hello,

I'm trying to test it with v1.18.2-alpha.1 and the following message is appearing all the time:

TestCafe requires permission to record the screen. Open 'System Preferences > Security & Privacy > Privacy > Screen Recording' and check 'TestCafe Browser Tools' in the application list.

I already followed:

And tried to:

image

It is not working and I can not continue with the test.

Should I try to do something more?

aleks-pro commented 2 years ago

Hello @anderconal ,

Please follow this guide to obtain the necessary permissions: https://testcafe.io/403664/release-notes/framework/2021-12-22-testcafe-v1-18-0-released#testcafe-browser-tools-macos-permission-fix

Let us know if this helps.

anderconal commented 2 years ago

Thanks @aleks-pro I'll check it this morning and update you. Thanks a lot!

anderconal commented 2 years ago

Hey @aleks-pro the guide you provided worked nicely!

BTW @miherlosev I still see the same error after update to 1.18.2-alpha.1:

image

Am I missing something? Should I test it other way?

miherlosev commented 2 years ago

Hi @anderconal,

After several attempts, I was able to reproduce the issue using the example you shared. Thank you for the detailed information and your cooperation.

anderconal commented 2 years ago

Thanks @miherlosev for you time, patience and quick responses.

If you need anything from our part, please, just ask!

ipy76 commented 2 years ago

Hi @miherlosev from now on I'll be the responsible of this issue so do not hesite to contact me for further required info of whatever you need. I hope to know soon about a fix of this issue. Thanks

mariusstaicu22 commented 2 years ago

Hello, I encountered a repetitive mod of this error: I ran the automated test suite with concurrency 3 and it thrown the [object][object] error. When the suite is ran regularly, there is no error displayed. Any ideas of the status of this issue? Thank you, Marius

testcafe-build-bot commented 2 years ago

Any personal estimate may be misleading, so we cannot currently tell it at the moment. Once we get any results, we will post them in this thread.

liviuavram commented 2 years ago

Hey! I got this error too now. I tried to work around https://github.com/DevExpress/testcafe/issues/7206 by adding an expect and I get this error now. o.o

AlexKamaev commented 2 years ago

We do not have any updates on the status of the issue. Once we have any results, we'll post them here.

Artem-Babich commented 1 year ago

Hello,

We released a new TestCafe version (v2.3.0), which includes experimental proxyless mode. This mode uses native browser automation. In Proxyless mode, a few issues are already fixed. This issue should also be fixed in Proxyless mode.

Unfortunately, I was not able to test your web site since the URL you shared is no longer available. Would you please check if your sample is working correctly in v2.3.0 with experimental proxyless mode enabled? This option is available in all interfaces:

// Command-line
testcafe chrome tests --experimental-proxyless

// Programmatic
const testcafe = await createTestCafe({ experimentalProxyless: true });

// Configuration file
{
   "experimentalProxyless": "true"
}    

Please keep in mind that this mode is still experimental and is implemented only in Google Chrome. It will not work correctly if you run tests in a non-Chrome browser or in a combination of other browsers.

github-actions[bot] commented 1 year ago

This issue was automatically closed because there was no response to our request for more information from the original author. Currently, we don't have enough information to take action. Please reach out to us if you find the necessary information and are able to share it. We are also eager to know if you resolved the issue on your own and can share your findings with everyone.