@sowell/quasar-app-extension-auth 0.2.0 → 0.2.4
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.
- package/.eslintignore +4 -0
- package/.eslintrc.js +13 -13
- package/.gitattributes +2 -0
- package/.github/workflows/main.yml +22 -0
- package/README.md +378 -10
- package/package.json +35 -19
- package/src/assets/Logo.svg +6 -0
- package/src/boot/axios.ts +17 -0
- package/src/boot/register.ts +8 -0
- package/src/boot/router-guards.ts +25 -0
- package/src/boot/router.ts +20 -0
- package/src/boot/store.ts +10 -0
- package/src/components/pages/Auth.vue +265 -0
- package/src/components/pages/ResetPassword.vue +123 -0
- package/src/i18n/en-US/index.ts +24 -0
- package/src/i18n/fr-FR/index.ts +24 -0
- package/src/i18n/index.ts +7 -0
- package/src/index.js +29 -25
- package/src/injects/api.ts +10 -0
- package/src/injects/index.ts +4 -0
- package/src/injects/prompts.ts +25 -0
- package/src/injects/router.ts +10 -0
- package/src/injects/store.ts +10 -0
- package/src/interfaces/Boot.ts +8 -0
- package/src/interfaces/TokenStateInterface.ts +11 -0
- package/src/interfaces/index.ts +2 -0
- package/src/prompts.js +42 -38
- package/src/routes/index.ts +23 -0
- package/src/shims-vue.d.ts +6 -0
- package/src/store/index.ts +66 -0
- package/tsconfig.json +14 -0
- package/.github/workflows/publish.yml +0 -22
- package/.prettierrc +0 -7
- package/.vscode/extensions.json +0 -12
- package/.vscode/settings.json +0 -22
- package/jsconfig.json +0 -7
- package/package-lock.json +0 -2344
- package/src/boot/axios.js +0 -17
- package/src/boot/navigation-guards.js +0 -16
- package/src/boot/register.js +0 -45
- package/src/components/Auth.vue +0 -279
- package/src/components/ResetCode.vue +0 -140
- package/src/components/ResetPassword.vue +0 -139
- package/src/components/prompt.js +0 -40
- package/src/config/setupHeaders.js +0 -6
- package/src/install.js +0 -10
- package/src/templates/.gitkeep +0 -0
- package/src/uninstall.js +0 -10
package/.eslintignore
ADDED
package/.eslintrc.js
CHANGED
|
@@ -5,23 +5,23 @@ module.exports = {
|
|
|
5
5
|
es2021: true
|
|
6
6
|
},
|
|
7
7
|
extends: [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
'eslint:recommended',
|
|
9
|
+
'plugin:vue/vue3-strongly-recommended',
|
|
10
|
+
'prettier'
|
|
11
11
|
],
|
|
12
12
|
parserOptions: {
|
|
13
|
-
parser:
|
|
13
|
+
parser: '@typescript-eslint/parser',
|
|
14
14
|
ecmaVersion: 2018,
|
|
15
|
-
sourceType:
|
|
15
|
+
sourceType: 'module'
|
|
16
16
|
},
|
|
17
|
-
plugins: [
|
|
17
|
+
plugins: ['vue'],
|
|
18
18
|
rules: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
{ anonymous:
|
|
19
|
+
'comma-dangle': ['error', 'only-multiline'],
|
|
20
|
+
'space-before-function-paren': [
|
|
21
|
+
'error',
|
|
22
|
+
{ anonymous: 'always', named: 'never', asyncArrow: 'always' }
|
|
23
23
|
],
|
|
24
|
-
semi:
|
|
25
|
-
|
|
24
|
+
semi: 'off',
|
|
25
|
+
'no-unreachable': 'off'
|
|
26
26
|
}
|
|
27
|
-
}
|
|
27
|
+
};
|
package/.gitattributes
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: Cypress Tests
|
|
2
|
+
|
|
3
|
+
on: [push]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
cypress-run:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
- name: Checkout
|
|
10
|
+
uses: actions/checkout@v2
|
|
11
|
+
- name: Nodejs
|
|
12
|
+
uses: actions/setup-node@v2
|
|
13
|
+
with:
|
|
14
|
+
node-version: '14'
|
|
15
|
+
cache: yarn
|
|
16
|
+
- run: yarn install
|
|
17
|
+
- run: yarn dep
|
|
18
|
+
- name: Cypress run
|
|
19
|
+
uses: cypress-io/github-action@v2
|
|
20
|
+
with:
|
|
21
|
+
working-directory: dev
|
|
22
|
+
command: yarn test
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
# Install
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
quasar ext add
|
|
11
|
+
quasar ext add mamy-auth
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
Quasar CLI will retrieve it from NPM and install the extension.
|
|
@@ -78,7 +78,7 @@ The default is auth/getInfosUser and return email or phone number
|
|
|
78
78
|
# Uninstall
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
quasar ext remove
|
|
81
|
+
quasar ext remove mamy-auth
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
# Info
|
|
@@ -108,11 +108,6 @@ In auth mutation:
|
|
|
108
108
|
|
|
109
109
|
export function clearToken(state) {
|
|
110
110
|
state.token = null
|
|
111
|
-
state.emailOrPhoneNumber = null
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export function setInfosUser(state, payload) {
|
|
115
|
-
state.emailOrPhoneNumber = payload
|
|
116
111
|
}
|
|
117
112
|
|
|
118
113
|
In auth getter:
|
|
@@ -121,9 +116,382 @@ In auth getter:
|
|
|
121
116
|
return state.token
|
|
122
117
|
}
|
|
123
118
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
119
|
+
# Parent Application (UI)
|
|
120
|
+
|
|
121
|
+
A Quasar Framework app for Auth Extension
|
|
122
|
+
|
|
123
|
+
## Install the dependencies
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
yarn dep
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Start the app in development mode (hot-code reloading, error reporting, etc.)
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
yarn dev
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Lint the files
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
yarn lint
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Launch test with Cypress Studio
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
yarn test:e2e
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Launch test with Cypress mode CI (Continuous Integration )
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
yarn test:e2e:ci
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Customize the configuration
|
|
154
|
+
|
|
155
|
+
See dev/[Configuring quasar.conf.js](https://v2.quasar.dev/quasar-cli/quasar-conf-js).
|
|
156
|
+
|
|
157
|
+
# Info
|
|
158
|
+
|
|
159
|
+
Cypress automatically after being launched.
|
|
160
|
+
|
|
161
|
+
# Usage
|
|
162
|
+
|
|
163
|
+
## For Cypress Studio
|
|
164
|
+
|
|
165
|
+
Launch test E2E mode and select your test file
|
|
166
|
+
|
|
167
|
+
## For Cypress Continuous Integration mode
|
|
168
|
+
|
|
169
|
+
Launch test E2E with Continuous integration mode and cypress test all file in directory:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
/test/cypress/integration/
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
# netlify-plugin-cypress
|
|
176
|
+
[](https://circleci.com/gh/cypress-io/netlify-plugin-cypress/tree/master) [![renovate-app badge][renovate-badge]][renovate-app] [](https://dashboard.cypress.io/projects/ixroqc/runs) [](https://app.netlify.com/sites/sad-lumiere-6a00a5/deploys)
|
|
177
|
+
> Runs Cypress end-to-end tests on Netlify Build
|
|
178
|
+
## Install and use
|
|
179
|
+
|
|
180
|
+
You can install this plugin in the Netlify UI from this [direct in-app installation link](https://app.netlify.com/plugins/netlify-plugin-cypress/install) or from the [Plugins directory](https://app.netlify.com/plugins).
|
|
181
|
+
|
|
182
|
+
For file based installation, add `netlify-plugin-cypress` NPM package as a dev dependency to your repository.
|
|
183
|
+
|
|
184
|
+
```shell
|
|
185
|
+
npm install --save-dev netlify-plugin-cypress
|
|
186
|
+
# or
|
|
187
|
+
yarn add -D netlify-plugin-cypress
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
And then add the plugin's name to the list of build plugins in `netlify.toml` file as shown in the examples below.
|
|
191
|
+
|
|
192
|
+
*note:* this plugin assumes you have already installed Cypress as a dev NPM dependency.
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
## How does it work
|
|
196
|
+
|
|
197
|
+
### Build steps
|
|
198
|
+
|
|
199
|
+
When Netlify Build system runs it performs 2 steps essentially:
|
|
200
|
+
|
|
201
|
+
1. builds the site
|
|
202
|
+
2. deploys the site
|
|
203
|
+
|
|
204
|
+
Every plugin that wants to perform some actions can do so before the build, after the build (but before the deploy), and after the deploy. The Netlify uses the following names for these events
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
"preBuild"
|
|
208
|
+
1. builds the site
|
|
209
|
+
"postBuild"
|
|
210
|
+
2. deploys the site
|
|
211
|
+
"onSuccess"
|
|
212
|
+
"onFailure"
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Thus every plugin can register itself to be executed before a site is built using "preBuild" event, or after a successful deploy using "onSuccess" event name, etc.
|
|
216
|
+
|
|
217
|
+
### This plugin
|
|
218
|
+
|
|
219
|
+
This plugin `netlify-plugin-cypress` by default runs during the "onSuccess" event, testing the deployed site. The Netlify Build system gives the URL to the plugin and it runs Cypress against that URL using the [Cypress NPM module API](https://on.cypress.io/module-api).
|
|
220
|
+
|
|
221
|
+
Optionally, you can also run tests during "preBuild" and "postBuild" steps. This is useful if you want to ensure the site is working even before deploying it to Netlify servers. Finally, this plugin does not use "onFailure" event which happens only if Netlify fails to deploy the site.
|
|
222
|
+
|
|
223
|
+
### Failing the deploy
|
|
224
|
+
|
|
225
|
+
Running Cypress tests by default uses the "onSuccess" step of the build pipeline. By this point Netlify has already deployed the site. Even if the tests fail now, the Netlify shows the successful deployment - the site is live! To really prevent the broken deploys, we suggest using [Cypress GitHub / GitLab / Bitbucket integration](https://on.cypress.io/github-integration) to fail the _status checks_ on a pull request.
|
|
226
|
+
|
|
227
|
+
We also suggest running tests during the "preBuild" and/or "postBuild" steps. If the tests fail during these steps, the Netlify fails the entire build and does not deploy the broken site.
|
|
228
|
+
|
|
229
|
+
Finally, you can set up [Slack notifications](https://on.cypress.io/slack-integration) on failed tests against the deployed site. At least you will quickly find out if the deployed site fails the E2E tests and would be able to roll back the deploy.
|
|
230
|
+
|
|
231
|
+
## Examples
|
|
232
|
+
|
|
233
|
+
### basic
|
|
234
|
+
|
|
235
|
+
Here is the most basic [Netlify config file](https://docs.netlify.com/configure-builds/file-based-configuration/) `netlify.toml` with just the Cypress plugin
|
|
236
|
+
|
|
237
|
+
```toml
|
|
238
|
+
[[plugins]]
|
|
239
|
+
# runs Cypress tests against the deployed URL
|
|
240
|
+
package = "netlify-plugin-cypress"
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### tutorial
|
|
244
|
+
|
|
245
|
+
Read the full tutorial at [Test Sites Deployed To Netlify Using netlify-plugin-cypress](https://glebbahmutov.com/blog/test-netlify/).
|
|
246
|
+
|
|
247
|
+
**Note:** if any tests against the deployed URL fail, the Netlify build still considers it a success. Thus if you want to have a test check against the deploy, install [Cypress GitHub App](https://on.cypress.io/github-integration). The app will provide its own failing status check in this case.
|
|
248
|
+
|
|
249
|
+
### options
|
|
250
|
+
|
|
251
|
+
You can control the browser, the specs to run, record tests on Cypress Dashboard, etc, see [manifest.yml](./manifest.yml) file.
|
|
252
|
+
|
|
253
|
+
### recording
|
|
254
|
+
|
|
255
|
+
To record test results and artifacts on Cypress Dashboard, set `record: true` plugin input and set `CYPRESS_RECORD_KEY` as an environment variable via Netlify Deploy settings.
|
|
256
|
+
|
|
257
|
+
```yaml
|
|
258
|
+
[build]
|
|
259
|
+
command = "npm run build"
|
|
260
|
+
publish = "build"
|
|
261
|
+
[build.environment]
|
|
262
|
+
# cache Cypress binary in local "node_modules" folder
|
|
263
|
+
# so Netlify caches it
|
|
264
|
+
CYPRESS_CACHE_FOLDER = "./node_modules/CypressBinary"
|
|
265
|
+
# set TERM variable for terminal output
|
|
266
|
+
TERM = "xterm"
|
|
267
|
+
[[plugins]]
|
|
268
|
+
# runs Cypress tests against the deployed URL
|
|
269
|
+
package = "netlify-plugin-cypress"
|
|
270
|
+
[plugins.inputs]
|
|
271
|
+
record = true
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
See [cypress-example-kitchensink](https://github.com/cypress-io/cypress-example-kitchensink) and recorded results at Cypress Dashboard [](https://dashboard.cypress.io/projects/ixroqc/runs)
|
|
275
|
+
|
|
276
|
+
**Security note 🔐:** you should keep your `CYPRESS_RECORD_KEY` secret. You can control how Netlify builds external pull requests, see [the doc](https://docs.netlify.com/configure-builds/environment-variables/) - you never want to expose sensitive environment variables to outside builds.
|
|
277
|
+
|
|
278
|
+
#### status checks
|
|
279
|
+
|
|
280
|
+
If you are recording test results to Cypress Dashboard, you should also install [Cypress GitHub Integration App](https://on.cypress.io/github-integration) to see status checks from individual groups or from individual specs per commit. See [netlify-plugin-prebuild-example PR #8](https://github.com/cypress-io/netlify-plugin-prebuild-example/pull/8) pull request for an example.
|
|
281
|
+
|
|
282
|
+

|
|
283
|
+
|
|
284
|
+
#### group
|
|
285
|
+
|
|
286
|
+
You can change the group name for the recorded run using `group` parameter
|
|
287
|
+
|
|
288
|
+
```toml
|
|
289
|
+
[[plugins]]
|
|
290
|
+
# runs Cypress tests against the deployed URL
|
|
291
|
+
package = "netlify-plugin-cypress"
|
|
292
|
+
[plugins.inputs]
|
|
293
|
+
record = true
|
|
294
|
+
group = "built site"
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
#### tag
|
|
298
|
+
|
|
299
|
+
You can give recorded run [tags](https://on.cypress.io/module-api#cypress-run) using a comma-separated string. If the tag is not specified, Netlify context will be used (`production`, `deploy-preview` or `branch-deploy`)
|
|
300
|
+
|
|
301
|
+
```toml
|
|
302
|
+
[[plugins]]
|
|
303
|
+
# runs Cypress tests against the deployed URL
|
|
304
|
+
package = "netlify-plugin-cypress"
|
|
305
|
+
[plugins.inputs]
|
|
306
|
+
record = true
|
|
307
|
+
group = "built site"
|
|
308
|
+
tag = "nightly,production"
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### spec
|
|
312
|
+
|
|
313
|
+
Run only a single spec or specs matching a wildcard
|
|
314
|
+
|
|
315
|
+
```toml
|
|
316
|
+
[build]
|
|
317
|
+
command = "npm run build"
|
|
318
|
+
publish = "build"
|
|
319
|
+
[build.environment]
|
|
320
|
+
# cache Cypress binary in local "node_modules" folder
|
|
321
|
+
# so Netlify caches it
|
|
322
|
+
CYPRESS_CACHE_FOLDER = "./node_modules/CypressBinary"
|
|
323
|
+
# set TERM variable for terminal output
|
|
324
|
+
TERM = "xterm"
|
|
325
|
+
[[plugins]]
|
|
326
|
+
# runs Cypress tests against the deployed URL
|
|
327
|
+
package = "netlify-plugin-cypress"
|
|
328
|
+
[plugins.inputs]
|
|
329
|
+
spec = "cypress/integration/smoke*.js"
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
See [cypress-example-kitchensink](https://github.com/cypress-io/cypress-example-kitchensink) for instance.
|
|
333
|
+
|
|
334
|
+
### browser
|
|
335
|
+
|
|
336
|
+
By default all tests run using the Chromium browser. If you want to use Electron:
|
|
337
|
+
|
|
338
|
+
```toml
|
|
339
|
+
[build]
|
|
340
|
+
command = "npm run build"
|
|
341
|
+
publish = "build"
|
|
342
|
+
[build.environment]
|
|
343
|
+
# cache Cypress binary in local "node_modules" folder
|
|
344
|
+
# so Netlify caches it
|
|
345
|
+
CYPRESS_CACHE_FOLDER = "./node_modules/CypressBinary"
|
|
346
|
+
# set TERM variable for terminal output
|
|
347
|
+
TERM = "xterm"
|
|
348
|
+
[[plugins]]
|
|
349
|
+
package = "netlify-plugin-cypress"
|
|
350
|
+
[plugins.inputs]
|
|
351
|
+
# allowed values: electron, chromium
|
|
352
|
+
browser = "electron"
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### configFile
|
|
356
|
+
|
|
357
|
+
If you would like to use a different Cypress config file instead of `cypress.json`, specify it using the `configFile` option
|
|
358
|
+
|
|
359
|
+
```toml
|
|
360
|
+
[build]
|
|
361
|
+
command = "npm run build"
|
|
362
|
+
publish = "build"
|
|
363
|
+
[build.environment]
|
|
364
|
+
# cache Cypress binary in local "node_modules" folder
|
|
365
|
+
# so Netlify caches it
|
|
366
|
+
CYPRESS_CACHE_FOLDER = "./node_modules/CypressBinary"
|
|
367
|
+
# set TERM variable for terminal output
|
|
368
|
+
TERM = "xterm"
|
|
369
|
+
[[plugins]]
|
|
370
|
+
package = "netlify-plugin-cypress"
|
|
371
|
+
[plugins.inputs]
|
|
372
|
+
configFile = "cypress.netlify.json"
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
### testing SPA routes
|
|
376
|
+
|
|
377
|
+
SPAs need catch-all redirect setup to make non-root paths accessible by tests. You can enable this with `spa` parameter.
|
|
378
|
+
|
|
379
|
+
```
|
|
380
|
+
[[plugins]]
|
|
381
|
+
# local Cypress plugin will test our site after it is built
|
|
382
|
+
package = "netlify-plugin-cypress"
|
|
383
|
+
[plugins.inputs]
|
|
384
|
+
# can also use "spa = true" to use "index.html" by default
|
|
385
|
+
spa = "index.html"
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### testing the site before build
|
|
389
|
+
|
|
390
|
+
By default this plugin tests static site _after deploy_. But maybe you want to run end-to-end tests against the _local development server_. You can start the local server, wait for it to respond and then run Cypress tests by passing parameters to this plugin. Here is a sample config file
|
|
391
|
+
|
|
392
|
+
```toml
|
|
393
|
+
[[plugins]]
|
|
394
|
+
package = "netlify-plugin-cypress"
|
|
395
|
+
# let's run tests against development server
|
|
396
|
+
# before building it (and testing the built site)
|
|
397
|
+
[plugins.inputs.preBuild]
|
|
398
|
+
enable = true
|
|
399
|
+
start = 'npm start'
|
|
400
|
+
wait-on = 'http://localhost:5000'
|
|
401
|
+
wait-on-timeout = '30' # seconds
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
Parameters you can place into `preBuild` inputs: `start`, `wait-on`, `wait-on-timeout`, `spec`, `record`, `group`, and `tag`.
|
|
405
|
+
|
|
406
|
+
See [netlify-plugin-prebuild-example](https://github.com/cypress-io/netlify-plugin-prebuild-example) repo
|
|
407
|
+
|
|
408
|
+
### testing the site after build
|
|
409
|
+
|
|
410
|
+
By default this plugin tests static site _after deploy_. But maybe you want to run end-to-end tests locally after building the static site. Cypress includes a local static server for this case but you can specify your own command if needed by using the `start` argument. Here is a sample config file
|
|
411
|
+
|
|
412
|
+
```toml
|
|
413
|
+
[[plugins]]
|
|
414
|
+
package = "netlify-plugin-cypress"
|
|
415
|
+
# let's run tests against the built site
|
|
416
|
+
[plugins.inputs.postBuild]
|
|
417
|
+
enable = true
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
Parameters you can place into `postBuild` inputs: `spec`, `record`, `group`, `tag`, `start` and `spa`.
|
|
421
|
+
|
|
422
|
+
#### The SPA parameter
|
|
423
|
+
|
|
424
|
+
If your site requires all unknown URLs to redirect back to the index page, use the `spa` parameter
|
|
425
|
+
|
|
426
|
+
```toml
|
|
427
|
+
[[plugins]]
|
|
428
|
+
package = "netlify-plugin-cypress"
|
|
429
|
+
# let's run tests against the built site
|
|
430
|
+
[plugins.inputs.postBuild]
|
|
431
|
+
enable = true
|
|
432
|
+
# must allow our test server to redirect unknown routes to "/"
|
|
433
|
+
# so that client-side routing can correctly route them
|
|
434
|
+
# can be set to true or "index.html" (or similar fallback filename in the built folder)
|
|
435
|
+
spa = true
|
|
436
|
+
start = 'npm start'
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
### using Netlify CLI
|
|
440
|
+
|
|
441
|
+
Even better when testing the prebuilt site is to run the [Netlify CLI](https://cli.netlify.com/) to make sure the local API redirects and Netlify functions work in addition to the web site. Add `netlify-cli` as a dev dependency and start it during testing.
|
|
442
|
+
|
|
443
|
+
```shell
|
|
444
|
+
$ npm i -D netlify-cli
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
```toml
|
|
448
|
+
[[plugins]]
|
|
449
|
+
package = "netlify-plugin-cypress"
|
|
450
|
+
# start Netlify server
|
|
451
|
+
[plugins.inputs.preBuild]
|
|
452
|
+
start = 'npx netlify dev'
|
|
453
|
+
wait-on = 'http://localhost:8888'
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
For more, see [tests/test-netlify-dev](./tests/test-netlify-dev) example and read [Testing Netlify Function](https://glebbahmutov.com/blog/test-netlify/#testing-netlify-functions) section.
|
|
457
|
+
|
|
458
|
+
### skipping tests
|
|
459
|
+
|
|
460
|
+
If you are testing the site before building it and want to skip testing the deployed URL
|
|
461
|
+
|
|
462
|
+
```toml
|
|
463
|
+
[[plugins]]
|
|
464
|
+
package = "netlify-plugin-cypress"
|
|
465
|
+
# do not test the deployed URL
|
|
466
|
+
[plugins.inputs]
|
|
467
|
+
enable = false
|
|
468
|
+
# test the local site
|
|
469
|
+
[plugins.inputs.preBuild]
|
|
470
|
+
enable = true
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### parallelization
|
|
474
|
+
|
|
475
|
+
Running tests in parallel **is not supported** because Netlify plugin system runs on a single machine. Thus you can record the tests on Cypress Dashboard, but not run tests in parallel. If Netlify expands its build offering by allowing multiple build machines, we could take advantage of it and run tests in parallel.
|
|
476
|
+
|
|
477
|
+
### HTML files
|
|
478
|
+
|
|
479
|
+
When serving the built folder, we automatically serve `.html` files. For example, if your folder has the following structure:
|
|
480
|
+
|
|
481
|
+
```
|
|
482
|
+
public/
|
|
483
|
+
index.html
|
|
484
|
+
pages/
|
|
485
|
+
about.html
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
The `public` folder is served automatically and the following test successfully visits both the root and the `about.html` pages:
|
|
489
|
+
|
|
490
|
+
```js
|
|
491
|
+
cy.visit('/')
|
|
492
|
+
cy.visit('/pages/about') // visits the about.html
|
|
493
|
+
```
|
|
494
|
+
**Warning:** be careful with verbose logging, since it can print all environment variables passed to the plugin, including tokens, API keys, and other secrets.
|
|
127
495
|
|
|
128
496
|
# Donate
|
|
129
497
|
|
package/package.json
CHANGED
|
@@ -1,32 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sowell/quasar-app-extension-auth",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "A Quasar
|
|
5
|
-
"author": "BriceIndrianarison <brice@sowellapp.com>",
|
|
6
|
-
"license": "MIT",
|
|
3
|
+
"version": "0.2.4",
|
|
4
|
+
"description": "A Quasar app extension to manage Authentication",
|
|
7
5
|
"main": "src/index.js",
|
|
8
|
-
"repository":
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"validator": "^13.6.0"
|
|
6
|
+
"repository": "https://github.com/sowell-ai/quasar.extension.auth",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"lint": "cd dev && eslint --ext .js,.ts,.vue ./",
|
|
9
|
+
"dev": "cd dev && quasar dev",
|
|
10
|
+
"dep": "cd dev && yarn",
|
|
11
|
+
"test:link": "cd dev && yarn test:link",
|
|
12
|
+
"test:browser": "cd dev && yarn test:browser",
|
|
13
|
+
"test": "cd dev && yarn test"
|
|
17
14
|
},
|
|
15
|
+
"keywords": [],
|
|
16
|
+
"author": "SoWell SAS",
|
|
17
|
+
"license": "MIT",
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">= 8.9.0",
|
|
20
20
|
"npm": ">= 5.6.0",
|
|
21
21
|
"yarn": ">= 1.6.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
24
|
+
"@quasar/cli": "^1.2.2",
|
|
25
|
+
"@quasar/quasar-app-extension-testing-e2e-cypress": "^3.1.0",
|
|
26
|
+
"@types/node": "^16.9.1",
|
|
27
|
+
"@types/validator": "^13.6.3",
|
|
28
|
+
"cypress-cucumber-preprocessor": "^4.3.0",
|
|
29
|
+
"eslint": "^7.14.0",
|
|
30
|
+
"eslint-config-prettier": "^8.1.0",
|
|
31
|
+
"eslint-plugin-cypress": "^2.11.1",
|
|
32
|
+
"eslint-plugin-vue": "^7.0.0",
|
|
33
|
+
"jwt-decode": "^3.1.2",
|
|
34
|
+
"quasar": "^2.0.4",
|
|
35
|
+
"typescript": "^4.4.2"
|
|
36
|
+
},
|
|
37
|
+
"directories": {
|
|
38
|
+
"test": "test"
|
|
28
39
|
},
|
|
29
|
-
"
|
|
30
|
-
"
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"axios": "^0.21.1",
|
|
42
|
+
"qs": "^6.10.1",
|
|
43
|
+
"validator": "^13.6.0",
|
|
44
|
+
"vue-i18n": "^9.1.0",
|
|
45
|
+
"vue-router": "^4.0.0",
|
|
46
|
+
"vuex": "4.0"
|
|
31
47
|
}
|
|
32
48
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="39.779" height="70.275" viewBox="0 0 39.779 70.275">
|
|
2
|
+
<g id="Logo_Sowell_bleu" data-name="Logo Sowell bleu" transform="translate(-403.55 -422.444)">
|
|
3
|
+
<path id="Tracé_455" data-name="Tracé 455" d="M440.01,457.9l-9.08-19.791a4,4,0,0,0-5.243-2.083h0a4,4,0,0,0-2.083,5.243l4.939,11.466a19.894,19.894,0,0,0-20.414,6.519,4.349,4.349,0,0,0-.21,1.945c0,2.45,2.091,4.11,4.578,4.11a4.524,4.524,0,0,0,3.021-1.149c1.98-1.693,5.1-3.689,7.905-3.689a11.327,11.327,0,1,1-11.3,12.2c.065-1.637.144-2.7.144-2.7a4.326,4.326,0,0,0-8.417-1.406l-.018-.009c-.006.039-.012.078-.019.118a4.317,4.317,0,0,0-.2,1.3c0,.072,0,.149.006.223q-.072.862-.076,1.74a19.814,19.814,0,0,0,5.441,13.66l14.429,19.43,15.461-20.608h0a21.785,21.785,0,0,0,4.413-12.484C443.729,465.218,440.01,457.9,440.01,457.9Z" transform="translate(0 -12.306)" fill="#40c4ff"/>
|
|
4
|
+
<path id="Tracé_456" data-name="Tracé 456" d="M802.618,443.124l-.884-17.044a4,4,0,0,0-4.326-3.622h0a3.985,3.985,0,0,0-2.968,1.771Z" transform="translate(-362.817 0)" fill="#40c4ff"/>
|
|
5
|
+
</g>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// FIXME: find another way to call this path
|
|
2
|
+
//@ts-ignore
|
|
3
|
+
import prompts from "app/quasar.extensions.json";
|
|
4
|
+
import axios from "axios";
|
|
5
|
+
import { boot } from "quasar/wrappers";
|
|
6
|
+
import { BootInterface } from "../interfaces";
|
|
7
|
+
|
|
8
|
+
const {
|
|
9
|
+
"@sowell/auth": { AUTH_SERVER_BASE_URL },
|
|
10
|
+
} = prompts;
|
|
11
|
+
|
|
12
|
+
export default boot(({ app }: BootInterface) => {
|
|
13
|
+
const $api = axios.create({
|
|
14
|
+
baseURL: AUTH_SERVER_BASE_URL,
|
|
15
|
+
});
|
|
16
|
+
app.provide("$api", $api);
|
|
17
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
import prompts from "app/quasar.extensions.json";
|
|
3
|
+
import { boot } from "quasar/wrappers";
|
|
4
|
+
import { BootInterface } from "../interfaces";
|
|
5
|
+
|
|
6
|
+
export default boot(({ router, store }: BootInterface) => {
|
|
7
|
+
const {
|
|
8
|
+
"@sowell/auth": { LOCAL_LOGIN_ROUTE },
|
|
9
|
+
} = prompts;
|
|
10
|
+
|
|
11
|
+
router.beforeEach((to, from, next) => {
|
|
12
|
+
let isValid = store.getters["token/getIsValid"];
|
|
13
|
+
let token = store.getters["token/getRaw"];
|
|
14
|
+
if (
|
|
15
|
+
!isValid &&
|
|
16
|
+
!token &&
|
|
17
|
+
to.path !== LOCAL_LOGIN_ROUTE &&
|
|
18
|
+
to.name !== "update_password"
|
|
19
|
+
) {
|
|
20
|
+
next(LOCAL_LOGIN_ROUTE);
|
|
21
|
+
} else {
|
|
22
|
+
next();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//@ts-ignore
|
|
2
|
+
import { boot } from "quasar/wrappers";
|
|
3
|
+
import { BootInterface } from "../interfaces";
|
|
4
|
+
import newRoutes from "../routes";
|
|
5
|
+
|
|
6
|
+
export default boot(({ app, router }: BootInterface) => {
|
|
7
|
+
// Register auth routes
|
|
8
|
+
let { routes } = router.options;
|
|
9
|
+
let routeData = routes.find((r) => r.path === "/");
|
|
10
|
+
if (routeData?.children) {
|
|
11
|
+
const currentRoutes = routeData.children.map((route) => route.path);
|
|
12
|
+
|
|
13
|
+
newRoutes.forEach((route) => {
|
|
14
|
+
if (!currentRoutes.includes(route.path)) {
|
|
15
|
+
router.addRoute(route);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
app.provide("$router", router);
|
|
20
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//@ts-ignore
|
|
2
|
+
import { boot } from "quasar/wrappers";
|
|
3
|
+
import { BootInterface } from "../interfaces";
|
|
4
|
+
import tokenModule from "../store";
|
|
5
|
+
|
|
6
|
+
export default boot(({ app, store }: BootInterface) => {
|
|
7
|
+
// Register store module
|
|
8
|
+
store.registerModule("token", tokenModule);
|
|
9
|
+
app.provide("$store", store);
|
|
10
|
+
});
|