-
Notifications
You must be signed in to change notification settings - Fork 141
chore: test Academy exercises #2097
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
fb9e3bc
819462b
10a0743
6d50689
401cc92
e296be1
e673e9f
846602c
a674604
a72090d
db19ee5
fc05b0d
6936de9
cd5deaa
857d3a3
9901553
c056906
ddb9a1b
87b813b
cdc8023
d006397
dfe9b28
b324b20
d4e0643
118a550
8c875d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: Test Academy | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: "0 3 1 * *" # at 3am UTC on 1st day of month | ||
| workflow_dispatch: # allows running this workflow manually from the Actions tab | ||
|
|
||
| jobs: | ||
| test-exercises: | ||
| name: Test Academy Exercises | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Source code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| cache: npm | ||
| cache-dependency-path: package-lock.json | ||
|
|
||
| - name: Setup Python | ||
| uses: astral-sh/setup-uv@v7 | ||
|
|
||
| - name: Install Bats | ||
| run: | | ||
| corepack enable | ||
| npm install --only=dev | ||
|
|
||
| - name: Test | ||
| run: npm run test:academy |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,7 @@ | |
| "lint:md:fix": "markdownlint '**/*.md' --fix", | ||
| "lint:code": "eslint .", | ||
| "lint:code:fix": "eslint . --fix", | ||
| "test:academy": "bats --print-output-on-failure -r .", | ||
| "postinstall": "patch-package", | ||
| "postbuild": "node ./scripts/joinLlmsFiles.mjs && node ./scripts/indentLlmsFile.mjs" | ||
| }, | ||
|
|
@@ -48,6 +49,7 @@ | |
| "@apify/tsconfig": "^0.1.0", | ||
| "@types/react": "^19.0.0", | ||
| "babel-plugin-styled-components": "^2.1.4", | ||
| "bats": "^1.13.0", | ||
| "cross-env": "^10.0.0", | ||
| "eslint": "^9.32.0", | ||
| "eslint-plugin-react": "^7.37.5", | ||
|
|
@@ -61,8 +63,8 @@ | |
| "typescript-eslint": "^8.38.0" | ||
| }, | ||
| "dependencies": { | ||
| "@apify/ui-library": "^1.97.2", | ||
| "@apify/ui-icons": "^1.19.0", | ||
| "@apify/ui-library": "^1.97.2", | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not my change, npm re-ordered this on its own 👀 |
||
| "@docusaurus/core": "^3.8.1", | ||
| "@docusaurus/faster": "^3.8.1", | ||
| "@docusaurus/plugin-client-redirects": "^3.8.1", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,8 +5,10 @@ description: Lesson about building a Node.js application for watching prices. Us | |
| slug: /scraping-basics-javascript/downloading-html | ||
| --- | ||
|
|
||
| import CodeBlock from '@theme/CodeBlock'; | ||
| import LegacyJsCourseAdmonition from '@site/src/components/LegacyJsCourseAdmonition'; | ||
| import Exercises from '../scraping_basics/_exercises.mdx'; | ||
| import LegoExercise from '!!raw-loader!roa-loader!./exercises/lego.mjs'; | ||
|
|
||
| <LegacyJsCourseAdmonition /> | ||
|
|
||
|
|
@@ -184,28 +186,17 @@ Letting our program visibly crash on error is enough for our purposes. Now, let' | |
|
|
||
| <Exercises /> | ||
|
|
||
| ### Scrape AliExpress | ||
| ### Scrape LEGO | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the only I fixed. After this one I decided fixing the exercises should be in separate PRs, not in this one: #2113 |
||
|
|
||
| Download HTML of a product listing page, but this time from a real world e-commerce website. For example this page with AliExpress search results: | ||
| Download HTML of a product listing page, but this time from a real world e-commerce website. For example this page with LEGO search results: | ||
|
|
||
| ```text | ||
| https://www.aliexpress.com/w/wholesale-darth-vader.html | ||
| https://www.lego.com/en-us/themes/star-wars | ||
| ``` | ||
|
|
||
| <details> | ||
| <summary>Solution</summary> | ||
|
|
||
| ```js | ||
| const url = "https://www.aliexpress.com/w/wholesale-darth-vader.html"; | ||
| const response = await fetch(url); | ||
|
|
||
| if (response.ok) { | ||
| console.log(await response.text()); | ||
| } else { | ||
| throw new Error(`HTTP ${response.status}`); | ||
| } | ||
| ``` | ||
|
|
||
| <CodeBlock language="js">{LegoExercise.code}</CodeBlock> | ||
| </details> | ||
|
|
||
| ### Save downloaded HTML as a file | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TC-MO Can you take a look at this README change, please? Does it make sense this way?