@sowell/quasar-app-extension-auth 0.1.9 → 0.2.3
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 +393 -28
- package/package.json +34 -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/{ResetPassword.vue → pages/ResetPassword.vue} +40 -40
- 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 +46 -34
- package/src/routes/index.ts +22 -0
- package/src/shims-vue.d.ts +6 -0
- package/src/store/index.ts +56 -0
- package/tsconfig.json +14 -0
- package/.github/workflows/publish.yml +0 -23
- 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 -275
- package/src/components/ResetCode.vue +0 -137
- package/src/components/prompt.js +0 -38
- 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:e2e:ci
|
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.
|
|
@@ -18,11 +18,11 @@ Quasar CLI will retrieve it from NPM and install the extension.
|
|
|
18
18
|
When installing the Auth app extension, you will be prompted with fourteen questions:
|
|
19
19
|
|
|
20
20
|
1. Route for authentication
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
The default is /login, it allows you to define the login route
|
|
23
23
|
|
|
24
24
|
2. Route where the user will be redirected once connected
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
The default is /, you can define where you want to be redirect once connected
|
|
27
27
|
|
|
28
28
|
3. Route for code verification after performing the forgotten password
|
|
@@ -30,16 +30,16 @@ The default is /, you can define where you want to be redirect once connected
|
|
|
30
30
|
The default is /check_code, you can define other route
|
|
31
31
|
|
|
32
32
|
4. Route for password update
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
The default is /reset_password
|
|
35
35
|
|
|
36
36
|
5. Basic server route
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
The default is http://localhost:3000, you must point it to your server base url
|
|
39
39
|
|
|
40
40
|
6. Server route for authentication
|
|
41
41
|
|
|
42
|
-
The default is /users/sign_in
|
|
42
|
+
The default is /users/sign_in
|
|
43
43
|
|
|
44
44
|
7. Server route to reset password
|
|
45
45
|
|
|
@@ -68,7 +68,7 @@ The default is auth/setInfosUser in auth module.
|
|
|
68
68
|
It takes email or phone number, can be changed
|
|
69
69
|
|
|
70
70
|
13. Vuex getter to return token
|
|
71
|
-
|
|
71
|
+
|
|
72
72
|
The default is auth/getToken and return token, can be changed.
|
|
73
73
|
|
|
74
74
|
14. Vuex getter to return user information
|
|
@@ -78,43 +78,36 @@ 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
|
|
85
85
|
|
|
86
86
|
The parent application must provide the following mutations:
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
A mutation to store the token, it takes the token in parameter
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
A mutation to clean the token and the user information
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
A getter which returns the token
|
|
95
|
-
|
|
96
|
-
A getter that returns the email or the phone number defined during the process of forgotten password.
|
|
92
|
+
A mutation to define the user information during the process of forgotten password (email or phone number), it takes in parameter the email or the phone number.
|
|
97
93
|
|
|
94
|
+
A getter which returns the token
|
|
95
|
+
|
|
96
|
+
A getter that returns the email or the phone number defined during the process of forgotten password.
|
|
98
97
|
|
|
99
98
|
When installing the extension, the path to these mutations and getters must be provided.
|
|
100
99
|
As well as the different routes of the pages and APIs, without forgetting the type of authorization.
|
|
101
100
|
|
|
102
|
-
|
|
103
101
|
# Usage
|
|
104
102
|
|
|
105
103
|
In auth mutation:
|
|
106
|
-
|
|
104
|
+
|
|
107
105
|
export function setToken(state, payload) {
|
|
108
106
|
state.token = payload
|
|
109
|
-
}
|
|
107
|
+
}
|
|
110
108
|
|
|
111
109
|
export function clearToken(state) {
|
|
112
110
|
state.token = null
|
|
113
|
-
state.emailOrPhoneNumber = null
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export function setInfosUser(state, payload) {
|
|
117
|
-
state.emailOrPhoneNumber = payload
|
|
118
111
|
}
|
|
119
112
|
|
|
120
113
|
In auth getter:
|
|
@@ -123,15 +116,387 @@ In auth getter:
|
|
|
123
116
|
return state.token
|
|
124
117
|
}
|
|
125
118
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
|
129
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.
|
|
130
495
|
|
|
131
496
|
# Donate
|
|
132
497
|
|
|
133
|
-
If you appreciate the work that went into this App Extension,
|
|
498
|
+
If you appreciate the work that went into this App Extension, make donation to [Sowell](https://www.sowellapp.com)
|
|
134
499
|
|
|
135
500
|
# License
|
|
136
501
|
|
|
137
|
-
MIT (c)
|
|
502
|
+
MIT (c) Sowell
|
package/package.json
CHANGED
|
@@ -1,32 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sowell/quasar-app-extension-auth",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "A Quasar
|
|
5
|
-
"author": "BriceIndrianarison <brice@sowellapp.com>",
|
|
6
|
-
"license": "MIT",
|
|
3
|
+
"version": "0.2.3",
|
|
4
|
+
"description": "A Quasar app extension to manage Authentication",
|
|
7
5
|
"main": "src/index.js",
|
|
8
|
-
"repository":
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"axios": "^0.21.1",
|
|
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:e2e": "cd dev && yarn && cross-env E2E_TEST=true start-test \"quasar dev\" http-get://localhost:8080 \"cypress open\"",
|
|
12
|
+
"test:e2e:ci": "cd dev && yarn && cross-env E2E_TEST=true start-test \"quasar dev\" http-get://localhost:8080 \"cypress run\""
|
|
17
13
|
},
|
|
14
|
+
"keywords": [],
|
|
15
|
+
"author": "SoWell SAS",
|
|
16
|
+
"license": "MIT",
|
|
18
17
|
"engines": {
|
|
19
18
|
"node": ">= 8.9.0",
|
|
20
19
|
"npm": ">= 5.6.0",
|
|
21
20
|
"yarn": ">= 1.6.0"
|
|
22
21
|
},
|
|
23
22
|
"devDependencies": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
23
|
+
"@quasar/cli": "^1.2.2",
|
|
24
|
+
"@quasar/quasar-app-extension-testing-e2e-cypress": "^3.1.0",
|
|
25
|
+
"@types/node": "^16.9.1",
|
|
26
|
+
"@types/validator": "^13.6.3",
|
|
27
|
+
"cypress-cucumber-preprocessor": "^4.3.0",
|
|
28
|
+
"eslint": "^7.14.0",
|
|
29
|
+
"eslint-config-prettier": "^8.1.0",
|
|
30
|
+
"eslint-plugin-cypress": "^2.11.1",
|
|
31
|
+
"eslint-plugin-vue": "^7.0.0",
|
|
32
|
+
"jwt-decode": "^3.1.2",
|
|
33
|
+
"quasar": "^2.0.4",
|
|
34
|
+
"typescript": "^4.4.2"
|
|
35
|
+
},
|
|
36
|
+
"directories": {
|
|
37
|
+
"test": "test"
|
|
28
38
|
},
|
|
29
|
-
"
|
|
30
|
-
"
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"axios": "^0.21.1",
|
|
41
|
+
"qs": "^6.10.1",
|
|
42
|
+
"validator": "^13.6.0",
|
|
43
|
+
"vue-i18n": "^9.1.0",
|
|
44
|
+
"vue-router": "^4.0.0",
|
|
45
|
+
"vuex": "4.0"
|
|
31
46
|
}
|
|
32
47
|
}
|
|
@@ -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
|
+
});
|