 Issue 29677659:
  Issue #6303 - Introduce basic foundation for automation in adblockplusui  (Closed)
    
  
    Issue 29677659:
  Issue #6303 - Introduce basic foundation for automation in adblockplusui  (Closed) 
  | Left: | ||
| Right: | 
| OLD | NEW | 
|---|---|
| 1 Shared Adblock Plus UI code | 1 Shared Adblock Plus UI code | 
| 2 =========================== | 2 =========================== | 
| 3 | 3 | 
| 4 The user interface elements defined in this repository will be used by various | 4 The user interface elements defined in this repository will be used by various | 
| 5 Adblock Plus products like Adblock Plus for Firefox. Their functionality can be | 5 Adblock Plus products like Adblock Plus for Firefox. Their functionality can be | 
| 6 tested within this repository, even though they might not work exactly the same | 6 tested within this repository, even though they might not work exactly the same | 
| 7 as they will do in the final product. | 7 as they will do in the final product. | 
| 8 | 8 | 
| 9 Installing dependencies | |
| 10 ----------------------- | |
| 11 | |
| 12 Both [python 2](https://www.python.org/downloads/) and [node](https://nodejs.org /en/), as well as [npm](https://www.npmjs.com), are required to contribute to th is repository. | |
| 
Thomas Greiner
2018/02/12 13:01:43
Suggestion: We don't have a coding style for Markd
 
a.giammarchi
2018/02/12 14:52:55
agreed but this has been already merged so I'll ke
 | |
| 13 | |
| 14 If you are installing `node` in ArchLinux, please remember to install `npm` too. | |
| 15 | |
| 16 After cloning this repository, enter into its folder and run: `npm install`. | |
| 17 | |
| 18 This should create and populate, both `./node_modules` folder and the `./buildto ols` one. | |
| 19 | |
| 9 Directory structure | 20 Directory structure | 
| 10 ------------------- | 21 ------------------- | 
| 11 | 22 | 
| 12 * Top-level files: | 23 * Top-level files: | 
| 13 * `firstRun.html` and `firstRun.js`: First-run page, see below | 24 * `firstRun.html` and `firstRun.js`: First-run page, see below | 
| 14 * `i18n.js`: Localization functions, should be included by all pages. | 25 * `i18n.js`: Localization functions, should be included by all pages. | 
| 15 * `messageResponder.js`: Script to be used on the background page to respond | 26 * `messageResponder.js`: Script to be used on the background page to respond | 
| 16 to messages sent by UI code. | 27 to messages sent by UI code. | 
| 17 * `background.html`, `background.js`: Test implementation of the background | 28 * `background.html`, `background.js`: Test implementation of the background | 
| 18 page, should *not be imported*. | 29 page, should *not be imported*. | 
| (...skipping 11 matching lines...) Expand all Loading... | |
| 30 * `ext` directory: Test implementation of the abstraction layer. This one should | 41 * `ext` directory: Test implementation of the abstraction layer. This one should | 
| 31 *not to be imported*, these files should rather be replaced by | 42 *not to be imported*, these files should rather be replaced by | 
| 32 product-specific versions providing the same interface. | 43 product-specific versions providing the same interface. | 
| 33 | 44 | 
| 34 Testing | 45 Testing | 
| 35 ------- | 46 ------- | 
| 36 | 47 | 
| 37 In Firefox the HTML pages can be opened directly from the file system | 48 In Firefox the HTML pages can be opened directly from the file system | 
| 38 and should be fully functional. Due to security restrictions in Chrome, there | 49 and should be fully functional. Due to security restrictions in Chrome, there | 
| 39 you need to pass in the `--allow-file-access-from-files` command line flag when | 50 you need to pass in the `--allow-file-access-from-files` command line flag when | 
| 40 starting the application. Alternatively, you can run `test_server.py` (requires | 51 starting the application. Alternatively, you can run `npm start` and open | 
| 41 Python 2.7) and open the HTML pages under URLs like | 52 the HTML pages under URL shown shown in the terminal (example: http://127.0.0.1: 8080). | 
| 42 `http://127.0.0.1:5000/firstRun.html`. | |
| 43 | 53 | 
| 44 Various aspects of the pages can be tested by setting parameters in the URL. The | 54 You can pass along to underlying [http-server](https://www.npmjs.com/package/htt p-server) | 
| 45 only universal parameter is `locale`, e.g. `?locale=es-AR`. This parameter | 55 program any arguments via `--` as in: | 
| 56 ```sh | |
| 57 npm start -- -p 5000 -c-1 | |
| 58 ``` | |
| 59 | |
| 60 Various aspects of the pages can be tested by setting parameters in the URL. | |
| 61 The only universal parameter is `locale`, e.g. `?locale=es-AR`. This parameter | |
| 46 overrides browser's locale which will be used by default. | 62 overrides browser's locale which will be used by default. | 
| 47 | 63 | 
| 64 Linting | |
| 65 ------- | |
| 66 | |
| 67 You can lint all options via `npm run lint`. | |
| 68 | |
| 69 You can also run specific target linting via `npm run lint:js` or, once availabl e, via `npm run lint:css`. | |
| 70 | |
| 71 Remember, both `eslint` and `stylelint` can help fixing issues via `--fix` flag. | |
| 72 | |
| 73 You can try as example via [npx](https://medium.com/@maybekatz/introducing-npx-a n-npm-package-runner-55f7d4bd282b) | |
| 74 which should be provided automatically when you install `npm`. | |
| 75 | |
| 76 ```sh | |
| 77 npx stylelint --fix skin/real-file-name.css | |
| 78 ``` | |
| 79 | |
| 48 Translations | 80 Translations | 
| 49 ------------ | 81 ------------ | 
| 50 | 82 | 
| 51 Translations for the strings in this project are managed using the online | 83 Translations for the strings in this project are managed using the online | 
| 52 [Crowdin platform][crowdin]. To synchronise with Crowdin you can use the build | 84 [Crowdin platform][crowdin]. To synchronise with Crowdin you can use the build | 
| 53 script. To get a list of the possible commands type `./build.py help` at | 85 script. To get a list of the possible commands type `./build.py help` at | 
| 54 the command line. (You will also need the Crowdin API key for the project.) | 86 the command line. (You will also need the Crowdin API key for the project.) | 
| 55 | 87 | 
| 56 firstRun.html | 88 firstRun.html | 
| 57 ------------- | 89 ------------- | 
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 errors when adding new filters on the options page | 133 errors when adding new filters on the options page | 
| 102 * `blockedURLs`: a comma-separated list of URLs that should be considered | 134 * `blockedURLs`: a comma-separated list of URLs that should be considered | 
| 103 blocked (necessary to test the check for blocked scripts in sharing buttons). | 135 blocked (necessary to test the check for blocked scripts in sharing buttons). | 
| 104 * `downloadStatus`: sets downloadStatus parameter for filter lists, can be used | 136 * `downloadStatus`: sets downloadStatus parameter for filter lists, can be used | 
| 105 to trigger various filter list download errors | 137 to trigger various filter list download errors | 
| 106 * `platform=chromium`: shows the opt-out for the developer tools panel | 138 * `platform=chromium`: shows the opt-out for the developer tools panel | 
| 107 * `showNotificationUI=true`: simulates user having opted-out of notifications | 139 * `showNotificationUI=true`: simulates user having opted-out of notifications | 
| 108 | 140 | 
| 109 | 141 | 
| 110 [crowdin]: https://crowdin.com | 142 [crowdin]: https://crowdin.com | 
| 111 | |
| 112 Linting | |
| 113 ------- | |
| 114 | |
| 115 You can lint the code using [ESLint](http://eslint.org). | |
| 116 | |
| 117 eslint *.js lib ext | |
| 118 | |
| 119 You will need to set up ESLint and our configuration first, see | |
| 120 [eslint-config-eyeo](https://hg.adblockplus.org/codingtools/file/tip/eslint-conf ig-eyeo) | |
| 121 for more information. | |
| OLD | NEW |