webapp icon indicating copy to clipboard operation
webapp copied to clipboard

Add more tests to Cypress 🌲

Open amaury1093 opened this issue 4 years ago • 4 comments

We use cypress to do e2e testing. We should add more tests.

Some ideas I have:

Components:

  • Search Bar
    • [x] #43 Type inside search bar shows results from Algolia
    • [x] #43 Click on a result takes to /city?lat=...&lng=...
  • Ranking
    • [x] #38 Click on city card goes to /city/{slug}
  • AdSection
    • [ ] Can scroll right
  • BlogSection
    • [ ] Can scroll
  • Footer
    • [x] #38 Correct link to FAQ

Home page:

  • [ ] Test "Use my location" button (might be hard)

City page:

  • [ ] Shows cigarettes after some time
  • [ ] Click on weekly shows cigs * 7
  • [ ] Click on monthly shows cigs * 30

Feel free to pick some tests, or add new ones you can think of!

amaury1093 avatar Oct 26 '20 19:10 amaury1093

I'd be interested in working on this!

devtayls avatar Nov 03 '21 18:11 devtayls

Sure! Feel free to take one (or more) tests and I can review your PRs.

amaury1093 avatar Nov 03 '21 19:11 amaury1093

I think I'm having issues with the build. I can load up the server and start the index, however when I try to route to another page I get the following:

Snag_aabf98f

Snag_aae5b4c

Error: getaddrinfo EAI_AGAIN gitlab.com at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26) { errno: -3001, code: 'EAI_AGAIN', syscall: 'getaddrinfo', hostname: 'gitlab.com', config: { url: 'https://gitlab.com/shootbot/cities/-/raw/master/all.json', method: 'get', headers: { Accept: 'application/json, text/plain, */*', 'User-Agent': 'axios/0.21.4' }, transformRequest: [ [Function: transformRequest] ], transformResponse: [ [Function: transformResponse] ], timeout: 0, adapter: [Function: httpAdapter], xsrfCookieName: 'XSRF-TOKEN', xsrfHeaderName: 'X-XSRF-TOKEN', maxContentLength: -1, maxBodyLength: -1, validateStatus: [Function: validateStatus], transitional: { silentJSONParsing: true, forcedJSONParsing: true, clarifyTimeoutError: false }, data: undefined }, request: <ref *1> Writable { _writableState: WritableState { objectMode: false, highWaterMark: 16384, finalCalled: false, needDrain: false, ending: false, ended: false, finished: false, destroyed: false, decodeStrings: true, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: true, bufferProcessing: false, onwrite: [Function: bound onwrite], writecb: null, writelen: 0, afterWriteTickInfo: null, buffered: [], bufferedIndex: 0, allBuffers: true, allNoop: true, pendingcb: 0, constructed: true, prefinished: false, errorEmitted: false, emitClose: true, autoDestroy: true, errored: null, closed: false, closeEmitted: false, [Symbol(kOnFinished)]: [] }, _events: [Object: null prototype] { response: [Function: handleResponse], error: [Function: handleRequestError] }, _eventsCount: 2, _maxListeners: undefined, _options: { maxRedirects: 21, maxBodyLength: 10485760, protocol: 'https:', path: '/shootbot/cities/-/raw/master/all.json', method: 'GET', headers: [Object], agent: undefined, agents: [Object], auth: undefined, hostname: 'gitlab.com', port: null, nativeProtocols: [Object], pathname: '/shootbot/cities/-/raw/master/all.json' }, _ended: true, _ending: true, _redirectCount: 0, _redirects: [], _requestBodyLength: 0, _requestBodyBuffers: [], _onNativeResponse: [Function (anonymous)], _currentRequest: ClientRequest { _events: [Object: null prototype], _eventsCount: 7, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: true, chunkedEncoding: false, shouldKeepAlive: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: false, sendDate: false, _removedConnection: false, _removedContLen: false, _removedTE: false, _contentLength: 0, _hasBody: true, _trailer: '', finished: true, _headerSent: true, _closed: false, socket: [TLSSocket], _header: 'GET /shootbot/cities/-/raw/master/all.json HTTP/1.1\r\n' + 'Accept: application/json, text/plain, */*\r\n' + 'User-Agent: axios/0.21.4\r\n' + 'Host: gitlab.com\r\n' + 'Connection: close\r\n' + '\r\n', _keepAliveTimeout: 0, _onPendingData: [Function: nop], agent: [Agent], socketPath: undefined, method: 'GET', maxHeaderSize: undefined, insecureHTTPParser: undefined, path: '/shootbot/cities/-/raw/master/all.json', _ended: false, res: null, aborted: false, timeoutCb: null, upgradeOrConnect: false, parser: null, maxHeadersCount: null, reusedSocket: false, host: 'gitlab.com', protocol: 'https:', _redirectable: [Circular *1], [Symbol(kCapture)]: false, [Symbol(kNeedDrain)]: false, [Symbol(corked)]: 0, [Symbol(kOutHeaders)]: [Object: null prototype] }, _currentUrl: 'https://gitlab.com/shootbot/cities/-/raw/master/all.json', [Symbol(kCapture)]: false }, response: undefined, isAxiosError: true, toJSON: [Function: toJSON] }

For the .env, I'm just using the defaults supplied in .env.example

devtayls avatar Nov 05 '21 16:11 devtayls

It seems like a DNS timeout. The only gitlab link we use is https://gitlab.com/shootbot/cities/-/raw/master/all.json. Can you access that link?

amaury1093 avatar Jan 20 '22 20:01 amaury1093