Add Playwright e2e tests characterizing the news feed screen#425
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Add Playwright e2e tests characterizing the news feed screen#425devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Co-Authored-By: Lukas Burger <lukaskburger@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Playwright as the e2e harness (alongside the existing Protractor
e2e/) and a suite of characterization tests that lock in the current behavior of the home/news feed (news/1) and header.All Hacker News API calls (
https://node-hnapi.herokuapp.com/{feedType}?page={page}) are intercepted viapage.route('**/node-hnapi.herokuapp.com/**', ...)and served from a 30-story fixture, so tests are deterministic and never hit the live API.What's added
playwright.config.ts—baseURL: http://localhost:4200, tests intests/, and awebServerrunningnpm start(ng serve) that waits on4200.NODE_OPTIONS=--openssl-legacy-provideronly when running on Node ≥17 (no-op on the Node 12/13 versions this app targets):tests/fixtures/news.json— 30 stories shaped from theStorymodel +item.component.htmlfields (id,title,url,domain,points,user,time_ago,comments_count,type). Index 0 = externalurlstory, index 1 = no url (internal/item/:idlink), index 2 =jobtype.tests/support/api.ts— helpers:mockFeed,mockFeedError(500 → non-JSON body → service error branch), andmockFeedDeferred(gated response to observe the pending/loading state).tests/home-feed.spec.ts&tests/header.spec.ts— the test suite.package.json—"test:e2e": "playwright test";@playwright/test@1.61.1devDependency..gitignore— Playwright output dirs.Behavior covered
Home feed:
/→/news/1redirect;app-loadervisible + noolwhile pending;olof 30li.post; external anchorhref == story.urlvs internalrouterLink/item/:id; points/user(/user/:user)/time_ago/comments present for non-job items and absent forjob; page-1 pagination (‹ Prevabsent,More ›→/news/2with 30 items, absent with <30); error path showsapp-error-message"Could not load news stories." and no list.Header: logo →
/news/1; navnew/show/ask/jobs→/newest/1,/show/1,/ask/1,/jobs/1; settings cog opensapp-settings.Notes on characterization choices (assert actual, not idealized, behavior)
toBeAttached()rather thantoBeVisible(), because the item renders two responsive variants (subtext-palm/subtext-laptop) and CSS hides one per viewport..overlaythat intercepts the cog; the test therefore closes it via the panel's own×control (.close), which reflects the real UX.Test plan
npm run test:e2e→ 15 passed. Run on Node 20 (@playwright/testrequires Node ≥18); the config'swebServerbuilds ng serve with the legacy OpenSSL flag.Link to Devin session: https://app.devin.ai/sessions/aae8804bb4b648f09216bad43ccaa3ab
Requested by: @lburgers
Devin Review