QA Interview Hub · Knowledge base · Quizzes · Українська

QA Fundamentals

Web and client-server

HTTP, the browser, DevTools

What is client-server architecture?

The client shows the interface and builds requests, while the server stores data, applies the rules and responds. They talk over a protocol, most often HTTP, where every request carries everything it needs (token or cookie, parameters, body) because HTTP keeps no state between requests. Rules (format, permissions, limits) must live on the server, since a client can be bypassed and client-side validation only saves the user time.

QA Fundamentals · Web and client-server

The "Save" button does nothing. Is the bug in the browser, on the server or in between?

A user clicks "Save profile" and nothing happens. A ticket titled "Button does not work" goes to the front end. A day later it comes back: the request went out and the server answered with an error. The ticket moves to the back end, which shows that the request has a field with a different name. Two days are lost because nobody looked at the conversation between the client and the server. This lesson is about who is responsible for what in such a pair and how to find out in a few minutes on whose side the bug is.

How it works and why. The client (a browser, a mobile app) shows the interface and builds requests. The server stores data, applies rules and answers. Between them sits a protocol, most often HTTP: the client sends a request (method, URL, headers, body) and the server returns a response (status, headers, body). HTTP does not remember earlier requests, so every request carries all it needs: a session token or cookie, parameters, a body.

ClientServer
Shows the interface, holds temporary state (a form, a tab, a filter)Stores the data and is the source of truth
Checks input for convenience so a hint appears at onceChecks the same again, because the client cannot be trusted
Builds the request, parses the response, shows errorsChecks authentication and permissions, applies business rules

The double check is not pedantry but a consequence of the design. The client runs on the user's device, and the user can bypass any interface: send a request through curl or Postman, or change the page code. So the rules (format, permissions, limits) must live on the server, and client validation only saves a person's time. Two conclusions for QA follow: check the API separately from the UI, and do not treat "the form does not let me type it" as proof that the server will refuse it too.

Where things happen

Client: browser or appdisplay, state, convenience validationThe seam: HTTP request and responsemethod, URL, headers, body, statusApplication server (API)rules, permissions, calculationsDatabase and other servicesstored data, payments, email
Figure 1. A CDN, a load balancer or a proxy may stand between the client and the server, and other services behind the server. The seam is highlighted because most "mysterious" bugs live there: the client and the server understand the contract differently.

Example: from "the button does not work" to a localised bug. The ticket "The Save button does not work" does not say whose problem it is. We open DevTools, the Network tab, click the button and read the conversation:

PUT /api/profile HTTP/1.1
Content-Type: application/json

{"phoneNumber": "+380501234567"}

HTTP/1.1 400 Bad Request
Content-Type: application/json

{"error": "validation_failed", "field": "phone",
 "message": "required"}

The request went out (so the button "works"), the response came (the server is alive and says clearly what is wrong), and the field in the request is named differently from the contract. This is a client defect. The second defect is on the client too: the error is not shown. A report that can be handed to the right person at once:

Title: [Profile] "Save" returns 400: the client sends phoneNumber, the contract requires phone
Actual: PUT /api/profile → 400, field=phone; nothing changes on the screen
Expected: the field phone (API contract, the Profile section)
Localisation: the request is wrong, the server response is correct (client)
Separate bug: on a 400 the UI stays silent, but it must show the error

A simple table helps with quick localisation:

What you seeWhose side
No request in Network, a red error in ConsoleClient
A request exists, but the fields, format or headers do not match the contractClient
The request is right, the response is 5xx or the data is wrongServer or a service behind it
The response is right, but the screen shows something elseClient
502 or 504 from a gateway: the application behind it gave an invalid response (502) or none in time (504)Infrastructure or a slow server

Limits and alternatives. Two sides are usually not enough. CDNs, load balancers and gateways stand on the path and can return their own error or a stale copy from a cache. Behind the application server there is often a chain of microservices, so a 500 from "the back end" can be born in a neighbouring service: then the request ID and the time are useful in a report. There is also server-side rendering, where the server builds the HTML: a "visual" bug may then live on the server. A mobile app adds its own complexity: old app versions talk to a new server, and compatibility must be checked. In some protocols the server pushes messages over a connection the client opened (WebSocket, server-sent events): "request and response" come apart there, but the idea of the seam stays. Finally, if the contract is ambiguous, an argument about "whose fault" points to a requirements defect rather than a code defect, and it is settled together with developers and the analyst.

Common mistakes.

  • Pinning a bug on the front end at once because it is "visible on the screen": a symptom in the browser does not mean the cause is there.
  • Checking only through the UI: validation, permissions and limits that the client "does not let you break" may be accepted by the server, and the bug stays unnoticed.
  • Writing "does not work" without the request and the response: the developer has to walk the path QA already walked.
  • Treating every 4xx as a server defect: a client error often means the client sent something incorrect and the server answered correctly.
  • Forgetting that the response may come from a cache: you see an old copy and look for a bug that is already gone.

Check yourself

The server returns 200 and correct JSON with a list of three orders, but the screen is empty. Whose side is it, and what do you check next?

Answer

The client's: the response is right but something else is shown. Next I look at Console for errors, check how the client reads the response (for example, it expects an array in items but data came), the state of the filters and whether a repeated request overwrites the list.

The browser form does not allow fewer than five characters in a field. Why is that not enough to consider the field tested?

Answer

Because the check is on the client and can be bypassed: a request can be sent directly through Postman or curl. I need to send a short string to the API separately and make sure the server answers 400 or 422 and does not accept it.

A request returned 504 Gateway Timeout. Why is it not necessarily a front-end bug, and what do you add to the report?

Answer

504 says a gateway or proxy did not get an answer from the server behind it: the problem is a slow application or a service further down the chain. I add the URL, the method, the request time and the request ID (if it is in the headers) to find the entry in the logs.

In an interview. Junior: The client (a browser or an app) sends a request, the server processes it, works with the database and returns a response. For QA it matters that a bug can be on the client, on the server or at the seam, and DevTools helps tell them apart quickly. Middle/Senior: I read the conversation between the client and the server: if the request is right and the response is wrong, it is the server; if the response is right and something else is shown, it is the client; if the request does not match the contract, it is the client or an unagreed contract. I do not trust client validation, so I check the rules separately through the API. A CDN, a gateway and a cache can stand in between, and other services behind the server, so I leave the request, the response, the time and the request ID in the report to find the trace in the logs.

What are the main HTTP methods and status codes?

HTTP methods express the client's intent, and the status code sums up the result: 2xx success, 3xx redirection, 4xx client error, 5xx server error. GET reads, POST creates, PUT replaces a resource fully, PATCH changes part of it, DELETE removes it. Tests check the exact code (for example 201 with Location on creation), not just 2xx, and tell 401 (identity unknown) from 403 (no permission).

QA Fundamentals · Web and client-server

POST returned 200 instead of 201, and a repeated DELETE gave 404. Bugs or normal?

An automated test for creating an order checks "status 2xx" and is green. A month later another team connects a client to this API, and the client expects 201 and a Location header to open the page of the new resource. The client breaks, because the server returned 200 without Location. The test did not lie: it just checked too little. This lesson is about what methods and status codes say, why they were agreed this way and what exactly to check from them.

How it works and why. The HTTP specification (RFC 9110) describes a method as the client's intent together with guarantees. Safe: the method only reads and does not change the server state. Idempotent: N identical requests leave the server in the same state as one. Cacheable: the response may be stored in a cache. These are not academic terms. Browsers, proxies, load balancers and HTTP clients rely on them: a GET can be cached, prefetched and safely repeated after a connection drop, while a POST must not be retried automatically, because it might create two orders. Hence a practical rule: "delete through a GET link" is a real bug, because a search robot or a prefetch will follow the link and delete data.

MethodPurposeSafeIdempotentTypical success
GETGet a resourceyesyes200
POSTCreate a resource or run an actionnono201 + Location, or 200/202
PUTReplace a resource entirelynoyes200 or 204 (201 if created)
PATCHChange part of a resourcenonot guaranteed200 or 204
DELETEDelete a resourcenoyes204 (or 200)

A status code is a summary: the first digit sets the class, so a client that does not know a code still understands its meaning. 2xx means success: 200 OK, 201 Created (the resource was created), 204 No Content (success without a body). 3xx is redirection: 301, 302, 304 Not Modified (the cache is still valid). 4xx is an error on the request side: 400 Bad Request, 401, 403, 404, 409 Conflict (the state of the resource contradicts the request), 422 Unprocessable Content (the syntax is right, the content failed the rules), 429 Too Many Requests. 5xx is a server error: 500, 502 Bad Gateway, 503 Service Unavailable, 504 Gateway Timeout.

The two codes mixed up most often

401 Unauthorized

Who are you? The system does not know you

The token is missing, expired or forged. Fixed by logging in or refreshing the token. The response usually has a WWW-Authenticate header.

403 Forbidden

I know who you are, but I do not allow it

The user is authenticated, but the role or permissions are not enough. Logging in again changes nothing, another role or access is needed.

Figure 1. The name 401 is misleading: by meaning it is "not authenticated". If they are mixed up, the client tries to log in again where another role is needed.

Example: from "expect success" to a check that catches mistakes. We create an order and look at the response:

POST /api/orders HTTP/1.1
Authorization: Bearer <token>
Content-Type: application/json

{"sku": "A-100", "qty": 2}

HTTP/1.1 201 Created
Location: /api/orders/8412
Content-Type: application/json

{"id": 8412, "sku": "A-100", "qty": 2, "status": "new"}

A test "status 2xx" will pass both a 200 without Location and a 201 with a broken body. A more exact scenario uses the semantics of the methods:

Before: POST /api/orders → "a successful response"

