Cypress in Docker не удается загрузить первую страницу - PullRequest
0 голосов
/ 26 марта 2020

используя официальный кипарис / включено: 4.2.0 Docker изображение, я пытаюсь запустить свои тесты с Chrome (пытается также с Firefox):

describe('Login', function() {
  it('Enter valid login credentials', function() {
    cy.visit('/')
  })
})

Мой кипарис. json - это:

{
    "baseUrl": "https://myAngularApp.com",
    "blacklistHosts": [ "google-analytics.com", "amplitude.com"]
}

Когда baseUrl = https://google.com, все в порядке. Но с https://myAngularApp.com (очевидно, не реальный домен), он не может загрузить страницу. Это не проблема тайм-аута. Домен также хорошо разрешен (wget изнутри Docker контейнер в порядке).

Тот же тест отлично работает с cypress open на том же компьютере.

При добавлении журналов отладки я вижу странные домены (хотя я не знаю, как работает Cypress), вот пример, когда кажется, что он выходит из строя (посмотрите на странный домен в конце, как "http://sptzywbkfyswirq/"):

cypress:proxy:http:response-middleware received response { req: { method: 'GET', proxiedUrl: 'https://myAngularApp.com/runtime.5778a90e1b68b1f10bbd.js', headers: { host: 'myAngularApp.com', connection: 'keep-alive', 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36', 'sec-fetch-dest': 'script', accept: '*/*', 'sec-fetch-site': 'same-origin', 'sec-fetch-mode': 'no-cors', referer: 'https://myAngularApp.com/', 'accept-encoding': 'gzip', 'accept-language': 'en-US,en;q=0.9' } }, incomingRes: { headers: { 'accept-ranges': 'bytes', 'content-encoding': 'gzip', 'content-type': 'application/javascript', date: 'Thu, 26 Mar 2020 17:11:26 GMT', etag: '"5e7cc343-133a"', 'last-modified': 'Thu, 26 Mar 2020 14:59:15 GMT', server: 'nginx/1.17.9', vary: 'Accept-Encoding', 'transfer-encoding': 'chunked' }, statusCode: 200 } } +6ms                                                                                                                                                          
  cypress:proxy:http Running middleware { stage: 'IncomingResponse', middlewareName: 'PatchExpressSetHeader' } +1ms
  cypress:proxy:http Running middleware { stage: 'IncomingResponse', middlewareName: 'SetInjectionLevel' } +1ms
  cypress:proxy:http:response-middleware injection levels: { isInitial: false, wantsInjection: false, wantsSecurityRemoved: true } +1ms
  cypress:proxy:http Running middleware { stage: 'IncomingResponse', middlewareName: 'OmitProblematicHeaders' } +1ms
  cypress:proxy:http Running middleware { stage: 'IncomingResponse', middlewareName: 'MaybePreventCaching' } +0ms
  cypress:proxy:http Running middleware { stage: 'IncomingResponse', middlewareName: 'CopyCookiesFromIncomingRes' } +1ms
  cypress:proxy:http Running middleware { stage: 'IncomingResponse', middlewareName: 'MaybeSendRedirectToClient' } +0ms
  cypress:proxy:http Running middleware { stage: 'IncomingResponse', middlewareName: 'CopyResponseStatusCode' } +0ms
  cypress:proxy:http Running middleware { stage: 'IncomingResponse', middlewareName: 'ClearCyInitialCookie' } +1ms
  cypress:server:server Getting remote state: { auth: null, props: { port: '443', tld: 'com', domain: 'b2pweb' }, origin: 'https://myAngularApp.com', strategy: 'http', visiting: false, domainName: 'b2pweb.com', fileServer: null } +18ms
  cypress:proxy:http Running middleware { stage: 'IncomingResponse', middlewareName: 'MaybeEndWithEmptyBody' } +0ms
  cypress:proxy:http Running middleware { stage: 'IncomingResponse', middlewareName: 'MaybeGunzipBody' } +1ms
  cypress:proxy:http:response-middleware ungzipping response body +4ms
  cypress:proxy:http Running middleware { stage: 'IncomingResponse', middlewareName: 'MaybeInjectHtml' } +0ms
  cypress:proxy:http Running middleware { stage: 'IncomingResponse', middlewareName: 'MaybeRemoveSecurity' } +0ms
  cypress:proxy:http:response-middleware removing JS framebusting code +1ms
  cypress:proxy:http Running middleware { stage: 'IncomingResponse', middlewareName: 'GzipBody' } +1ms
  cypress:proxy:http:response-middleware regzipping response body +0ms
  cypress:proxy:http Running middleware { stage: 'IncomingResponse', middlewareName: 'SendResponseBodyToClient' } +1ms
  cypress:proxy:http Entering stage { stage: 'IncomingRequest' } +3s
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'LogRequest' } +0ms
  cypress:proxy:http:request-middleware proxying request { req: { method: 'HEAD', proxiedUrl: 'http://sptzywbkfyswirq/', headers: { host: 'sptzywbkfyswirq', 'proxy-connection': 'keep-alive', 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36', 'accept-encoding': 'gzip, deflate' } } } +3s                                                                                                                                                                              
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'RedirectToClientRouteIfUnloaded' } +1ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'RedirectToClientRouteIfNotProxied' } +1ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'EndRequestsToBlacklistedHosts' } +0ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'MaybeEndRequestWithBufferedResponse' } +1ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'StripUnsupportedAcceptEncoding' } +1ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'MaybeSetBasicAuthHeaders' } +0ms
  cypress:server:server Getting remote state: { auth: null, props: { port: '443', tld: 'com', domain: 'b2pweb' }, origin: 'https://myAngularApp.com', strategy: 'http', visiting: false, domainName: 'b2pweb.com', fileServer: null } +3s
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'SendRequestOutgoing' } +1ms
  cypress:server:server Getting remote state: { auth: null, props: { port: '443', tld: 'com', domain: 'b2pweb' }, origin: 'https://myAngularApp.com', strategy: 'http', visiting: false, domainName: 'b2pweb.com', fileServer: null } +1ms
  cypress:network:agent addRequest called { isHttps: false, href: 'http://sptzywbkfyswirq/' } +3s
  cypress:network:connect beginning getAddress { hostname: 'sptzywbkfyswirq', port: 80 } +3s
  cypress:server:stream_buffer stream buffer writeable final called +3s
  cypress:proxy:http Entering stage { stage: 'IncomingRequest' } +11ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'LogRequest' } +0ms
  cypress:proxy:http:request-middleware proxying request { req: { method: 'HEAD', proxiedUrl: 'http://aavdrqdu/', headers: { host: 'aavdrqdu', 'proxy-connection': 'keep-alive', 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36', 'accept-encoding': 'gzip, deflate' } } } +16ms                                                                                                                                                                                          
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'RedirectToClientRouteIfUnloaded' } +2ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'RedirectToClientRouteIfNotProxied' } +2ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'EndRequestsToBlacklistedHosts' } +1ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'MaybeEndRequestWithBufferedResponse' } +1ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'StripUnsupportedAcceptEncoding' } +1ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'MaybeSetBasicAuthHeaders' } +1ms
  cypress:server:server Getting remote state: { auth: null, props: { port: '443', tld: 'com', domain: 'b2pweb' }, origin: 'myAngularApp.com', strategy: 'http', visiting: false, domainName: 'b2pweb.com', fileServer: null } +18ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'SendRequestOutgoing' } +1ms
  cypress:server:server Getting remote state: { auth: null, props: { port: '443', tld: 'com', domain: 'b2pweb' }, origin: 'https://myAngularApp.com', strategy: 'http', visiting: false, domainName: 'b2pweb.com', fileServer: null } +1ms
  cypress:network:agent addRequest called { isHttps: false, href: 'http://aavdrqdu/' } +18ms
  cypress:network:connect beginning getAddress { hostname: 'aavdrqdu', port: 80 } +18ms
  cypress:server:stream_buffer stream buffer writeable final called +18ms
  cypress:proxy:http Entering stage { stage: 'IncomingRequest' } +10ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'LogRequest' } +1ms
  cypress:proxy:http:request-middleware proxying request { req: { method: 'HEAD', proxiedUrl: 'http://ifaulschhhr/', headers: { host: 'ifaulschhhr', 'proxy-connection': 'keep-alive', 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36', 'accept-encoding': 'gzip, deflate' } } } +19ms                                                                                                                                                                                    
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'RedirectToClientRouteIfUnloaded' } +1ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'RedirectToClientRouteIfNotProxied' } +0ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'EndRequestsToBlacklistedHosts' } +1ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'MaybeEndRequestWithBufferedResponse' } +1ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'StripUnsupportedAcceptEncoding' } +1ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'MaybeSetBasicAuthHeaders' } +1ms
  cypress:server:server Getting remote state: { auth: null, props: { port: '443', tld: 'com', domain: 'b2pweb' }, origin: 'https://myAngularApp.com', strategy: 'http', visiting: false, domainName: 'b2pweb.com', fileServer: null } +16ms
  cypress:proxy:http Running middleware { stage: 'IncomingRequest', middlewareName: 'SendRequestOutgoing' } +1ms
  cypress:server:server Getting remote state: { auth: null, props: { port: '443', tld: 'com', domain: 'b2pweb' }, origin: 'https://myAngularApp.com', strategy: 'http', visiting: false, domainName: 'b2pweb.com', fileServer: null } +1ms
  cypress:network:agent addRequest called { isHttps: false, href: 'http://ifaulschhhr/' } +16ms
  cypress:network:connect beginning getAddress { hostname: 'ifaulschhhr', port: 80 } +16ms
  cypress:server:stream_buffer stream buffer writeable final called +16ms
  cypress:network:connect error getting address {
  hostname: 'sptzywbkfyswirq',
  port: 80,
  err: OperationalError: getaddrinfo ENOTFOUND sptzywbkfyswirq
      at GetAddrInfoReqWrap.onlookupall [as oncomplete] (dns.js:72:26)
   {
    cause: Error: getaddrinfo ENOTFOUND sptzywbkfyswirq
        at GetAddrInfoReqWrap.onlookupall [as oncomplete] (dns.js:72:26)
     {
      errno: 'ENOTFOUND',
      code: 'ENOTFOUND',
      syscall: 'getaddrinfo',
      hostname: 'sptzywbkfyswirq'
    },
    isOperational: true,
    errno: 'ENOTFOUND',
    code: 'ENOTFOUND',
    syscall: 'getaddrinfo',
    hostname: 'sptzywbkfyswirq'
  }
} +80ms
  cypress:network:agent got family { family: undefined, href: 'http://sptzywbkfyswirq/' } +86ms
  cypress:network:connect error getting address {
  hostname: 'ifaulschhhr',
  port: 80,
  err: OperationalError: getaddrinfo ENOTFOUND ifaulschhhr
      at GetAddrInfoReqWrap.onlookupall [as oncomplete] (dns.js:72:26)
   {
    cause: Error: getaddrinfo ENOTFOUND ifaulschhhr
        at GetAddrInfoReqWrap.onlookupall [as oncomplete] (dns.js:72:26)
     {
      errno: 'ENOTFOUND',
      code: 'ENOTFOUND',
      syscall: 'getaddrinfo',
      hostname: 'ifaulschhhr'
    },
    isOperational: true,
    errno: 'ENOTFOUND',
    code: 'ENOTFOUND',
    syscall: 'getaddrinfo',
    hostname: 'ifaulschhhr'
  }

Есть ли здесь какие-нибудь хитрости в сети? Или Chrome параметры относительно SPA, такие как Angular?

...