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

Fetch PUT Request gives 222 status code #3535

Closed
alexis-tao opened this issue Mar 6, 2019 · 2 comments
Closed

Fetch PUT Request gives 222 status code #3535

alexis-tao opened this issue Mar 6, 2019 · 2 comments
Assignees
Labels
STATE: Auto-locked An issue has been automatically locked by the Lock bot. TYPE: question The issue contains a question that won't be addressed.

Comments

@alexis-tao
Copy link

alexis-tao commented Mar 6, 2019

What is your Test Scenario?

Fetch PUT request returns a 222 status code instead of a proper error code or 200

What is the Current behavior?

  • In the test, after clicking the click me words on the page, no error is thrown, we get 222 status code instead

What is the Expected behavior?

  • After clicking the click me words on the page, an error should be thrown, then the state should be changed to display error
  • Text should show up on page saying error
  • Testcafe tests should pass

Your complete test code (or attach your test files):

import { Selector } from 'testcafe';

const button = Selector(`[data-test-id="button"]`);
const clicked = Selector(`[data-test-id="clicked"]`);

fixture('Button').page(`http://localhost:3000`);

test('Help', async t => {
  console.log('Help model opens on click');
  await t
    .click(button).expect(clicked.visible).ok().wait(100000);
});

Your complete test report:

Note: this test fails because an error is never thrown, which affects the visibility of clicked. So, the test report below is not very useful

✖ Help

   1) AssertionError: expected false to be truthy

      Browser: Chrome 72.0.3626 / Mac OS X 10.14.1

          6 |fixture('Button').page(`http://localhost:3001`);
          7 |
          8 |test('Help', async t => {
          9 |  console.log('Help model opens on click');
         10 |  await t
       > 11 |    .click(button).expect(clicked.visible).ok().wait(100000);
         12 |});
         13 |

         at ok (/Users/a/Desktop/test/tests/App.testcafe.js:11:44)
         at test (/Users/a/Desktop/test/tests/App.testcafe.js:8:1)
         at markeredfn
      (/Users/a/Desktop/test/node_modules/testcafe/src/api/wrap-test-function.js:17:28)
         at <anonymous>
      (/Users/a/Desktop/test/node_modules/testcafe/src/api/wrap-test-function.js:7:5)
         at fn (/Users/a/Desktop/test/node_modules/testcafe/src/test-run/index.js:240:19)
         at TestRun._executeTestFn
      (/Users/a/Desktop/test/node_modules/testcafe/src/test-run/index.js:236:38)
         at _executeTestFn
      (/Users/a/Desktop/test/node_modules/testcafe/src/test-run/index.js:289:24)

Steps to Reproduce:

  1. Download the provided file
  2. Run yarn start
  3. Click click me on the webpage
  4. Text should show up saying error
  5. Run testcafe chrome tests/
  6. Test will fail because an error is never thrown

Your Environment details:

  • testcafe version: 1.1.0
  • node.js version: v8.15.0
  • command-line arguments: testcafe chrome tests/
  • browser name and version: Chrome Version 72.0.3626.119
  • platform and version: macOS Mojave Version 10.14.1

File

test.zip

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Mar 6, 2019
@miherlosev miherlosev self-assigned this Mar 6, 2019
@miherlosev
Copy link
Collaborator

Hi @alexistaocognite

222 is an internal TestCafe status code. It indicates the request does not pass the CORS rules.
If you open the application and click the 'click me' text on the page when you will get the error.

image

You need to configure the fetch request to it passes the CORS rules.

At present, it is not clear what is happening. We will improve the current behavior. I've created an enhancement for you case - #3536.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Mar 6, 2019
@miherlosev miherlosev added TYPE: question The issue contains a question that won't be addressed. STATE: Need response An issue that requires a response or attention from the team. and removed STATE: Need response An issue that requires a response or attention from the team. labels Mar 6, 2019
@lock
Copy link

lock bot commented Mar 27, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or feature requests. For TestCafe API, usage and configuration inquiries, we recommend asking them on StackOverflow.

@lock lock bot added the STATE: Auto-locked An issue has been automatically locked by the Lock bot. label Mar 27, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
STATE: Auto-locked An issue has been automatically locked by the Lock bot. TYPE: question The issue contains a question that won't be addressed.
Projects
None yet
Development

No branches or pull requests

2 participants