After:
1. POST /api/orders → 201 Created, a Location header, an id in the body
2. GET by Location → 200, the data matches what was sent
3. The same POST again → a second resource is created or 409,
   as the contract says (POST is not idempotent)
4. DELETE /api/orders/8412 → 204; a repeated DELETE → 404
   (the state is the same: the order is gone; the responses may differ)
5. GET of the deleted one → 404
6. POST without a token → 401; someone else's resource → 403 (or 404 if hidden)

Item 4 often causes an argument. Idempotency is about the server state, not the response text: after the first DELETE the order is gone, after the second it is still gone, so the method is idempotent even though the second call returned 404. It is not a bug if the contract describes the behaviour this way. A bug begins where a repeated PUT or DELETE changes something: for example, the second DELETE removes the "next" order, or a PUT raises a version counter every time without changing the data.

Limits and alternatives. Real APIs deviate from the ideal, so the final judge is the contract of this particular API (Swagger/OpenAPI, documentation). Some APIs return 200 with an error in the body, which is convenient for novice clients and harmful for monitoring, because failures are not visible in the code statistics. GraphQL usually answers 200 and puts errors in an errors field. Teams draw the line between 400 and 422 differently, and whether to answer 403 or 404 for someone else's resource depends on whether its existence must be hidden. PATCH is idempotent only depending on the operation: "set status = paid" is safe to repeat, "add 10 to the balance" is not. To make a repeated POST safe (a network failure in the middle of a payment), an Idempotency-Key header is used: by the key the server recognises a repeat and does not run a second action. This is a common practice, but it is an agreement between the client and a particular API, not a part of basic HTTP.

Common mistakes.

  • Checking only "2xx" or only "not 500": the test misses 200 instead of 201, a missing Location and wrong error codes.
  • Assuming a 4xx is always a defect: 400, 404 or 409 for an incorrect request is correct behaviour that must be tested too.
  • Mixing up 401 and 403, and expecting 500 where the right answer is 400 or 422: a client error must not be shown by the server as its own failure.
  • Demanding an identical response from an idempotent method instead of an identical state.
  • Not checking side effects: after 204 on DELETE the resource must be gone, and after 201 on POST it must appear.

Check yourself

The first DELETE /orders/7 returned 204, the second 404. Is idempotency violated?

Answer

No. Idempotency is about the server state: after both calls order 7 is gone. A different response to a repeat is allowed and often intended. A violation would be if the repeat changed something: deleted another resource or changed counters.

A request without a token returned 403, and a request from a user without rights to an admin endpoint returned 401. What is wrong here?

Answer

The codes are swapped. Without a token the system does not know who it is, so 401 is expected. The user is known but has no rights, so 403 is expected. Consequence: in the second case the client will try to refresh the token and will not understand why it does not help.

Why is PATCH not guaranteed to be idempotent while PUT is?

Answer

PUT replaces the resource with a full new version, so a repeat gives the same result. PATCH describes a change: "set the field" is safe to repeat, while "increase the field by 10" or "add an item to an array" changes the state every time. So for PATCH idempotency is checked per operation.

In an interview. Junior: GET gets, POST creates, PUT replaces entirely, PATCH changes partially, DELETE deletes. Codes: 2xx success, 3xx redirection, 4xx client error, 5xx server error. The difference between 401 and 403: in the first case the system does not know who you are, in the second it knows, but you have no rights. Middle/Senior: I tie checks to semantics: GET is safe and does not change state, PUT and DELETE are idempotent by state, POST is not, so I test a repeated POST separately (a duplicate or 409, Idempotency-Key). For POST I expect 201 and Location, for validation errors 400 or 422 by the contract, not 500. I judge idempotency by the server state, not by the response text, and I tell 502 and 504 (a gateway) from 500 (the application), because it decides where to look for the cause.

How do cookies, localStorage and sessionStorage differ?

Cookies are sent to the server with every request, while localStorage and sessionStorage stay in the browser. Lifetimes differ: localStorage lives until cleared, sessionStorage only while the tab is open. Cookies have attributes (HttpOnly, Secure, SameSite). After logout the check covers not only the cookie disappearing but also that the old cookie gets a 401.

QA Fundamentals · Web and client-server

A user logged out, and after a page refresh they are "logged in" again. Where is that stored?

QA tests logging out: clicks "Log out", sees the sign-in page and moves on. A week later a complaint reaches support: on a shared computer the next person opened the site and saw someone else's account. It turns out that the "Log out" button only cleared the state in the interface, while the session cookie stayed and kept working. This lesson is about the three places where a browser stores data, how they differ, and how to build a check from that which catches such mistakes.

How it works and why. Cookies were invented so that a server could remember a user: HTTP remembers nothing itself, so the server hands the client a cookie (the Set-Cookie header), and the browser adds it to every next request to that site (the Cookie header). Hence the automatic sending and the limited size. Web Storage (localStorage and sessionStorage) appeared later for data needed only by client code: settings, drafts, a cache. It is not sent over the network, so it costs no traffic and has a bigger capacity. Both storages work only through JavaScript and are bound to an origin (scheme, host and port).

What goes to the server and what stays in the browser

Browser, one origincookiessent with every requestlocalStorageJS only, until removedsessionStorageJS only, one tabServer
Figure 1. Only cookies travel with a request automatically, so only they are seen by the server without the help of page scripts.
CookieslocalStoragesessionStorage
Sent to the serverYes, with every requestNoNo
LifetimeUntil Expires or Max-Age; without them until the browser session endsUntil removedWhile the tab is open
Capacityabout 4 KB per cookieabout 5 MB per originabout 5 MB per origin
Shared between tabsYesYesNo, each tab has its own
Access from a scriptYes, unless HttpOnlyYesYes

A cookie has attributes that control its behaviour. HttpOnly hides it from JavaScript. Secure allows sending only over HTTPS. SameSite restricts sending in cross-site requests. Max-Age or Expires set the lifetime, Domain and Path set which addresses it belongs to. The capacities in the table are approximate: exact limits depend on the browser.

Example: a logout test that catches a "left-over" session. A weak check: click "Log out", see the sign-in page. It checks only the interface. A full check asks what changed in each storage and whether the server really stops letting the user in. For that, in the logout response the server must cancel the cookie, and the old value must stop working:

HTTP/1.1 200 OK
Set-Cookie: sid=; Max-Age=0; Path=/; Secure; HttpOnly

GET /api/me HTTP/1.1
Cookie: sid=old-session-value

HTTP/1.1 401 Unauthorized

The first line tells the browser to delete the cookie (Max-Age=0), and the second block shows the main point: even if somebody copied the cookie value earlier and sent it by hand, the server answers 401. Deleting the cookie without cancelling the session on the server is half of the job. These observations then form a table of expectations:

ActionWhat we expect
Log outThe session cookie is deleted, tokens and user data are removed from the storages, a request with the old cookie gives 401
Open the site in a new tabcookies and localStorage are shared, sessionStorage is empty
Close the tab and open it againsessionStorage is empty; whether a session cookie stays depends on the browser and on tab restore settings
Incognito modeNothing from the normal window is visible, after the window closes everything disappears
Delete the cookie by hand in DevToolsThe next request to a protected section leads to sign-in and does not crash with an error

All of this is visible in DevTools on the Application tab: cookies with their flags, localStorage and sessionStorage with keys and values. They can be edited and deleted by hand there, which is handy for negative scenarios: an expired cookie, broken JSON in localStorage.

Limits and alternatives. Web Storage is synchronous and stores only strings: objects must be serialised through JSON, and an unexpected format under a key (an old app version wrote another format) can break the new version after an update. A browser may clear storage when space runs short or by a privacy policy: for example, Safari limits the lifetime of data written by script. For big or structured data there is IndexedDB, for offline resources the Cache API. Data in localStorage and in cookies without HttpOnly is available to any page script, so an XSS vulnerability lets it be stolen; why session tokens are better kept in an HttpOnly cookie is covered by a separate lesson about storage security.

Common mistakes.

  • Checking logout only by the look of the page: the session on the server may stay valid.
  • Assuming cookies, localStorage and sessionStorage "remember" the user alike: each has its own rules of life and visibility.
  • Not trying a new tab and incognito: bugs with a "left-over" or "lost" state show up exactly there.
  • Storing sensitive data in localStorage and treating it as normal for a test: a security check is also a part of QA's job.
  • Forgetting about size: long values in a cookie enlarge every request and can cause a server or proxy error.

Check yourself

After "Log out" the sign-in page appears, but in DevTools on the Application tab the sid cookie is still there. What can it mean and what do you check?

Answer

Maybe the client only changed the interface. I send a request to a protected endpoint with the old cookie: if it is 200, the session on the server is alive, which is a serious security defect. I also check the logout response: whether it has Set-Cookie with Max-Age=0.

A user filled in a draft in one tab and opened the site in a second one. The draft is empty there. Which kind of storage was most likely used?

Answer

sessionStorage: it is separate for each tab. If the draft must live between tabs, localStorage or saving on the server is needed, and that is a question for the requirements.

Why do large values in a cookie do harm, and in localStorage they do not?

Answer

A cookie is added automatically to every request to the site, so a large cookie bloats all the traffic and can exceed the header limit of a proxy or server. localStorage does not go to the network, its size affects only the browser memory.

In an interview. Junior: Cookies are sent to the server with every request and hold a few kilobytes. localStorage lives in the browser until it is cleared, and sessionStorage only while the tab is open. All of it is visible in DevTools on the Application tab. Middle/Senior: Cookies are for the server, Web Storage for client code: that difference decides what to check. For a session cookie I look at the HttpOnly, Secure and SameSite flags and at the lifetime, and after logout I check not only that the cookie disappears but also that an old request with it gives 401. Separately I check a new tab, incognito and manual deletion of values, because that is where a "left-over" and a "lost" state become visible.

