I have protractor selenium tests running in a docker container. I have to test an insecure website. For one of the functions where API call is made to get some data back from backed chrome returns status code 400. I have added the following in my protractor config file:
chrome args ("--headless", "--no-sandbox", "--disable-dev-shm-usage")
directConnection: true,
disableChecks: true
Capabilities:
acceptInsecureCerts: true
acceptSslCerts: true
I have also added following in my .env file:
NODE_TLS_REJECT_UNAUTHORIZED=0
Below are the network logs I`ve gotten:
{
method: 'Network.responseReceived',
params: {
frameId: '721A00F872D1255AA1DAE58D2DF5D75E',
loaderId: '70EAE0F82B0AB6BDE6489BC26D77DA34',
requestId: '117.239',
response: {
connectionId: 309,
connectionReused: true,
encodedDataLength: 123,
fromDiskCache: false,
fromPrefetchCache: false,
fromServiceWorker: false,
headers: [Object],
mimeType: 'application/problem+json',
protocol: 'h2',
remoteIPAddress: 'remote ip',
remotePort: 443,
securityDetails: [Object],
securityState: 'insecure',
status: 400,
statusText: '',
timing: [Object],
url: 'https://api call link'
},
timestamp: 15184.562748,
type: 'XHR'
}
}
{
method: 'Network.dataReceived',
params: {
dataLength: 185,
encodedDataLength: 0,
requestId: '117.239',
timestamp: 15184.562954
}
}
{
method: 'Network.dataReceived',
params: {
dataLength: 0,
encodedDataLength: 203,
requestId: '117.239',
timestamp: 15184.563471
}
}
{
method: 'Network.loadingFinished',
params: {
encodedDataLength: 326,
requestId: '117.239',
shouldReportCorbBlocking: false,
timestamp: 15184.552973
}
}
To be noted, that when run locally outside of docker container this function works as expected and API call returns with status code: 200
P.S. Running it in Zelenium has the same results as locally in docker.
EDIT: Console logs contain follwoing error:
Failed to load resource: the server responded with a status of 400 ()