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

Test fails due to proxy URL and routing #6877

Closed mypchas6fans closed 1 year ago

mypchas6fans commented 2 years ago

What is your Scenario?

Access www.ikea.cn/cn/en with testcafe, click top-right cart icon to go to shopping cart. It should go to login page but now shows 404 page. The shopping cart is a standalone SPA with specific routing like /cn/en/pay/cart, /cn/en/pay/pay, etc.

Actually it was working before Feb 10, but we are not sure what change resulted this incompatibility so hope to look for help. Found below similar issues: https://github.com/DevExpress/testcafe/issues/6803 https://github.com/DevExpress/testcafe/issues/6653

And we have tried playwright which works fine.

What is the Current behavior?

Redirected to a 404 page, with no error in network request and console.

What is the Expected behavior?

login page should be displayed as manual test.

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

https://www.ikea.cn/cn/en

What is your TestCafe test code?

import { Selector } from 'testcafe';

fixture('test') .page('https://www.ikea.cn/cn/en')

test ('test', async t => { await t.debug(); await t.click(Selector('div').withAttribute('data-track-id', 'head-nav.7')); await t.expect(Selector('button.cart-login-btn').visible).ok(); });

Your complete configuration file

No response

Your complete test report

No response

Screenshots

No response

Steps to Reproduce

1. 2. 3.

TestCafe version

1.18.3

Node.js version

14.18.3

Command-line arguments

testcafe chrome test.js -e

Browser name(s) and version(s)

chrome 98

Platform(s) and version(s)

windows 10; ubuntu 20.04

Other

No response

VasilyStrelyaev commented 2 years ago

Thank you for your report. I have reproduced the described behavior in the latest version of the TestCafe Hammerhead playground. We will update this thread once we have any news.

miherlosev commented 1 year ago

Hi @mypchas6fans,

TestCafe runs tests using the URL-rewritten proxy. This approach is good. However, there is a way to improve the stability and speed of test execution - the native browser automation API. We have a test execution mode uses native browser automation - we call it the Proxyless mode. In Proxyless mode, a few issues are already fixed. By the way, this issue was also fixed in Proxyless mode. Try running your tests in Proxyless mode and let us know the results. 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"
}   

Note that at present it is an experimental mode. Also, the Proxyless mode 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.

mypchas6fans commented 1 year ago

Sorry for late reponse. This issue still can be reproduced on proxy mode and not on Proxyless mode. Close for now.