How do you use DevTools in testing?

Each DevTools panel answers one question: Network what went out and came back, Console what broke, Elements what is in the DOM, Application what is stored. Preserve log and Disable cache keep requests from being lost or confused with cache, and Copy as cURL replays a request outside the browser. Chrome's default HAR export drops cookies and Authorization, but tokens in URLs and bodies remain, so the file is checked before attaching.

QA Fundamentals · Web and client-server

A user says the page is "glitching". What exactly do you look at in DevTools in five minutes?

A complaint "the orders list is empty" with no details. You can guess for an hour, or open DevTools, repeat the action and see what the browser actually did: did a request go out, what did the server answer, are there errors in the console, is the element in place. This lesson is about which panel answers which question, in what order to open them, and how to turn what you see into a report that a developer reproduces without clarifications.

How it works and why. DevTools works inside the browser, and the browser is the place where all layers of an application meet: the network, HTML and styles, JavaScript, storages. So one panel sees what no other will: Network sees every request and response, Elements sees the live DOM after scripts have run, Application sees the storages. Each panel answers one question, and that is more useful than "knowing all the buttons". An approximate order when something is wrong:

Inspection order

1. Consoleare there red errors and warnings2. Networkwhich request went out, the answer, the time3. Elementsis the element in the DOM, what styles it has4. Applicationcookies, localStorage, sessionStorage
Figure 1. Console is cheap and fast, so it goes first: the cause is often already written there. The order is a heuristic, not a rule.
PanelQuestionExample
NetworkWhat went out and what came back?Method, URL, parameters, status, body, headers, duration; the Fetch/XHR filter
ConsoleWhat broke in the scripts?Unhandled exceptions, CORS errors, mixed content warnings
ElementsWhat is in the DOM now and which styles apply?Whether the field is really disabled, why text sticks out of a block
ApplicationWhat is stored in the browser?Cookies with flags, localStorage, sessionStorage
Device toolbarHow does it look on another screen?Size, pixel density, touch, orientation
ThrottlingHow does it behave on a bad network?Slow network and offline: a spinner, timeouts, an error message

Network has several settings that save hours. Preserve log keeps the list of requests after a navigation or redirect, otherwise they vanish just when they are needed. Disable cache (works while DevTools is open) tells a "bug" from "an old copy in the cache". The context menu of a request has Copy as cURL, which turns the request into a command to repeat outside the browser, and Block request to simulate a failure of one resource. The Timing tab splits the time of a request into waiting, DNS, connecting and receiving, and the Initiator column shows which code started the request.

Example: from "the list is empty" to a report with evidence. The initial complaint and the same bug after inspection:

Before: "The orders list is empty. Chrome."

After:
Network: GET /api/orders?status=open → 500, 1.8 s
Response: {"error":"internal","requestId":"c41f-9a"}
Console: no errors, only the client message "Failed to load orders"
The request without the status parameter → 200, 12 orders
Evidence: HAR (tokens removed), a Network screenshot, requestId for the logs

Now we can see that the client asked for the list, the server failed and the client showed only a generic message. To finally separate the server from the interface, we repeat the request without the browser: Copy as cURL (the token in the example is replaced with a placeholder) and run it in a terminal or in Postman.

curl 'https://staging.example.com/api/orders?status=open' \
  -H 'Authorization: Bearer <token>' \
  -H 'Accept: application/json'

If curl also returns 500, the cause is on the server and the interface just informs poorly about the error. If with other parameters the answer is 200, we narrow the condition: the problem is in the value status=open. The report turned out meaningful because it holds the request, the response, the time and a requestId for searching the server logs.

Limits and alternatives. DevTools shows only the client's view. It will not show what happens on the server, only what the server answered. Throttling imitates the speed and latency of a network, but not a real radio network, the CPU and the battery of a phone, so mobile risks need a real device. Screen emulation (Device toolbar) changes size, density and touch events, but the engine stays the same, so it will not show Safari problems. Browser extensions (ad blockers, password managers) can distort the picture: a doubtful bug is worth repeating in a clean profile or in incognito. A CORS error is visible in Console even though the server may have answered correctly: the browser forbids the page to read the response. For mobile apps and traffic outside a browser, proxies are used (Charles, Fiddler, mitmproxy). For repeatable diagnostics in automated tests there are traces, for example Playwright Trace Viewer.

A separate word about HAR. It is a file with a record of all requests, and that is exactly why it is dangerous: it may contain tokens, cookies, passwords in a request body and personal data. Newer versions of Chrome hide sensitive fields on export by default, but before attaching it to a ticket, especially a public one, check the file yourself and remove what is not needed.

Common mistakes.

  • Opening DevTools after the action: the request has already passed and is not recorded. Open the panel, turn on Preserve log and repeat.
  • Looking only at the status and not reading the response body: it often has the cause or an ID for the logs.
  • Concluding that nothing happened because Console is empty: the error may be a network one, visible only in Network.
  • Attaching to a ticket a HAR or a screenshot with a token and other people's data.
  • Drawing conclusions from device emulation without a real device where the risk is hardware (camera, keyboard, radio).

Check yourself

In Network the request to /api/orders is red and the Status column says (failed), not 500. How does it differ from 500 and where do you look?

Answer

Code 500 means the server answered with an error. Status failed means no response was received at all: a network drop, blocking or DNS. Chrome shows a CORS ban with its own status, CORS error. I look at Console (a blocked or net::ERR_… message) and at the request details: where exactly it was going.

Why does Slow 4G in DevTools not replace a check on a real phone?

Answer

Throttling imitates only the speed and latency of the network in a desktop browser. A real phone has a weaker CPU, another radio, a battery, a virtual keyboard and, in Safari, another engine. For risks tied to these, emulation is not enough.

Why must a HAR not be added to a public ticket without checking?

Answer

A HAR contains all the traffic, and it may have authorisation tokens, session cookies, password values and personal data. Whoever sees the ticket can use the token or read the data. Before adding it the file is checked and the sensitive parts are removed.

In an interview. Junior: In Network I look at requests, statuses and response bodies and save a HAR for a bug report. In Console I look at JS errors, in Elements at the DOM and styles, in Application at cookies and storages, and the device toolbar and throttling help check different screens and a slow network. Middle/Senior: I open panels by question: Console is there an error, Network what went out and what came back, Elements what is in the DOM, Application what is stored. I turn on Preserve log and Disable cache so as not to miss a request or catch a cache, repeat the request through Copy as cURL to separate the server from the interface, and attach the request, the response and a requestId. Before sending I clean the HAR of tokens, and I check mobile and hardware risks on a real device, because emulation does not show them.

How do you approach cross-browser and responsive testing?

Cross-browser testing is built as a matrix driven by risk and user analytics, not as everything everywhere. Configurations are tiered: the most common get a full run, the rest only critical scenarios, and the matrix is updated from new data and bugs. The checks cover layout at breakpoints, forms, formats and touch. DevTools emulation stays on Chromium, so Safari and the on-screen keyboard are checked on real devices or in the cloud.

QA Fundamentals · Web and client-server

The feature works in Chrome, but on an iPhone the button cannot be tapped. Where do you start the test matrix?

The release went out, everything was checked in Chrome on a laptop. An hour later support writes: on an iPhone the "Date of birth" field does not open and the "Pay" button is covered by the keyboard. Checking "everything everywhere" is impossible: there are hundreds of combinations of browsers, versions, operating systems and screen sizes. This lesson is about why browsers behave differently, how to build from hundreds of combinations a matrix that can actually be run, and what to check in it.

How it works and why. The difference comes from three causes. First, engines: Chrome and Edge run on Blink, Safari on WebKit, Firefox on Gecko, and each implements web standards at its own pace and with its own quirks. On iOS most browsers also run on WebKit, so "Chrome on iPhone" often behaves like Safari. Second, devices: screen size and density, touch instead of a mouse, a virtual keyboard, performance. Third, operating systems: font rendering, native widgets (a date or file picker), system language and zoom settings. Responsiveness is a separate dimension: the layout changes at breakpoints (by window width), and the page must stay usable at every size.

Since everything cannot be covered, the matrix is built by risk and data. The source of truth here is the analytics of real users and the requirements: which support is promised officially (often it is a list in the documentation or in the build settings). Configurations are in essence equivalence classes: if two browsers on one engine and a similar screen behave the same, one representative is enough.

Coverage levels

Level 1: a full passthe main browsers and devices by analyticsLevel 2: critical scenariossign-in, search, payment, key formsLevel 3: on demandrare configurations, after bugs from them
Figure 1. The lower the level, the less effort. A configuration lands on a level by the share of users and the cost of a mistake, not by what is more convenient for the tester.

Example: from "test everything" to a matrix. The initial decision "Chrome, Firefox, Safari, Edge and ten devices" says nothing about what to check and how deeply. After analysing analytics a matrix with levels appears (the numbers are illustrative):

Configuration           Share*  Level   What we check
Chrome, Windows          42%    1       a full pass
Safari, iPhone (2 sizes) 25%    1       a full pass, keyboard
Chrome, Android         18%     2       critical scenarios
Edge, Windows             8%    2       critical scenarios
Firefox, Windows          5%    3       on demand
* illustrative numbers from analytics, for the example

Now it is clear why iPhone gets a full pass (a quarter of users) and Firefox stays on level 3. The matrix is not frozen: if after a release bugs appeared in Firefox or its share grew, the configuration is raised to a higher level. What is checked on each configuration:

  • The layout at breakpoints: whether text sticks out, whether elements overlap, whether menus and buttons are reachable.
  • Forms: date and file pickers, autofill, the keyboard type for a field (number, email), whether the keyboard covers the button.
  • Formats: date, number, currency and time zone by the browser's language and region.
  • Touch: whether elements that depend on hover work, whether the targets are big enough to tap.
  • Screen orientation, zoom and scrolling.
  • Performance on a weak device and a slow network.

