3

I am trying to run a straightforward script as below from a Macbook. This runs fine when I try from a personal home network but fails on corporate/office network with error "failed to find a DNS-record for the resource".
In Macbook, the proxy is configured at system-level, so I assume the Testcafe browser session would refer to the same. I also tried forcing the proxy in TestCafe run parameter and that didn't work either. I rechecked the firewall settings and the node is in the allowed list of programs. Any help would be greatly appreciated, please.

import { Selector } from 'testcafe';

fixture `Hello Google`
    .page `https://www.google.co.in/`

test('My first test', async t => {
    console.log ("Hi Google")
})

I have node 12.14.0, npm 6.13.4 and testcafe 1.6.1. I also tried with testcafe 1.7.1 and the results were the same.

Andrey Belym
  • 2,893
  • 8
  • 19
Janaaaa
  • 1,346
  • 1
  • 16
  • 34
  • 2
    Can you access the mentioned web site without TestCafe? What happens when you run curl (`curl https://www.google.co.in -o /dev/null`) on that web site? How did you specify your proxy options for running tests? – Alex Skorkin Jan 07 '20 at 10:23
  • I am able to access the site from a browser manually. Through curl, i am getting this error: "curl: (7) Failed to connect to www.google.co.in port 443: Connection refused". For proxy, I tried the following command: testcafe chrome logintest.js --proxy proxy.mycorp.com:port – Janaaaa Jan 07 '20 at 14:09
  • 2
    Have you tried running `curl` with your proxy settings? https://stackoverflow.com/a/9445516 – Andrey Belym Jan 08 '20 at 09:52
  • curl with proxy worked. so, i tried giving it in testcaferc file and it worked. for some reason, it is not working when i give it as part of the run command. but i am good now since am able to run the tests fine. thank you. – Janaaaa Jan 09 '20 at 18:17

1 Answers1

3

The issue has been resolved by specifying proxy settings in the configuration file.

https://devexpress.github.io/testcafe/documentation/reference/configuration-file.html#proxy

mlosev
  • 5,130
  • 1
  • 19
  • 31
Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47