@govtechsg/oobee 0.10.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/.dockerignore +22 -0
  2. package/.github/pull_request_template.md +11 -0
  3. package/.github/workflows/docker-test.yml +54 -0
  4. package/.github/workflows/image.yml +107 -0
  5. package/.github/workflows/publish.yml +18 -0
  6. package/.idea/modules.xml +8 -0
  7. package/.idea/purple-a11y.iml +9 -0
  8. package/.idea/vcs.xml +6 -0
  9. package/.prettierrc.json +12 -0
  10. package/.vscode/extensions.json +5 -0
  11. package/.vscode/settings.json +10 -0
  12. package/CODE_OF_CONDUCT.md +128 -0
  13. package/DETAILS.md +163 -0
  14. package/Dockerfile +60 -0
  15. package/INSTALLATION.md +146 -0
  16. package/INTEGRATION.md +785 -0
  17. package/LICENSE +22 -0
  18. package/README.md +587 -0
  19. package/SECURITY.md +5 -0
  20. package/__mocks__/mock-report.html +1431 -0
  21. package/__mocks__/mockFunctions.ts +32 -0
  22. package/__mocks__/mockIssues.ts +64 -0
  23. package/__mocks__/mock_all_issues/000000001.json +64 -0
  24. package/__mocks__/mock_all_issues/000000002.json +53 -0
  25. package/__mocks__/mock_all_issues/fake-file.txt +0 -0
  26. package/__tests__/logs.test.ts +25 -0
  27. package/__tests__/mergeAxeResults.test.ts +278 -0
  28. package/__tests__/utils.test.ts +118 -0
  29. package/a11y-scan-results.zip +0 -0
  30. package/eslint.config.js +53 -0
  31. package/exclusions.txt +2 -0
  32. package/gitlab-pipeline-template.yml +54 -0
  33. package/jest.config.js +1 -0
  34. package/package.json +96 -0
  35. package/scripts/copyFiles.js +44 -0
  36. package/scripts/install_oobee_dependencies.cmd +13 -0
  37. package/scripts/install_oobee_dependencies.command +101 -0
  38. package/scripts/install_oobee_dependencies.ps1 +110 -0
  39. package/scripts/oobee_shell.cmd +13 -0
  40. package/scripts/oobee_shell.command +11 -0
  41. package/scripts/oobee_shell.sh +55 -0
  42. package/scripts/oobee_shell_ps.ps1 +54 -0
  43. package/src/cli.ts +401 -0
  44. package/src/combine.ts +240 -0
  45. package/src/constants/__tests__/common.test.ts +44 -0
  46. package/src/constants/cliFunctions.ts +305 -0
  47. package/src/constants/common.ts +1840 -0
  48. package/src/constants/constants.ts +443 -0
  49. package/src/constants/errorMeta.json +319 -0
  50. package/src/constants/itemTypeDescription.ts +11 -0
  51. package/src/constants/oobeeAi.ts +141 -0
  52. package/src/constants/questions.ts +181 -0
  53. package/src/constants/sampleData.ts +187 -0
  54. package/src/crawlers/__tests__/commonCrawlerFunc.test.ts +51 -0
  55. package/src/crawlers/commonCrawlerFunc.ts +656 -0
  56. package/src/crawlers/crawlDomain.ts +877 -0
  57. package/src/crawlers/crawlIntelligentSitemap.ts +156 -0
  58. package/src/crawlers/crawlLocalFile.ts +193 -0
  59. package/src/crawlers/crawlSitemap.ts +356 -0
  60. package/src/crawlers/custom/extractAndGradeText.ts +57 -0
  61. package/src/crawlers/custom/flagUnlabelledClickableElements.ts +964 -0
  62. package/src/crawlers/custom/utils.ts +486 -0
  63. package/src/crawlers/customAxeFunctions.ts +82 -0
  64. package/src/crawlers/pdfScanFunc.ts +468 -0
  65. package/src/crawlers/runCustom.ts +117 -0
  66. package/src/index.ts +173 -0
  67. package/src/logs.ts +66 -0
  68. package/src/mergeAxeResults.ts +964 -0
  69. package/src/npmIndex.ts +284 -0
  70. package/src/screenshotFunc/htmlScreenshotFunc.ts +411 -0
  71. package/src/screenshotFunc/pdfScreenshotFunc.ts +762 -0
  72. package/src/static/ejs/partials/components/categorySelector.ejs +4 -0
  73. package/src/static/ejs/partials/components/categorySelectorDropdown.ejs +57 -0
  74. package/src/static/ejs/partials/components/pagesScannedModal.ejs +70 -0
  75. package/src/static/ejs/partials/components/reportSearch.ejs +47 -0
  76. package/src/static/ejs/partials/components/ruleOffcanvas.ejs +105 -0
  77. package/src/static/ejs/partials/components/scanAbout.ejs +263 -0
  78. package/src/static/ejs/partials/components/screenshotLightbox.ejs +13 -0
  79. package/src/static/ejs/partials/components/summaryScanAbout.ejs +141 -0
  80. package/src/static/ejs/partials/components/summaryScanResults.ejs +16 -0
  81. package/src/static/ejs/partials/components/summaryTable.ejs +20 -0
  82. package/src/static/ejs/partials/components/summaryWcagCompliance.ejs +94 -0
  83. package/src/static/ejs/partials/components/topFive.ejs +6 -0
  84. package/src/static/ejs/partials/components/wcagCompliance.ejs +70 -0
  85. package/src/static/ejs/partials/footer.ejs +21 -0
  86. package/src/static/ejs/partials/header.ejs +230 -0
  87. package/src/static/ejs/partials/main.ejs +40 -0
  88. package/src/static/ejs/partials/scripts/bootstrap.ejs +8 -0
  89. package/src/static/ejs/partials/scripts/categorySelectorDropdownScript.ejs +190 -0
  90. package/src/static/ejs/partials/scripts/categorySummary.ejs +141 -0
  91. package/src/static/ejs/partials/scripts/highlightjs.ejs +335 -0
  92. package/src/static/ejs/partials/scripts/popper.ejs +7 -0
  93. package/src/static/ejs/partials/scripts/reportSearch.ejs +248 -0
  94. package/src/static/ejs/partials/scripts/ruleOffcanvas.ejs +801 -0
  95. package/src/static/ejs/partials/scripts/screenshotLightbox.ejs +71 -0
  96. package/src/static/ejs/partials/scripts/summaryScanResults.ejs +14 -0
  97. package/src/static/ejs/partials/scripts/summaryTable.ejs +78 -0
  98. package/src/static/ejs/partials/scripts/utils.ejs +441 -0
  99. package/src/static/ejs/partials/styles/bootstrap.ejs +12375 -0
  100. package/src/static/ejs/partials/styles/highlightjs.ejs +54 -0
  101. package/src/static/ejs/partials/styles/styles.ejs +1843 -0
  102. package/src/static/ejs/partials/styles/summaryBootstrap.ejs +12458 -0
  103. package/src/static/ejs/partials/summaryHeader.ejs +70 -0
  104. package/src/static/ejs/partials/summaryMain.ejs +75 -0
  105. package/src/static/ejs/report.ejs +420 -0
  106. package/src/static/ejs/summary.ejs +47 -0
  107. package/src/static/mustache/.prettierrc +4 -0
  108. package/src/static/mustache/Attention Deficit.mustache +11 -0
  109. package/src/static/mustache/Blind.mustache +11 -0
  110. package/src/static/mustache/Cognitive.mustache +7 -0
  111. package/src/static/mustache/Colorblindness.mustache +20 -0
  112. package/src/static/mustache/Deaf.mustache +12 -0
  113. package/src/static/mustache/Deafblind.mustache +7 -0
  114. package/src/static/mustache/Dyslexia.mustache +14 -0
  115. package/src/static/mustache/Low Vision.mustache +7 -0
  116. package/src/static/mustache/Mobility.mustache +15 -0
  117. package/src/static/mustache/Sighted Keyboard Users.mustache +42 -0
  118. package/src/static/mustache/report.mustache +1709 -0
  119. package/src/types/print-message.d.ts +28 -0
  120. package/src/types/types.ts +46 -0
  121. package/src/types/xpath-to-css.d.ts +3 -0
  122. package/src/utils.ts +332 -0
  123. package/tsconfig.json +15 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Government Technology Agency