Limits and alternatives. Emulation in DevTools changes the screen size, the user agent, touch and network speed, but the engine stays Chromium. So it catches layout problems at different widths, but will not show Safari bugs or a real virtual keyboard: those need real devices or cloud farms (BrowserStack and similar). Automated tests allow running one scenario on several engines: in Playwright these are the Chromium, Firefox and WebKit projects. The WebKit build is close to Safari but not identical, so for a critical risk a check on a real iPhone remains. Visual regression tests catch a layout shift between builds, but do not replace a human look at a new design. Finally, the matrix depends on the product: for a bank's internal application the browser requirements are set by the company's IT policy, and the matrix may consist of two items.

Common mistakes.

  • Building a matrix "from the head": it reflects the habits of the team, not of the users.
  • Testing at resized windows of desktop Chrome and calling it "mobile testing".
  • Chasing every browser version: current ones and those that analytics shows in real use are enough.
  • Checking only screen width and forgetting the keyboard, touch, orientation and formats.
  • Not updating the matrix after a release, when new data about users and bugs has appeared.

Check yourself

Analytics shows: 60% of users on Chrome, 30% on Safari (iPhone), 5% on Firefox. How do you distribute the effort and why?

Answer

Chrome and Safari on iPhone go to level 1: a full pass, because they are the majority of users and different engines. Firefox goes to level 2 or 3: critical scenarios or on demand. A separate question is whether Firefox is more critical for the particular product (for example, a corporate requirement): that must be decided by the requirement, not only by the percentage.

Why is iPhone emulation in DevTools not enough to check the keyboard and the date picker?

Answer

Emulation changes the screen size and touch, but it runs on Chromium. The virtual keyboard, the native date picker and the behaviour of WebKit on iOS are absent from it. This is checked on a real device or in a cloud farm.

What would make you raise Firefox from level 3 to a higher one?

Answer

Growth of its share in analytics, repeated bugs exactly in Firefox, a customer requirement or a new feature that relies on capabilities implemented differently there. The matrix is updated by data and does not stay forever.

In an interview. Junior: I build a matrix of browsers and devices from analytics, not everything at random. The most popular configurations I test fully, the rest only critical scenarios. I check the layout at breakpoints, forms, date and number formats, and part of it on real devices, because emulation does not show everything. Middle/Senior: A matrix is equivalence classes by risk: the engine (Blink, WebKit, Gecko), the device class and screen size, and the weight is set by the share of users and the support requirements. Level one gets a full pass, level two critical scenarios, level three I touch on demand and raise it by new data or bugs. I treat DevTools emulation as a quick layout filter, and I check Safari, the keyboard and touch on real devices or in the cloud, and where possible I run automated tests on three engines.

What happens when you enter a URL

The browser finds the IP through DNS, opens a connection (plus a TLS handshake for HTTPS), sends the HTTP request, gets the response and builds the page. Each stage fails differently: a DNS error, a refused or timed-out connection, a certificate error, 502 or 504 from a gateway, a blank page with 200. The Timing tab shows the breakdown: long waiting points to the server, long DNS or connect to the network.

QA Fundamentals · Web and client-server

You typed an address and pressed Enter. What happened before the page appeared and at which step could it break?

A user writes: "The site does not open". For QA this is a template for dozens of different faults: the domain does not resolve, the server does not listen on the port, the certificate is expired, a gateway did not wait for the application, a script crashed while the page was being built. Each lives at its own step of the path from the typed address to the finished page, and the browser usually says which. This lesson splits the path into stages, explains why they are separate and teaches how to find the stage by a symptom.

How it works and why. The internet is built in layers, and each solves one task. DNS looks up an IP address by name: the browser asks its own cache, the OS cache, then the provider's resolver, which if needed queries the root, TLD and authoritative servers. Next a connection is needed: TCP sets it up in three steps (SYN, SYN-ACK, ACK), and HTTP/3 uses QUIC over UDP with built-in TLS instead of TCP. For HTTPS a TLS handshake follows: the server sends a certificate, the browser checks that it was issued by a trusted authority, is valid and matches the domain, and the sides agree on keys. Only then does the browser send an HTTP request with a method, headers and cookies. On the way it may pass through a CDN, a load balancer and a reverse proxy before reaching the application server. The server turns to a database or other services and returns a response. Finally the browser builds the page.

The path from an address to a page

1. DNSdomain name → IP address2. TCP (or QUIC for HTTP/3)a connection to the server3. TLS (for HTTPS)certificate, encryption keys4. HTTP requestthrough a CDN, a balancer, a proxy5. Server responsestatus, headers, HTML6. The browser builds the pageDOM, CSS, JS, painting
Figure 1. Each step can break in its own way and with its own symptom. The last one is highlighted: the server has already answered and the problem is in building the page.

Splitting into layers is not a formality. Thanks to it the certificate is checked before a single byte of a request with a password goes out, DNS can be changed without touching the application, and a CDN or a balancer can be put in front of the server without the client or the server noticing. The practical conclusion for QA: once the stage of the failure is found, the circle of suspects shrinks from "everything" to one layer. Splitting by stage in the browser: in Network the Timing tab shows how much time each took:

The Timing tab (illustrative values for the example)
Queueing                         2 ms
DNS Lookup                      28 ms
Initial connection              35 ms
SSL                             41 ms
Waiting for server response    612 ms   ← waiting for the server
Content Download                14 ms

Building the page has steps too. The browser reads the HTML and builds the DOM, at the same time loading CSS (from which the CSSOM is built) and scripts. Having combined the DOM and the styles, it computes the position of elements (layout), draws them (paint) and assembles the layers into a picture (composite). A script without defer or async stops HTML parsing, and CSS blocks showing the page until it loads. That is why a heavy script in the head of the page gives a "white screen" even though the server answered quickly. In modern SPAs the first response often holds an almost empty HTML, and the data arrives by additional API requests after JavaScript has run.

Example: from "the site does not open" to a stage. We start with what the browser showed:

What we seeStageWhat to check
ERR_NAME_NOT_RESOLVEDDNSThe domain is correct, the DNS record (nslookup or dig), whether DNS was changed recently
ERR_CONNECTION_REFUSED or ERR_CONNECTION_TIMED_OUTTCPWhether the server listens on the port, whether a firewall blocks it, whether the node is down
NET::ERR_CERT_DATE_INVALID or ERR_CERT_COMMON_NAME_INVALIDTLSCertificate validity period, match with the domain, the full chain
502 or 504Gateway or proxyWhether the application behind the gateway answers and has enough time
200 and a white pageBuilding the pageConsole for errors, Network for requests that failed to load

If the stage of the error is visible at once, the report is concrete. If the complaint is "slow", we look at Timing: in the example above DNS, connection and TLS take tens of milliseconds, while waiting for the server response takes 612 ms. So it is exactly the processing on the server (or in the services behind it) that is slow, not the network, and the ticket goes to the back end with this evidence. If it were the other way round (DNS in hundreds of milliseconds, waiting small), the question would go to the network or the DNS settings.

Limits and alternatives. The scheme is simplified. Repeated requests are cheaper: DNS and the connection come from a cache, and the HTTP cache may answer without going to the network at all (so tests are run with the cache disabled and on a "cold" start). Connections are often reused (keep-alive), so stages 1-3 happen only for the first request. HTTP/2 and HTTP/3 send several requests in parallel over one connection. A redirect from HTTP to HTTPS or to another domain adds one more round. A Service Worker can answer by itself without going to the network. VPNs, corporate proxies and DNS filters add their own failures that "do not reproduce" for the developer. In an interview the depth depends on the level: for a junior it is enough to name DNS, a connection, an HTTP request, a response and rendering, while from a senior an explanation of what happens at each stage and what breaks there is expected.

Common mistakes.

  • Calling everything that did not open a "site bug": a DNS or certificate error is an infrastructure problem, not an application one, and the ticket must go to another addressee.
  • Looking for an HTTP status where it cannot exist: when the certificate check fails or the connection is refused, the request does not reach the server at all.
  • Testing only with a warm cache: new users go the full path with everything downloaded.
  • Confusing a "slow server" with a "slow network" without looking at the time breakdown.
  • Forgetting about blocking resources: a "fast back end" does not guarantee a fast display of the page.

Check yourself

The browser shows ERR_CONNECTION_TIMED_OUT, and nslookup returns an IP address of the domain. Which stage is already fine and where do you look?

Answer

DNS is fine: the name turns into an address. The problem is at the connection step (TCP): the node does not answer, the port is closed or a firewall drops the packets. I check the availability of the host and the port, whether the server is running and whether network rules were changed.

In Timing DNS is 25 ms, connection 30 ms, TLS 40 ms and waiting for the response 700 ms. Whom do you address the "slow" complaint to?

Answer

The back end: the network stages are fast and 700 ms went to waiting for the response, that is, to processing on the server or in the services behind it. In the ticket I give the breakdown and the request.

Why, with an expired certificate, will you not see the site's response status code in DevTools?

Answer

The TLS handshake happens before the HTTP request. The browser stops the connection at the certificate check and shows a warning page, so there is no request to the application and no response with a status either.

In an interview. Junior: The browser parses the URL and finds the IP address through DNS, sets up a connection (for HTTPS also a TLS handshake), sends an HTTP request, gets a response and builds the page from HTML, CSS and JS. Middle/Senior: I tie symptoms to stages: ERR_NAME_NOT_RESOLVED is DNS, a refused or timed-out connection is TCP, a certificate error is TLS, 502 or 504 is a gateway, and a white page with 200 is building the page. I take the time breakdown from Timing: a long wait for the response points to the server, long DNS or connection to the network. I remember that caches, keep-alive, CDNs and Service Workers shorten the path, so I test a "cold" and a "warm" request separately.

A front-end or back-end bug through DevTools

Four questions tell a front-end bug from a back-end one: was the request sent, is it per contract, is the response per contract, does the screen show it. The first no shows where the bug is. Network shows the request and response, the server is isolated by replaying via Copy as cURL or Postman, the UI by overriding the response. The judge is the contract, not anyone's confidence.

QA Fundamentals · Web and client-server

The data on the screen is wrong. Is the error in the request, in the server response or in how the page showed it?

The product card says "UAH 1,999.00", but it should be 19.99. The ticket flies to the developers: the front end says it shows what the server gave, the back end says it returns the right thing and the front end formats wrongly. QA is left between two claims that nobody checked. This lesson is about a sequence of four questions that answers in a few minutes whose bug it is, and about why the judge is always the contract and not somebody's confidence.

How it works and why. Between a user's action and what they see there are four points, and each can be checked separately: the request went out, the request is right, the response is right, the screen shows what is in the response. The first "no" in this chain shows where the bug is. The principle is simple: we check from the start of the flow to the end and do not guess. Why in this order? Because each next step makes sense only if the previous one passed: there is nothing to compare with the response if there was no request.

Four questions

1. Did the request go out at all?no → client (Console, event handler)2. Is the request per the contract?no → client (fields, format, headers)3. Is the response per the contract?no → server (code, data, error)4. Does the screen show the response?no → client (parsing, state, display)
Figure 1. The last check is highlighted because it is skipped most often: the response is right, and the error is blamed on the server.

Tools for each question: in Network we find the request by the action (the Fetch/XHR filter), in the Headers and Payload tabs we read what was sent, in Response or Preview we read the answer. If there is no request, we look at Console for script errors. To separate the server from the browser, we reproduce the request through Copy as cURL or in Postman. To separate the interface from the server, in Chrome the response can be replaced (Local overrides or Override content in Network) to see how the page handles a different response.

What counts as "right" in questions 2 and 3 is decided by the contract: the API specification (Swagger/OpenAPI), the documentation or the requirements. Without it the argument "who is wrong" has no solution, because both sides see only their own logic.

Example: two cases with the same symptom and different culprits. The first: a wrong price. We look at the response to the product request:

GET /api/products/42 HTTP/1.1

HTTP/1.1 200 OK
Content-Type: application/json

{"id": 42, "name": "Headphones", "price": 1999, "currency": "UAH"}

The request is right, the response is 200 and structurally valid. Question 3 is decided by the contract. If the specification gives the price in minor units (cents), the response is right and the interface had to divide by 100: a client bug (question 4). If the specification says "the price is in hryvnias", then 1999 is a server defect (question 3). The same screenshot and the same JSON, but the culprit depends on a document. The second case: a transfer with an amount of three decimal places.

POST /api/transfers HTTP/1.1
Content-Type: application/json

{"from": "acc-1", "to": "acc-2", "amount": "100.555"}

HTTP/1.1 422 Unprocessable Content
Content-Type: application/json

{"code": "too_many_decimals", "field": "amount"}

Here the server response is right: 422 with a reason code. So question 3 is "yes". But the interface shows "Something went wrong" and does not point to the field, or the form itself did not stop an input with three decimals. These are client bugs, one about displaying the error, the other about missing client validation. A report to the server would be wrong: it works per the contract. At the same time checking that the server rejects such input is useful too, and it is a separate positive result worth recording.

Limits and alternatives. Reality does not always fit "client or server". The error may be on both sides or in the contract itself (it was written ambiguously): then the report goes to the analyst or to both teams with a request to resolve the discrepancy. A response in cURL may differ from the response in the browser: because of other headers, authorisation, cookies or a cache, so the discrepancy itself becomes a hint. Some bugs depend on order: two requests came back in reverse order, and an older response overwrote a newer one. This is visible by time in Network, and the cause is on the client even though both responses are right. If the page is built by the server (server-side rendering), a "visual" bug may be a server one. Statuses help but do not decide: 5xx is most often the server, and a 4xx must be considered by the contract, because the client could have sent something incorrect. Also tell a 500 from your application from a 502 or 504 from a gateway.

Common mistakes.

  • Starting from the assumption "it is the front end" or "it is the back end" and looking only for confirmation.
  • Looking only at the status and not opening the request and response bodies.
  • Not having the contract at hand: then the argument turns into "it works for me".
  • Ignoring the time and the order of requests: races between responses are not visible in a static snapshot.
  • Not adding the request and the response to the report: the developer walks this path again.

Check yourself

The request is right, the response is 200 with correct data, but the screen shows old information. Which of the four questions gave "no" and what do you check?

Answer

The fourth: the screen does not show what is in the response. I check Console, whether a handler crashes, whether the state updates correctly, whether a cached copy is shown, and whether an older response overwrote a newer one by time in Network.

The API returns price: 1999 and the interface shows "UAH 1,999.00". How do you decide whose bug it is?

Answer

By the contract. If the specification says the price is in minor units, it is a client bug: it must divide by 100. If the price is in hryvnias, it is a server bug. Without the document it cannot be decided, so for the first question I demand or find the specification.

Why is it useful to reproduce the request through cURL or Postman when the bug is in the UI?

Answer

It separates the server from the browser and the interface. If cURL gives the right response and the UI shows something wrong, the cause is on the client or in a difference of request conditions (headers, token). If cURL gives the same wrong response, the bug is on the server.

In an interview. Junior: I open the Network tab, find the request and look at the request and the response. If the request is wrong, it is the front end. If the request is right and the response is wrong or an error, it is the back end. If the response is right and something else is shown, it is the front end. Middle/Senior: I go through four questions: did the request go out, is it per the contract, is the response per the contract, does the screen show the response. I take the specification as the judge, because without it the argument has no solution (a price of 1999 can be right if it is in cents). I separate the server by repeating the request through cURL or Postman, and the interface by replacing the response. Sometimes the cause is on both sides or in the contract itself, then I go to the analyst. In the report I add the request, the response, the time and a requestId.

Cookies vs localStorage vs sessionStorage

Cookies go to the server automatically, so they face CSRF, while any script on the page can read localStorage and sessionStorage, so XSS steals from them. HttpOnly stops scripts reading a cookie, Secure limits it to HTTPS, SameSite restricts cross-site requests. But HttpOnly does not remove XSS: a script can still send requests as the user. QA checks cookie attributes and that cross-site requests are rejected.

QA Fundamentals · Web and client-server

The session token sits in localStorage. Is it a bug or a normal decision?

In a code review or a bug report you hear: "a token in localStorage is dangerous, keep it in a cookie". Another developer answers: "a cookie is vulnerable to CSRF, and localStorage is not". Both are right, and that is why the word "safer" is not enough for a tester. This lesson is about what each storage protects from, what it does not, and which checks follow. The general difference between cookies, localStorage and sessionStorage is covered by the lesson about storages, and here it is about security.

How it works and why. There are two main threats. XSS: a malicious script got onto the page (through an unescaped field or a compromised library) and runs with the page's rights. It can read localStorage, sessionStorage and any cookie without HttpOnly. CSRF: another site makes the user's browser send a request to your application; the browser adds the cookie by itself, so the server considers the request legitimate. Hence different risk profiles.

Two ways to store a token, two risk profiles

HttpOnly cookie

A script cannot read the token

Stealing the token through XSS is harder. But the browser adds the cookie to every request automatically, so protection against CSRF is needed (SameSite, a token, an Origin check).

localStorage

The browser does not add the token by itself

Another site cannot trigger a request with your token, so classic CSRF does not work. But any script on the page reads the token, and XSS steals it.

Figure 1. This is not "safe and unsafe" but a different trade: both options need extra measures, and the choice depends on the team's threat model.

A cookie has attributes, and these are what QA checks:

AttributeWhat it protects fromHow to check
HttpOnlyReading the cookie from a script (theft through XSS)The flag is set in Application; document.cookie does not show it
SecureTransfer over plain HTTPThe flag in Application; the cookie does not go to an http address
SameSite=Lax or StrictSending the cookie in cross-site requests (CSRF)The attribute in Application; a request from another site goes without the cookie
Max-Age or ExpiresA session that is too longThe lifetime in Application matches the requirement (idle and absolute)
Domain and PathA scope that is too wideWithout Domain the cookie belongs only to this host; Path is no wider than needed

SameSite=None allows cross-site sending, and modern browsers require Secure for it. If the attribute is not set, browsers usually treat it as Lax, but an explicit value is more reliable. The __Host- prefix in the name makes the browser accept the cookie only with Secure, Path=/ and without Domain.

Example: from "everything works" to a finding. Functionally, sign-in works. The security check takes two minutes. We sign in, open the page Console and try what a malicious script could do:

// The page Console, after sign-in
document.cookie
// "sid=9f2c...; theme=dark"   <- the session cookie is visible to scripts: no HttpOnly
localStorage.getItem('token')
// "eyJhbGciOi..."              <- the token is available to any page script

Both values can be read, so a script that gets onto the page will steal them. The finding is written up as a defect with a risk, without drama:

Title: [Security] The session cookie has no HttpOnly and SameSite, the token is duplicated in localStorage
Actual: Set-Cookie: sid=9f2c...; Path=/ ; document.cookie returns sid;
  localStorage has the key token with a JWT value