4
+
5
+ Chat with Gayle!
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,587 @@
1
+ # Oobee (CLI)
2
+
3
+ [Oobee](https://go.gov.sg/oobee-cli) (formerly known as Purple A11y) is a customisable, automated accessibility testing tool that allows software development teams to assess whether their products are user-friendly to persons with disabilities (PWDs).
4
+
5
+ This is the engine and command-line interface (CLI) for Oobee. The official application can only be downloaded at [https://go.gov.sg/oobee-cli](https://go.gov.sg/oobee-cli). We recommend that you download the software only from the official link, as other sources and/or third party links may pose risks and/or compromise your system.
6
+
7
+ For the **user-friendly desktop application**, check out [Oobee](https://go.gov.sg/oobee).
8
+
9
+ ## Technology Stack
10
+
11
+ 1. [Crawlee](https://crawlee.dev/)
12
+ 2. [Axe-core](https://github.com/dequelabs/axe-core)
13
+ 3. [Node.js](https://Node.js.org/en/)
14
+ 4. [Playwright](https://playwright.dev/)
15
+ 5. [Pixelmatch](https://github.com/mapbox/pixelmatch)
16
+ 6. [Corretto](https://aws.amazon.com/corretto)
17
+ 7. [VeraPDF](https://github.com/veraPDF/veraPDF-apps)
18
+
19
+ ## Using Oobee as a NodeJS module
20
+
21
+ If you wish to use Oobee as a NodeJS module that can be integrated with end-to-end testing frameworks, refer to the [integration guide](./INTEGRATION.md) on how you can do so.
22
+
23
+ ## Prerequisites and Installations
24
+
25
+ ### Portable Oobee
26
+
27
+ Portable Oobee is the recommended way to run Oobee as it reduces the difficulty for installation. Refer to [Installation Guide](./INSTALLATION.md) for step-by-step instructions for portable Oobee.
28
+
29
+ ### Manual Installation
30
+
31
+ Please ensure the following requirements are met:
32
+
33
+ #### Node.js
34
+
35
+ - A Node distribution of 20 (LTS) or above.
36
+ - To check your version of Node, go into terminal and paste the command bellow
37
+
38
+ ```shell
39
+ node -v
40
+ ```
41
+
42
+ - If you do not have node, or if there is a need to manage your node versions, you can consider using [Node Version Manager (NVM)](https://github.com/nvm-sh/nvm). After NVM is installed, you can then install an LTS version of Node:
43
+
44
+ ```shell
45
+ # Install NodeJS version with NVM
46
+ nvm install --lts
47
+
48
+ # For subsequent use, you will need to run the command below each time you open a new terminal
49
+ nvm use --lts
50
+ ```
51
+
52
+ - Install the required NPM packages with `npm install`.
53
+ - Build the project with `npm run build` before you try to run it with `npm start`.
54
+
55
+ #### Java JRE/JDK
56
+
57
+ - A JRE/JDK distribution of version 11 or above.
58
+ - To check your version of Java, go into terminal and paste the command bellow
59
+
60
+ ```shell
61
+ java --version
62
+ ```
63
+
64
+ - If you do not have java, you can consider installing [Corretto](https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/what-is-corretto-11.html) distribution of OpenJDK.
65
+
66
+ #### VeraPDF
67
+
68
+ - VeraPDF is used for scanning PDF files. Install VeraPDF by following the [install guide](https://docs.verapdf.org/install/). You may wish to use the Automated installation script provided on that page, and changing the XML installation script section `<installpath>/tmp/verapdf-test</installpath>` to a location of your choice.
69
+ - Ensure you have VeraPDF set in PATH then verify verapdf is installed correctly:
70
+
71
+ ```shell
72
+ # Invoke the VeraPDF installer
73
+ # Windows users should use vera-install.bat instead of vera-install
74
+ ./verapdf-install ./auto-install.xml
75
+
76
+ # Add VeraPDF to PATH. For subsequent use, you will need to run the command below each time you open a new terminal
77
+ export PATH="<location of verapdf>:$PATH"
78
+
79
+ # Verify verapdf is installed
80
+ verapdf --version
81
+ ```
82
+
83
+ #### Facing issues?
84
+
85
+ Please refer to [Troubleshooting section](#troubleshooting) for more information.
86
+
87
+ ---
88
+
89
+ ## Features
90
+
91
+ Oobee can perform the following to scan the target URL.
92
+
93
+ - To **run** Oobee in **terminal**, run `npm start`. Questions will be prompted to assist you in providing the right inputs.
94
+ - Results will be compiled in JSON format, followed by generating a HTML report.
95
+
96
+ > NOTE: For your initial scan, there may be some loading time required before use. Oobee will also ask for your name and email address and collect your app usage data to personalise your experience. Your information fully complies with [GovTech’s Privacy Policy](https://www.tech.gov.sg/privacy/).
97
+
98
+ #### Delete/Edit Details
99
+
100
+ > You may delete and edit your cached name and e-mail address by running the following command to delete `userData.txt`:
101
+
102
+ > - Windows (PowerShell): `rm "$env:APPDATA\Oobee\userData.txt"`
103
+ > - MacOS (Terminal): `rm "$HOME/Library/Application Support/Oobee/userData.txt"`
104
+
105
+ If `userData.txt` does not exists just run `npm start`.
106
+
107
+ ### Scan Selection
108
+
109
+ You can interact via your arrow keys.
110
+
111
+ ```shell
112
+ % npm start
113
+ ┌────────────────────────────────────────────────────────────┐
114
+ │ Oobee (ver ) │
115
+ │ We recommend using Chrome browser for the best experience.│
116
+ │ │
117
+ │ Welcome back User! │
118
+ │ (Refer to readme.txt on how to change your profile) │
119
+ └────────────────────────────────────────────────────────────┘
120
+ ? What would you like to scan? (Use arrow keys)
121
+ ❯ Sitemap
122
+ Website
123
+ Custom
124
+ ```
125
+
126
+ ### Headless Mode
127
+
128
+ Headless mode would allow you to run the scan in the background. If you would like to observe the scraping process, please enter `n`
129
+
130
+ ```shell
131
+ % npm start
132
+ ┌────────────────────────────────────────────────────────────┐
133
+ │ Oobee (ver ) │
134
+ │ We recommend using Chrome browser for the best experience. │
135
+ │ │
136
+ │ Welcome back User! │
137
+ │ (Refer to readme.txt on how to change your profile) │
138
+ └────────────────────────────────────────────────────────────┘
139
+ ? What would you like to scan? Sitemap
140
+ ? Do you want oobee to run in the background? (Y/n) No
141
+ ```
142
+
143
+ ### Sitemap Scan
144
+
145
+ ```shell
146
+ % npm start
147
+ ┌────────────────────────────────────────────────────────────┐
148
+ │ Oobee (ver ) │
149
+ │ We recommend using Chrome browser for the best experience. │
150
+ │ │
151
+ │ Welcome back User! │
152
+ │ (Refer to readme.txt on how to change your profile) │
153
+ └────────────────────────────────────────────────────────────┘
154
+ ? What would you like to scan? Sitemap
155
+ ? Do you want oobee to run in the background? No
156
+ ? Which screen size would you like to scan? (Use arrow keys) Desktop
157
+ ? Please enter URL or file path to sitemap, or drag and drop a sitemap file here: https://www.sitemaps.org/sitemap.xml
158
+
159
+
160
+ Scanning website...
161
+
162
+
163
+ Fetching URLs. This might take some time...
164
+
165
+
166
+ Scanning website...
167
+
168
+ #oobee will then start scraping from the file link provided above.
169
+ #Console results
170
+
171
+ ```
172
+
173
+ If the sitemap URL provided is invalid, an error message will be prompted for you to provide a valid input.
174
+
175
+ ```shell
176
+ >> Invalid sitemap format. Please provide a URL with a valid sitemap.
177
+ ```
178
+
179
+ ### Website Scan
180
+
181
+ ```shell
182
+ % npm start
183
+ ┌────────────────────────────────────────────────────────────┐
184
+ │ Oobee (ver ) │
185
+ │ We recommend using Chrome browser for the best experience. │
186
+ │ │
187
+ │ Welcome back User! │
188
+ │ (Refer to readme.txt on how to change your profile) │
189
+ └────────────────────────────────────────────────────────────┘
190
+ ? What would you like to scan? Website
191
+ ? Do you want oobee to run in the background? Yes
192
+ ? Which screen size would you like to scan? (Use arrow keys) Desktop
193
+ ? Please enter URL of website: https://www.domain.org
194
+
195
+ ```
196
+
197
+ If the website URL provided is invalid, an error message will be prompted for you to provide a valid input.
198
+
199
+ ```shell
200
+ >> Cannot resolve URL. Please provide a valid URL.
201
+ ```
202
+
203
+ ### Customised Mobile Device Scan
204
+
205
+ ```shell
206
+ % npm start
207
+ ┌────────────────────────────────────────────────────────────┐
208
+ │ Oobee (ver ) │
209
+ │ We recommend using Chrome browser for the best experience. │
210
+ │ │
211
+ │ Welcome back User! │
212
+ │ (Refer to readme.txt on how to change your profile) │
213
+ └────────────────────────────────────────────────────────────┘
214
+ ? What would you like to scan? Website
215
+ ? Do you want oobee to run in the background? No
216
+ ? Which screen size would you like to scan? (Use arrow keys) (Use arrow keys)
217
+ ❯ Desktop
218
+ Mobile
219
+ Custom
220
+ ```
221
+
222
+ Choose `Mobile` for a default mobile screen size scan and `Custom` to choose a device or specify viewport width options.
223
+
224
+ ### Custom flow
225
+
226
+ Custom flow allows you to specify a user journey by enabling you to click the scan button on each desired webpage on a browser to initiate scan. This is useful to scan websites that require user and form input.
227
+
228
+ 1. Start by choosing the `Custom flow` in the menu selection.
229
+
230
+ ```shell
231
+ % npm start
232
+ ┌────────────────────────────────────────────────────────────┐
233
+ │ Oobee (ver ) │
234
+ │ We recommend using Chrome browser for the best experience. │
235
+ │ │
236
+ │ Welcome back User! │
237
+ │ (Refer to readme.txt on how to change your profile) │
238
+ └────────────────────────────────────────────────────────────┘
239
+ ? What would you like to scan?
240
+ Sitemap
241
+ Website
242
+ ❯ Custom
243
+ ```
244
+
245
+ 1. Specify the URL of the starting page you wish to scan
246
+ 2. A Chrome window will appear. Navigate through the pages and click on the **Scan this page** button at the top right of the broswer's page to conduct an accessibility scan on the current page.
247
+ 3. You may drag the top black bar to the bottom of the page in the event it prevents you from viewing / blocking certain page elements.
248
+ 4. Close the Chrome window to end the scan.
249
+
250
+ Other options:
251
+
252
+ - You can specify sites to exclude from accessibility scan (e.g. login page) by adding a pattern of the domain to `exclusions.txt`. An example of `exclusions.txt`:
253
+
254
+ ```txt
255
+ \.*login.singpass.gov.sg\.*
256
+ ```
257
+
258
+ #### Known Issues
259
+
260
+ If the custom flow fails to start, you might be running multiple versions of Playwright. Re-install Playwright:
261
+
262
+ 1. On Windows, delete the folder `%USERPROFILE%\AppData\Local\ms-playwright` where `%USERPROFILE%` is typically located at `C:\Users\<username>`.
263
+ 2. On MacOS, delete the folder `~/Library/Caches/ms-playwright` where `~` refers to `/Users/<username>`.
264
+ 3. Within PowerShell (Windows) or Terminal (MacOS) app, run the following two commands to re-install Playwright:
265
+
266
+ ```Shell
267
+ npx playwright@1.27.1 install
268
+ ```
269
+
270
+ ### CLI Mode
271
+
272
+ CLI mode is designed to be run in continuous integration (CI) environment.
273
+ Run `npm run cli` for a set of command-line parameters available.
274
+
275
+ ```shell
276
+ Usage: npm run cli -- -c <crawler> -d <device> -w <view
277
+ port> -u <url> OPTIONS
278
+
279
+ Options:
280
+ --help Show help [boolean]
281
+ -c, --scanner Type of scan, 1) sitemap, 2) website crawl,
282
+ 3) custom flow, 4) intelligent
283
+ elligent
284
+ [required] [choices: "sitemap", "website", "custom", "intelligent"]
285
+ -u, --url Website URL you want to scan
286
+ [string] [required]
287
+ -d, --customDevice Device you want to scan [string]
288
+ -w, --viewportWidth Viewport width (in pixels) you want to scan
289
+ [number]
290
+ -o, --zip Zip filename to save results [string]
291
+ -p, --maxpages Maximum number of pages to scan (default: 1
292
+ 00). Only available in website and sitemap
293
+ scans [number]
294
+ -f, --safeMode Disable dynamically clicking of page button
295
+ s and links to find links, which resolve is
296
+ sues on some websites. [yes / no]
297
+ [string] [default: "no"]
298
+ -h, --headless Run the scan in headless mode. [yes / no]
299
+ [string] [default: "yes"]
300
+ -b, --browserToRun Browser to run the scan on: 1) Chromium, 2)
301
+ Chrome, 3) Edge. Defaults to Chromium.
302
+ [choices: "chromium", "chrome", "edge"] [default: "chrome"]
303
+ -s, --strategy Crawls up to general (same parent) domains,
304
+ or only specific hostname. Defaults to "sa
305
+ me-domain".
306
+ [choices: "same-domain", "same-hostname"]
307
+ -e, --exportDirectory Preferred directory to store scan results.
308
+ Path is relative to your home directory.
309
+ [string]
310
+ -j, --customFlowLabel Give Custom Flow Scan a label for easier re
311
+ ference in the report [string]
312
+ -k, --nameEmail To personalise your experience, we will be
313
+ collecting your name, email address and app
314
+ usage data. Your information fully complie
315
+ s with GovTech’s Privacy Policy. Please pro
316
+ vide your name and email address in this fo
317
+ rmat "John Doe:john@domain.com".
318
+ [string] [required]
319
+ -t, --specifiedMaxConcurrency Maximum number of pages to scan concurrentl
320
+ y. Use for sites with throttling. Defaults
321
+ to 25. [number]
322
+ -i, --fileTypes File types to include in the scan. Defaults
323
+ to html-only.
324
+ [string] [choices: "all", "pdf-only", "html-only"] [default: "html-only"]
325
+ -x, --blacklistedPatternsFilename Txt file that has a list of pattern of doma
326
+ ins to exclude from accessibility scan sepa
327
+ rated by new line
328
+ [string] [default: "exclusions.txt"]
329
+ -a, --additional Additional features to include in the repor
330
+ t:
331
+ screenshots - Include element screensho
332
+ ts in the generated report
333
+ none - Exclude
334
+ all additional features in the generated re
335
+ port
336
+ [string] [choices: "screenshots", "none"] [default: "screenshots"]
337
+ -q, --metadata Json string that contains additional scan m
338
+ etadata for telemetry purposes. Defaults to
339
+ "{}" [string] [default: "{}"]
340
+ -r, --followRobots Crawler adheres to robots.txt rules if it e
341
+ xists. [yes / no] [string] [default: "no"]
342
+ -m, --header The HTTP authentication header keys and the
343
+ ir respective values to enable crawler acce
344
+ ss to restricted resources. [string]
345
+ -y, --ruleset Specify scan ruleset for accessibility chec
346
+ ks
347
+ [string] [choices: "default", "disable-oobee", "enable-wcag-aaa", "disable-oob
348
+ ee,enable-wcag-aaa"] [default: "default"]
349
+
350
+ Examples:
351
+ To scan sitemap of website:', 'npm run cli -- -c [ 1 | sitemap ] -u <url_lin
352
+ k> [ -d <device> | -w <viewport_width> ]
353
+ To scan a website', 'npm run cli -- -c [ 2 | website ] -u <url_link> [ -d <d
354
+ evice> | -w <viewport_width> ]
355
+ To start a custom flow scan', 'npm run cli -- -c [ 3 | custom ] -u <url_link
356
+ > [ -d <device> | -w <viewport_width> ]
357
+
358
+ ```
359
+
360
+ ### Device Options
361
+
362
+ <details>
363
+ <summary>Click here for list of device options supported</summary>
364
+
365
+ - "Desktop" (defaults to a 1280x720 viewport)
366
+ - "Mobile" (defaults to iPhone 11 viewport)
367
+ - "Desktop Chrome HiDPI"
368
+ - "Desktop Edge HiDPI"
369
+ - "Desktop Firefox HiDPI"
370
+ - "Desktop Safari"
371
+ - "Desktop Chrome"
372
+ - "Desktop Edge"
373
+ - "Desktop Firefox"
374
+ - "Blackberry PlayBook"
375
+ - "Blackberry PlayBook landscape"
376
+ - "BlackBerry Z30"
377
+ - "BlackBerry Z30 landscape"
378
+ - "Galaxy Note 3"
379
+ - "Galaxy Note 3 landscape"
380
+ - "Galaxy Note II"
381
+ - "Galaxy Note II landscape"
382
+ - "Galaxy S III"
383
+ - "Galaxy S III landscape"
384
+ - "Galaxy S5"
385
+ - "Galaxy S5 landscape"
386
+ - "Galaxy S8"
387
+ - "Galaxy S8 landscape"
388
+ - "Galaxy S9+"
389
+ - "Galaxy S9+ landscape"
390
+ - "Galaxy Tab S4"
391
+ - "Galaxy Tab S4 landscape"
392
+ - "iPad (gen 6)"
393
+ - "iPad (gen 6) landscape"
394
+ - "iPad (gen 7)"
395
+ - "iPad (gen 7) landscape"
396
+ - "iPad Mini"
397
+ - "iPad Mini landscape"
398
+ - "iPad Pro 11"
399
+ - "iPad Pro 11 landscape"
400
+ - "iPhone 6"
401
+ - "iPhone 6 landscape"
402
+ - "iPhone 6 Plus"
403
+ - "iPhone 6 Plus landscape"
404
+ - "iPhone 7"
405
+ - "iPhone 7 landscape"
406
+ - "iPhone 7 Plus"
407
+ - "iPhone 7 Plus landscape"
408
+ - "iPhone 8"
409
+ - "iPhone 8 landscape"
410
+ - "iPhone 8 Plus"
411
+ - "iPhone 8 Plus landscape"
412
+ - "iPhone SE"
413
+ - "iPhone SE landscape"
414
+ - "iPhone X"
415
+ - "iPhone X landscape"
416
+ - "iPhone XR"
417
+ - "iPhone XR landscape"
418
+ - "iPhone 11"
419
+ - "iPhone 11 landscape"
420
+ - "iPhone 11 Pro"
421
+ - "iPhone 11 Pro landscape"
422
+ - "iPhone 11 Pro Max"
423
+ - "iPhone 11 Pro Max landscape"
424
+ - "iPhone 12"
425
+ - "iPhone 12 landscape"
426
+ - "iPhone 12 Pro"
427
+ - "iPhone 12 Pro landscape"
428
+ - "iPhone 12 Pro Max"
429
+ - "iPhone 12 Pro Max landscape"
430
+ - "iPhone 12 Mini"
431
+ - "iPhone 12 Mini landscape"
432
+ - "iPhone 13"
433
+ - "iPhone 13 landscape"
434
+ - "iPhone 13 Pro"
435
+ - "iPhone 13 Pro landscape"
436
+ - "iPhone 13 Pro Max"
437
+ - "iPhone 13 Pro Max landscape"
438
+ - "iPhone 13 Mini"
439
+ - "iPhone 13 Mini landscape"
440
+ - "Kindle Fire HDX"
441
+ - "Kindle Fire HDX landscape"
442
+ - "LG Optimus L70"
443
+ - "LG Optimus L70 landscape"
444
+ - "Microsoft Lumia 550"
445
+ - "Microsoft Lumia 550 landscape"
446
+ - "Microsoft Lumia 950"
447
+ - "Microsoft Lumia 950 landscape"
448
+ - "Nexus 10"
449
+ - "Nexus 10 landscape"
450
+ - "Nexus 4"
451
+ - "Nexus 4 landscape"
452
+ - "Nexus 5"
453
+ - "Nexus 5 landscape"
454
+ - "Nexus 5X"
455
+ - "Nexus 5X landscape"
456
+ - "Nexus 6"
457
+ - "Nexus 6 landscape"
458
+ - "Nexus 6P"
459
+ - "Nexus 6P landscape"
460
+ - "Nexus 7"
461
+ - "Nexus 7 landscape"
462
+ - "Nokia Lumia 520"
463
+ - "Nokia Lumia 520 landscape"
464
+ - "Nokia N9"
465
+ - "Nokia N9 landscape"
466
+ - "Pixel 2"
467
+ - "Pixel 2 landscape"
468
+ - "Pixel 2 XL"
469
+ - "Pixel 2 XL landscape"
470
+ - "Pixel 3"
471
+ - "Pixel 3 landscape"
472
+ - "Pixel 4"
473
+ - "Pixel 4 landscape"
474
+ - "Pixel 4a (5G)"
475
+ - "Pixel 4a (5G) landscape"
476
+ - "Pixel 5"
477
+ - "Pixel 5 landscape"
478
+ - "Moto G4"
479
+ - "Moto G4 landscape"
480
+
481
+ </details>
482
+
483
+ If the device name contains `(` and `)`, wrap the device name in single quotes when entered into the CLI.
484
+ Please note that `-d` and `-w` are mutually exclusive. If none are specified, the default device used for the CLI scan is Desktop.
485
+
486
+ For example, to conduct a website scan to the URL "http://localhost:8000" and write to "oobee-scan-results.zip" with an 'iPad (gen 7) landscape' screen, run
487
+
488
+ ```shell
489
+ npm run cli -- -c 2 -o oobee-scan-results.zip -u http://localhost:8000 -d 'iPad (gen 7) landscape'
490
+ ```
491
+
492
+ If the site you want to scan has a query string wrap the link in single quotes when entered into the CLI.
493
+
494
+ For example, to conduct a website scan to the URL "http://localhost:8000" and write to "oobee-scan-results.zip" with a custom screen width '360', run
495
+
496
+ ```shell
497
+ npm run cli -- -c 2 -o oobee-scan-results.zip -u "http://localhost:8000" -w 360
498
+ ```
499
+
500
+ ## Report
501
+
502
+ Once a scan of the site is completed.
503
+
504
+ A report will be downloaded into the current working directory.
505
+
506
+ ## Accessibility Scan Results
507
+
508
+ Each Issue has its own severity "Must Fix" / "Good to Fix" based on the [WCAG 2.2 Conformance](https://www.w3.org/TR/WCAG22/).
509
+
510
+ For details on which accessibility scan results triggers a "Must Fix" / "Good to Fix" findings, you may refer to [Scan Issue Details](./DETAILS.md).
511
+
512
+ ## Troubleshooting
513
+
514
+ Please refer to the information below to assist in debugging. Most errors below are due to the switching between Node.js versions.
515
+
516
+ ### Incompatible Node.js versions
517
+
518
+ **Issue**: When your Node.js version is incompatible, you may face the following syntax error.
519
+
520
+ ```shell
521
+ const URL_NO_COMMAS_REGEX = RegExp('https?://(www\\.)?[\\p{L}0-9][-\\p{L}0-9@:%._\\+~#=]{0,254}[\\p{L}0-9]\\.[a-z]{2,63}(:\\d{1,5})?(/[-\\p{L}0-9@:%_\\+.~#?&//=\\(\\)]*)?', 'giu'); // eslint-disable-line
522
+ ^
523
+ SyntaxError: Invalid regular expression: /https?://(www\.)?[\p{L}0-9][-\p{L}0-9@:%\._\+~#=]{0,254}[\p{L}0-9]\.[a-z]{2,63}(:\d{1,5})?(/[-\p{L}0-9@:%_\+.~#?&//=\(\)]*)?/: Invalid escape
524
+ ```
525
+
526
+ **Solution**: Install Node.js versions >= 20, i.e. Node.js v20 and above.
527
+
528
+ ### Compiled against a different Node.js version
529
+
530
+ **Issue**: When you switch between different versions of Node.js in your environment, you may face the following error.
531
+
532
+ ```shell
533
+ <user_path>/oobee/node_modules/bindings/bindings.js:91
534
+ throw e
535
+ ^
536
+
537
+ Error: The module '<module_file_path>'
538
+ was compiled against a different Node.js version using
539
+ NODE_MODULE_VERSION 57. This version of Node.js requires
540
+ NODE_MODULE_VERSION 88. Please try re-compiling or re-installing
541
+ the module (for instance, using `npm rebuild` or `npm install`).
542
+ ```
543
+
544
+ **Solution**: As recommended in the error message, run `npm rebuild` or `npm install`
545
+
546
+ ### dyld Error
547
+
548
+ **Issue**: Not able to run Oobee due to the following error shown below
549
+
550
+ ```shell
551
+ dyld: lazy symbol binding failed: Symbol not found: __ZN2v87Isolate37AdjustAmountOfExternalAllocatedMemoryEx
552
+ Referenced from: <user_path>/oobee/node_modules/libxmljs/build/Release/xmljs.node
553
+ Expected in: flat namespace
554
+
555
+ dyld: Symbol not found: __ZN2v87Isolate37AdjustAmountOfExternalAllocatedMemoryEx
556
+ Referenced from: <user_path>/PURPLE_A11y/oobee/node_modules/libxmljs/build/Release/xmljs.node
557
+ Expected in: flat namespace
558
+
559
+ zsh: abort node index.js
560
+ ```
561
+
562
+ **Solutions**:
563
+
564
+ 1. Delete existing `node_modules` folder and re-install the NPM packages with `npm install`.
565
+ 2. Refer to this [GitHub issue](https://github.com/fsevents/fsevents/issues/313) for more alternative solutions
566
+
567
+ ### Element Screenshot Limitation
568
+
569
+ **Limitation**: Due to animations causing elements to shift out of the viewport after an Axe scan, there's a risk of element screenshots timing out within 5 seconds if the element is not found. This known issue is particularly prevalent in scenarios like carousels with interval-based transitions.
570
+
571
+ ## FAQ
572
+
573
+ ### How do I limit number of pages scanned?
574
+
575
+ If you find a scan takes too long to complete due to large website, or there are too many pages in a sitemap to scan, you may choose to limit number of pages scanned.
576
+
577
+ To do this, run CLI mode `npm run cli --` with the needed settings and specify `-p 10` where `10` is the number of pages you wish to scan.
578
+
579
+ ### I am a new developer and I have some knowledge gap.
580
+
581
+ We recommend looking at our **Technology Stack** to understand the usage of each component. Take your time to understand.
582
+
583
+ ## Additional Information on Data
584
+
585
+ Oobee uses third-party open-source tools that may be downloaded over the Internet during the installation process of Oobee. Users should be aware of the libraries used by examining `package.json`.
586
+
587
+ Oobee may send information to the website or URL where the user chooses to initiate a Oobee scan. Limited user information such as e-mail address, name, and basic analytics is collected for the purpose of knowing our usage patterns better.
package/SECURITY.md ADDED
@@ -0,0 +1,5 @@
1
+ ## Reporting a Vulnerability
2
+
3
+ If you believe you have found a security vulnerability in this project, we encourage you to let us know promptly. We appreciate your efforts to responsibly disclose your findings.
4
+
5
+ To report a security vulnerability, please visit the GovTech [Vulnerability Disclosure Programme](https://www.tech.gov.sg/report_vulnerability) page. Follow the instructions provided there to submit your report securely.