Expected: Set-Cookie: sid=...; Path=/; Secure; HttpOnly; SameSite=Lax
  (the security requirement, the "Sessions" section); the token is not duplicated in storage
Risk: with an XSS a script could steal the session and the token
Severity: major (my conclusion; the security team makes the final assessment)

Why severity "major" and not "critical": the flags alone give no exploit, it needs an XSS too. But they remove the barrier that was meant to limit its consequences. The decision on severity and priority is left to the security team: QA records the fact, the conditions and the risk.

The remaining checks of this topic:

  • What lies in localStorage and sessionStorage: tokens, passwords, full profiles, personal data.
  • After logout all of it is removed, and an old token or cookie gives 401 (details in the lesson about storages).
  • A request that changes data (POST, PUT, DELETE) from another origin or without an Origin check or a CSRF token is rejected (403 per the contract).
  • Sensitive values do not get into the URL (browser history, logs, the Referer header).
  • The session has reasonable idle and absolute lifetimes, and after a password change old sessions stop being valid.

Limits and alternatives. Neither option saves from XSS: a script on the page can send requests on behalf of the user while the page is open, even without reading the token from an HttpOnly cookie. HttpOnly only keeps the token from being carried off and used elsewhere. So the main defence is not to allow XSS (escaping, CSP, updating dependencies), and the storage only reduces the damage. A common approach for single-page applications: a short-lived access token in page memory and a refresh token in an HttpOnly cookie with SameSite, but the final configuration is set by the architecture and the threat model. CSRF must not be confused with CORS: CORS decides what the browser lets a page from another origin read, while the request itself still reaches the server, so it does not protect from CSRF. Finally, browser policies on third-party cookies change and differ between browsers, so for embedded widgets and cross-site scenarios they are checked in several browsers.

Common mistakes.

  • Declaring that "localStorage is unsafe and a cookie is safe" or the other way round: each option has its own vulnerability and its own mitigation.
  • Treating HttpOnly as protection against XSS in general: it protects only from reading the value.
  • Checking a cookie only for presence and not for attributes.
  • Forgetting to check that a dangerous action from another origin is really rejected by the server.
  • Putting a description without conditions and risk into a report: "the cookie is wrong" tells the developer nothing.

Check yourself

The token lies in an HttpOnly cookie. Does it mean XSS is no longer a threat?

Answer

No. A script cannot read the token or carry it away, but it can send requests on behalf of the user while the page is open, because the browser adds the cookie itself. HttpOnly reduces the damage and does not remove the cause.

Why is a token in localStorage not vulnerable to classic CSRF?

Answer

Because the browser does not add it to requests automatically: the token must be added by the application's own script, and another site cannot see the localStorage of a different origin. But the same token is read by any script on the page, so it is vulnerable to XSS.

A cookie is set with SameSite=None but without Secure. What will probably happen?

Answer

Modern browsers will reject such a cookie, because SameSite=None requires Secure. The test: check in Application that the cookie is really stored and that it has Secure when cross-site sending is needed.

In an interview. Junior: Cookies are sent to the server with every request, hold up to 4 KB and can be HttpOnly, Secure and SameSite. localStorage holds about 5 MB with no expiry, sessionStorage lives while the tab is open. Session tokens are better kept in an HttpOnly cookie than in localStorage. Middle/Senior: I consider two threats: XSS and CSRF. HttpOnly stops a script from reading the cookie, but the browser adds it automatically, so SameSite or a CSRF token is needed. In localStorage the token is not added by itself (CSRF does not work), but any script reads it, so XSS steals it. No storage replaces protection against XSS. I test the cookie attributes, the contents of the storages, the behaviour after logout and the rejection of cross-site requests that change data, and I describe the risk in a report without exaggeration.

The DOM, layout and responsiveness

The DOM is the tree of page elements, and the browser recomputes layout each time from width, content and state. So that input space is explored: widths on both sides of a breakpoint (such as 767 and 768), extreme content (empty value, long word, translation), states (hover, focus, disabled, error), zoom and keyboard. An element can be in the DOM yet invisible, and the tolerance against the mockup is agreed beforehand.

QA Fundamentals · Web and client-server

In the mockup a long name fits, in production it breaks the card. How do you check layout systematically?

In Figma a user card looks perfect: the name "Olena", an avatar, a button. In production "Oleksandra-Viktoriia Kovalenko-Shevchenko" appears, and the name runs over the button. The designer and the developer are right that the mockup was reproduced. It is just that the mockup shows one width and ideal data, and a real screen has neither. This lesson is about what the DOM is, why the same page looks different, and which inputs (width, content, states) are worth going through so that the layout does not fall apart.

How it works and why. The browser reads the HTML and builds the DOM: a tree of nodes where each tag becomes an element, and JavaScript can change this tree and with it what the user sees. Then the browser combines the DOM with CSS styles and computes the position of every element (layout): the size depends on the available width of the parent, the content, the margins and the rules. So the layout is not drawn once but computed every time the window width, the content or the state changes. The main conclusion: checking one screen with one data set is one point out of many.

Widths to check

320 px · small phone768 px · tablet (edge: 767 and 768)1024 px · small laptop1440 px · monitor
Figure 1. Four typical widths to start with. Real breakpoints are taken from the project's CSS (they can be learned from developers or in the styles), and they are checked on both sides of the edge.

Two more dimensions complete it: content and state. Content: an empty value, a very long word without spaces, a long text, big numbers, emoji, a translation into another language (Ukrainian words are often longer than English ones). Element state: normal, hover, focus, active, disabled, error, loading, an empty list. They can be forced in Elements through forced state (Force state: :hover, :focus). Together width, content and state form the space of inputs in which the layout breaks: the same principle as in test design techniques, only for appearance.

A few facts about the DOM that are useful to QA. "View source" shows the HTML the server returned, and Elements shows the live DOM after scripts have run: for modern applications these are different things. An element can be in the DOM but invisible to the user: display: none, visibility: hidden, zero size, moved off the screen, covered by another element. Automated tests also distinguish presence from visibility: for example, Playwright considers an element visible if it has a non-empty bounding box and no visibility: hidden, and an element with opacity: 0 is considered visible. Locators in automated tests rely on the DOM: a role, a label and data-testid are more stable than nesting depth or classes that change with the layout.

Example: from "the layout is shifted" to a report. The complaint "the card is shifted" says nothing. After going through the inputs (narrowing the window to 375 px, inserting a long name) the bug can be described so that it is reproduced and fixed:

Before: "The product card got shifted".

After:
Title: [Catalog] A long name without spaces sticks out of the card
Environment: Chrome, window width 375 px (Device toolbar)
Steps: open a product with a name of 46 characters without spaces
Actual: the name sticks out past the right edge of the card and
  a horizontal page scroll appears
Expected: the name wraps or is cut with "…" (the Figma mockup
  "Card / Mobile", the rule for long names)
Hypothesis: in Elements .card-title has the computed white-space: nowrap

The "Hypothesis" line makes reproduction faster: Elements shows the computed styles, and the developer at once sees the rule because of which the text does not wrap. The mark about a hypothesis matters: it does not claim a diagnosis but only hints where to look. For comparison with the mockup we use the box model panel in Elements (sizes, padding, border, margin) and the Figma Inspect tool. Beforehand we agree on the tolerance: whether an exact pixel match is needed or deviations within a few pixels are acceptable. Without that every remark turns into an argument.

What to checkHow
Margins, fonts, colours, sizes against the mockupElements: Computed and the box model, Figma Inspect
Extreme contentAn empty value, a word without spaces, 200 characters, big numbers, another language
Element statesHover, focus (the Tab key), disabled, error, loading, empty state
Widths and breakpoint edgesDevice toolbar: 320, 768, 1024, 1440 and values on both sides of an edge, for example 767 and 768
Zoom and orientation200% zoom, a font size change, rotating the screen
KeyboardThe Tab order, a visible focus, reachability of all actions

Limits and alternatives. Width is handled by breakpoints, and they are only approximate classes of devices: a real phone in landscape or a foldable screen can land in an unexpected range, so intermediate widths are checked too. Edge values (767 and 768) catch off-by-one errors in media queries, like boundary values in test design. Responsiveness under accessibility requirements has its conditions as well: under WCAG 2.1 (the Reflow criterion) content must rearrange into one column at a width of 320 CSS pixels without two-dimensional scrolling, that is, at a large zoom. Visual regression tests (screenshots, Percy, Applitools or toHaveScreenshot in Playwright) catch a layout shift between builds, but give noise from fonts and animations, and a new design is still judged by a person. Right-to-left scripts or very long words may also be in the requirements. Finally, not every difference from the mockup is a defect: small deviations are agreed with the designer and recorded as a decision.

Common mistakes.

  • Checking only one "convenient" width and one "convenient" data set.
  • Resizing a desktop browser window and calling it a phone check.
  • Ignoring states: hover, focus, disabled and errors break more often than the normal look.
  • Writing "the layout is shifted" without the width, the data and a link to the mockup or the requirement.
  • Confusing an element's presence in the DOM with its visibility for the user.

Check yourself

An element is in Elements but the user does not see it. Name three causes.

Answer

For example: display: none or visibility: hidden; zero size or a colour that matches the background; the element is moved off the screen or covered by another element (z-index, an overlay). Each can be checked in Elements by the computed styles and the box model.

The CSS breakpoint is 768 px. Which widths do you check and why?

Answer

At least 767 and 768, that is, on both sides of the edge, because errors in media queries are often off by one (less than or at most). Plus the typical 320 and 1024 for the ends of the ranges.

Why is "View source" not suitable for seeing the current state of a page?

Answer

It shows the HTML that came from the server. The live DOM after JavaScript has run (added elements, changed text, attributes) is visible in Elements. For modern SPAs these two pictures differ a lot.

In an interview. Junior: The DOM is a tree of the HTML document in the browser's memory, controlled by JavaScript, and locators in automated tests work with it. I compare the layout with the mockup: margins, fonts, colours, sizes. I look at responsiveness in Device mode on several widths and on real devices. Middle/Senior: The layout is computed from width, content and state, so I go through this space: widths on both sides of breakpoints, extreme content (empty, a long word, a translation), states (hover, focus, disabled, error, loading), zoom and the keyboard. I agree the pixel tolerance beforehand. In a report I give the width, the data and a link to the mockup, and I mark the cause from Elements as a hypothesis. For regression screenshot tests can be used, but a person judges what is new.

JavaScript basics

JavaScript is single-threaded: after the synchronous code, the whole microtask queue (promises, continuations after await) runs, then one macrotask. So a promise beats a zero-delay setTimeout, which explains some flaky tests. Pitfalls: == coerces types, fetch does not reject on 404 or 500 (check res.ok), forEach does not await async callbacks, and a missing await gives a falsely green test.

QA Fundamentals · Web and client-server

Why does code in setTimeout(…, 0) run after a promise, and '5' == 5 gives true?

An automated test in Playwright or Cypress is written in JavaScript or TypeScript. A bug with "desynchronisation" (the button is already there but the data has not come yet) is explained by events and queues. An error in the console shows up as a line of code you must be able to read. These are the reasons why QA needs not the whole language but its core: comparison, variables, asynchrony. This lesson covers exactly that and explains why JavaScript behaves this way and not another.

How it works and why. JavaScript is single-threaded: one piece of code runs at a time. So as not to block the page while waiting for the network or a timer, long operations are handed to the browser (Web APIs), and the result returns into a queue. There are two kinds of queues. Microtasks (promise callbacks, the continuation after await, queueMicrotask) and macrotasks (setTimeout, events, network callbacks). The order is this: all the synchronous code runs, then the microtask queue is emptied, then one macrotask is taken, and the cycle repeats (between them the browser may update the screen). So a promise created later fires before a timer with zero delay.

Execution order

1. Synchronous coderuns on the call stack to the end2. Microtaskspromises, await, queueMicrotask: all of them3. One macrotasksetTimeout, an event, network; then 2 again
Figure 1. Microtasks always come before the next macrotask, so a "zero" timer does not mean "immediately".

Let us check on an example often given in interviews:

console.log('A');
setTimeout(() => console.log('B'), 0);
Promise.resolve().then(() => console.log('C'));
console.log('D');
// prints: A D C B

First the synchronous code runs: A is printed, the timer is handed to the browser, the promise puts a callback into the microtask queue, D is printed. Then the microtask queue empties (C), and only then comes the turn of the timer's macrotask (B). For QA this is not academic curiosity: "the element has appeared but the callback has not run yet" and similar windows between events underlie many unstable tests.

The second core is comparison. == first coerces the types, and === compares without coercion, so in code === is used almost always:

'5' == 5            // true   (type coercion)
'5' === 5           // false  (types differ)
null == undefined   // true
null === undefined  // false
0 == ''             // true
NaN === NaN         // false
typeof null         // 'object' (a historical quirk)

Variables. var has function scope and is hoisted with the value undefined, so it is hardly used. let and const have block scope; a let value can be reassigned, a const cannot. But const for an object or an array does not make it immutable: the contents can be changed, only the variable itself cannot be reassigned. So const user = {name: 'A'}; user.name = 'B' works, and user = {} gives an error.

Asynchrony. A promise has the states pending, fulfilled and rejected, and async/await is a more convenient notation over promises: await pauses the function until the result, and errors are caught by an ordinary try/catch. Everything after await runs as a microtask.

Example: a typical trap with fetch. A developer (or a test author) writes a request and reads the response at once:

// Before: a 500 is silently treated as data
const res = await fetch('/api/orders');
const orders = await res.json();

// After: fetch rejects only on a network failure, so check res.ok
const res = await fetch('/api/orders');
if (!res.ok) throw new Error('HTTP ' + res.status);
const orders = await res.json();

The mistake is that fetch rejects the promise only on a network failure. For a 404 or 500 response it returns a successful result with res.ok = false. Without a check the code either fails on res.json() with a confusing error (if the body is HTML) or takes the error body for data. For QA this is a hint during analysis: Unexpected token '<', "<!DOCTYPE "... is not valid JSON in the console often means that HTML of an error came instead of JSON. The same subtlety is in a loop: items.forEach(async (x) => { await save(x); }) does not wait for completion, because forEach ignores the returned promises. The right way is for (const x of items) await save(x) or await Promise.all(items.map(save)). The same logic is in automated tests: a missed await before actions or checks gives a test that "passes" without waiting for the result.

Anatomy of an error: JSON expected, HTML received

1GET https://staging.example.com/api/orders 500 (Internal Server Error)
2Uncaught (in promise) SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
  1. Cause: the server answered 500. For fetch this is a successful response, so the promise was not rejected.
  2. Effect: res.json() got an error page starting with <!DOCTYPE instead of JSON. There is no stack with a code line here: the browser itself raises the error while reading the response body, so look for the cause in the request from line 1.

What to do

Open this request in Network and look at Status and Response: it is a server failure, not JSON. In the code, check res.ok before res.json().

Figure 2. What it typically looks like in the Console (shortened): the numbers lead to the explanations.

Limits and alternatives. In Node.js (where Playwright tests run) the event loop is the same, but there are its own features: process.nextTick and setImmediate have their own order, and there is no DOM. TypeScript adds types, but only at compile time: at run time it is the same JavaScript, so a type error may not show up until a value arrives from the network. For an interview the depth depends on the role: in manual QA it is enough to be able to read code and the console and to explain why data has not appeared yet, while in automation the ability to predict the execution order and to write correct async code is expected. Other automation languages (Python, Java) do not remove the need to understand the front end: its code is JavaScript anyway.

Common mistakes.

  • Using == and being surprised by unobvious type coercion.
  • Thinking that setTimeout(fn, 0) runs the function immediately and before promises.
  • Not checking res.ok after fetch and taking a server error for success.
  • Using async inside forEach and expecting the loop to wait.
  • Missing await in a test: the check runs before the action has finished.

Check yourself

In what order will the console print: console.log(1); setTimeout(() => console.log(2)); Promise.resolve().then(() => console.log(3)); (async () => { console.log(4); await null; console.log(5); })(); console.log(6);

Answer

1, 4, 6, 3, 5, 2. First all the synchronous code: 1, 4 (up to await the function runs synchronously), 6. Then the microtasks in the order they were queued: 3 and the continuation after await (5). At the end the timer macrotask: 2.

fetch returned 404. Will execution go into catch?

Answer

No. The fetch promise is rejected only on a network failure (or an abort). For 404 it completes successfully and res.ok is false. So the status is checked explicitly, and then either an error is thrown or the response is handled.

const user = {name: "A"}; user.name = "B"; and then user = {}. What happens on each line?

Answer

The second line works: const forbids reassigning the variable, not changing the contents of the object. The third line gives a TypeError (Assignment to constant variable), because it tries to reassign the variable itself.

In an interview. Junior: == compares with type coercion and === without it, so I use ===. let and const have block scope, and a const cannot be reassigned. JavaScript is single-threaded, asynchrony works through the event loop, and async/await is a notation over promises. Middle/Senior: The execution order is: synchronous code, then all the microtasks (promises, the continuation after await), then one macrotask (setTimeout, an event), so a promise comes before a timer with zero delay. With this I explain some unstable tests and bugs of "desynchronisation". I remember the traps: fetch does not reject on 404 or 500 (res.ok is needed), forEach does not wait for async callbacks, and a missed await in a test gives a falsely green result.

Browser cache and HTTP caching

A browser keeps copies of files and the server controls this with response headers, mainly Cache-Control. While max-age holds there is no request to the server; then a check runs through ETag and If-None-Match, and 304 means the file is unchanged. no-cache allows storing but requires revalidation, while no-store forbids storing at all. A stale cache is told from a defect through Network and Disable cache.

QA Fundamentals · Web and client-server

After a release a tester sees the old version and a colleague the new one. Who is wrong?

The release went out, the bug was fixed, but on the tester's laptop it still reproduces. On the colleague's laptop everything is fine. The developer says "works on my machine", the tester answers "not on mine", and both are right: each has their own copy of the files. This lesson is about how a browser decides whether to ask the server and how QA tells a stale cache from a real defect.

How it works and why. Downloading a file is expensive, so the browser keeps a copy and reuses it. The server controls this with response headers. Cache-Control: max-age=N says that for N seconds the copy counts as fresh, and during that time the browser does not contact the server. When the time is up, the browser does not throw the copy away but asks "Has the file changed?" and adds If-None-Match with the version tag (ETag). If the file is the same, the server answers 304 Not Modified with no body and the copy stays in use. If it changed, a 200 response brings the new file.

What the browser decides

A copy exists and is still fresh (max-age)no request to the serverThe copy is stale: request with If-None-Matchthe browser asks whether the file changedServer: 304 with no body, or 200 with a file304 uses the copy, 200 replaces it
Figure 1. While the copy is fresh the server does not even learn about the request. So "released" and "the user sees the new file" are not the same thing.

Here is what it looks like in HTTP:

GET /assets/app.js HTTP/1.1

HTTP/1.1 200 OK
Cache-Control: max-age=31536000
ETag: "a1b2c3"

GET /assets/app.js HTTP/1.1
If-None-Match: "a1b2c3"

HTTP/1.1 304 Not Modified
ETag: "a1b2c3"

The first response allows using the file for a whole year. The second shows validation: the client passed the tag and the server confirmed the file is the same.

The directives QA meets most often:

DirectiveMeaning
max-age=Nthe copy is fresh for N seconds, the server is not asked
no-cachemay be stored, but validate before every use
no-storedo not store at all
private / publicbrowser cache only / shared caches too (CDN, proxy)

The names are confusing: no-cache does not forbid storing, no-store does. So a response with personal data must carry no-store, not no-cache.

Two ways to serve a file

Typical

A long max-age and the same URL

The file changed but the address did not. Browsers that hold a copy do not ask the server and show the old version for a long time.

Better

A hash in the file name, HTML without a long cache

A new release gets a new file address. You do not need to "kill" the copy: nobody refers to it any more.

Figure 2. The difference between "lives for a year" and "updates at once" is not the cache lifetime but whether the address changes together with the content.

Example: from "the bug is not fixed" to understanding the cause. The first thing QA does when seeing the old behaviour after a release is check whether it comes from the cache. The initial version looks like this:

app.js    Cache-Control: max-age=31536000
          URL: /assets/app.js          (no hash)
Release:  a new app.js on the server
Result:   open tabs and returning users
          keep the old app.js for a year

Here the cause is visible at once: the address did not change and the cache lifetime is long. The fixed version:

app.4f9c2e1a.js   Cache-Control: max-age=31536000
index.html        Cache-Control: no-cache
Release:  the new index.html points to
          app.7b30d5c8.js (a new URL)
Result:   users get the new file at once,
          the old one is left unreferenced

How to check it in three minutes. In DevTools open Network and reload the page. In the Size column the text "disk cache" or "memory cache" says there was no request to the server. Enable Disable cache (it works while DevTools is open) or do a hard reload: if the bug is gone, it was the cache. In the report write what exactly reproduces with a clean cache and add the Cache-Control value from the response.

Limits and alternatives. The browser cache is not the only one. A CDN and proxies may stand between the user and the server, and they cache by their own rules (the s-maxage, public and private directives, the Vary header). So "I cleared the browser cache" does not always help: the stale copy may sit on the CDN. A service worker (a script that intercepts requests, including in a PWA) has its own Cache Storage that ignores HTTP caching headers: the script itself updates it. Mobile apps also often keep their own data cache with rules of their own. It can be worse: a user sees someone else's data when a response with personal data was cached in a shared cache. That is already a serious security defect. Finally, the cache differs from cookies and localStorage, although all of them "store something": the cache stores server responses and is driven by its headers, while app storage is driven by the application itself.

Typical mistakes.

  • Filing "the fix does not work" without checking the cache: the developer opens the page with no old copy and cannot reproduce.
  • Writing "cleared the cache, it helped" and not saying that this is a file versioning defect: the next release will give the same effect.
  • Confusing no-cache and no-store: the first allows storing, so personal data may stay on disk.
  • Checking a release in the same browser that held the previous version and seeing no difference: a clean profile window or Disable cache is needed.
  • Forgetting the CDN: after clearing the browser, the old copy arrives from an edge server.

Check yourself

After a release the tester has the old page and a colleague the new one. Files are served with a one-year max-age and have the same names between releases. How do you check that it is the cache and not a bug?

Answer

I open Network and look whether there is a request to the server: "disk cache" in the Size column means there is not. I enable Disable cache or do a hard reload: if the old behaviour is gone, it is the cache. A separate defect: file names without a content hash combined with a long max-age.

The browser sent If-None-Match and the server answered 304 with no body. What does it say about the file and why is there no body?

Answer

The file has not changed, the server compared the version tag (ETag). There is no body because the browser already has it in the cache and takes it from there, which saves traffic.

In an interview. Junior: A browser keeps copies of files so it does not download them every time. If I see the old version after a release, I first check whether it is the cache: I enable Disable cache or do a hard reload. Middle/Senior: The cache is driven by the Cache-Control, ETag and If-None-Match headers: while the copy is fresh (max-age) there is no request to the server, then comes validation and 304. no-store forbids storing, no-cache requires validation. A good practice is a hash in the names of static files with a long max-age and HTML without a long cache. Separately I keep CDNs, proxies and a service worker in mind, because they have their own caches, and personal responses must not end up in a shared cache.

Sessions and tokens on the web: cookie session or JWT

A cookie session keeps its state on the server and a JWT inside a signed token, so a session can be revoked at once and a token stays valid until exp. After logout the old identifier must not grant access, and this is checked by replaying a request. For a JWT the expected result is set by the requirement: a short lifetime, a revocable refresh token or a denylist.

QA Fundamentals · Web and client-server

The user logged out, yet the old token in a request still returns data. Is that a bug?

A tester clicks "Log out", then copies a previously saved request in DevTools and sends it again. The response is 200 with profile data. In one product that is a critical bug, in another it is documented behaviour. The difference is the session model, and that is what an interview asks about: how a cookie session differs from a JWT and what you check at logout and when the session expires. The lesson is about the session lifecycle. Storage threats (XSS, CSRF) are covered in the lesson about cookies and localStorage and only mentioned here.

How it works

Cookie session. After login the server creates a session record (user, creation time, last activity, expiry) in its own store and hands the browser a random identifier in a cookie. Every request carries the identifier and the server looks the record up. The state lives on the server.

JWT. After login the server signs a token with claims: who the user is, when it was issued, when it expires (exp, in seconds since the epoch per RFC 7519). Every request carries the token and the server checks the signature and exp without touching a store. The state lives in the token itself. A token is usually only signed (JWS), not encrypted (JWE): anyone can read its content, so secrets are not kept in it.

This gives the main difference for a tester. A session record can be deleted and the identifier stops working at once. A signed token without help from the server is valid until exp, and revoking it earlier needs extra state: a denylist, a token version counter in the database, or a short-lived access token together with a revocable refresh token. Where the token lives (a cookie or an Authorization header) is a separate question: a JWT can perfectly well sit in an HttpOnly cookie.

What we checkCookie sessionJWT (access token)
LogoutThe record is deleted on the server and the cookie cleared; the old identifier gives 401The client drops the token; the old token works until exp unless there is revocation. The expected result is set by the requirement
ExpiryThe server enforces idle and absolute limits; Max-Age on the cookie is only a hint to the browserThe server rejects the token after exp; then either a refresh or a new login
Forced end (password change, ban)Delete the user’s sessions, effective at onceNeeds a revocation mechanism, otherwise valid until exp
TamperingA made-up identifier: 401A modified payload or removed signature: 401

Example: replaying a request after logout

The simplest check does not need the UI: save a request before logging out and replay it afterwards.

GET /api/profile HTTP/1.1
Cookie: sid=9f3c71

HTTP/1.1 200 OK

POST /api/logout HTTP/1.1
Cookie: sid=9f3c71

HTTP/1.1 204 No Content
Set-Cookie: sid=; Max-Age=0; Path=/; HttpOnly; Secure

GET /api/profile HTTP/1.1
Cookie: sid=9f3c71

HTTP/1.1 401 Unauthorized

If the third response is 200, the server only cleared the cookie in the browser and did not destroy the session: an identifier someone has already copied stays valid. That is a bug. The same replay with a JWT and a 200 is not yet a bug: compare it with the requirement. If the access token lives a few minutes and the refresh token is revoked, that is an acceptable residual window. If the requirement says that logout closes access at once, or the token lives a day and there is no revocation, it is a question for the team, and the decision is recorded in the ticket.

Expiry is not checked by waiting. Ask for a short session or token lifetime in the test environment (a minute), or change the time on the test server, or issue an expired token with a test key. After it lapses, check that the API answers 401, that the UI sends the user to the login and afterwards back to the right page, and that an unsaved form does not vanish silently and there is no endless "401, refresh, 401" loop.

Limits and alternatives

  • A JWT is not "less safe" or "better" than a session: it is a trade-off. It removes a store lookup on every request but gives up instant revocation.
  • There are in-between models too: opaque tokens verified at the authorization server, a pair of "short access token plus a refresh token with rotation". Their rules come from the product documentation, not from a handbook.
  • The codes differ: 401 means there is no valid authentication (no token, expired or invalid), 403 means the user is authenticated but not allowed to act (RFC 9110).

Common mistakes

  • Checking logout only in the UI. The button hides the token but does not destroy the session; consequence: the bug goes unnoticed.
  • Counting a cleared localStorage as a logout. A token that has already been copied stays valid.
  • Not checking a second tab and another device. After a password change the old sessions must end, which shows only by a replay from a second client.
  • Mixing up 401 and 403. The client reacts differently to these codes, so the mistake breaks the token refresh.
  • Trusting the token content as proof of rights. The server checks the rights, and the token can be forged if the signature is not verified.

Check yourself

The access token lives 15 minutes and logout revokes the refresh token. Ten minutes after logout the old access token still returns 200. Is it a bug?

Answer

Not under this model: it is a documented residual window until exp. Check that the refresh no longer works, that the token gives 401 after exp and that the requirement really allows such a window. For payments the window may be unacceptable, and then it is a question about revocation, not about code.

A user changed the password on device A, and the cookie session on device B stays valid. What do you do?

Answer

Check against the requirement: normally a password change must end the other sessions. Replay a request with the cookie of device B. If the response is 200, the server does not delete sessions on a password change, and that is a bug of high severity, because a stolen identifier survives the password change.

In an interview. Junior: In a cookie session the server keeps the state and the browser carries an identifier. In a JWT the state is in a signed token. After logout the old identifier or token should not grant access, and I check that by replaying a request. Middle/Senior: A session can be revoked at once, a JWT lives until exp unless there is revocation, so the expected result after logout depends on the model and the requirement. I check logout and expiry by replaying a request, a password change from a second device, rejection of a forged token and the UI behaviour after a 401, and I record the accepted token window in the ticket.