glib-web 4.44.2 → 4.44.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.
|
@@ -27,7 +27,7 @@ export default {
|
|
|
27
27
|
const error = ref(null);
|
|
28
28
|
|
|
29
29
|
const loadRecaptchaEnterprise = () => {
|
|
30
|
-
return new Promise(function (resolve) {
|
|
30
|
+
return new Promise(function (resolve, reject) {
|
|
31
31
|
if (window.grecaptcha && window.grecaptcha.enterprise) {
|
|
32
32
|
resolve(window.grecaptcha.enterprise);
|
|
33
33
|
return;
|
|
@@ -41,6 +41,9 @@ export default {
|
|
|
41
41
|
script.src = 'https://www.google.com/recaptcha/enterprise.js?render=' + props.spec.siteKey + '&onload=onRecaptchaEnterpriseLoad';
|
|
42
42
|
script.async = true;
|
|
43
43
|
script.defer = true;
|
|
44
|
+
script.onerror = function () {
|
|
45
|
+
reject(new Error('Failed to load reCAPTCHA script'));
|
|
46
|
+
};
|
|
44
47
|
document.head.appendChild(script);
|
|
45
48
|
});
|
|
46
49
|
};
|
|
@@ -4,10 +4,10 @@ const url = testPageUrl('fields_captcha')
|
|
|
4
4
|
|
|
5
5
|
const visitWithCaptcha = (executeResult: () => Promise<string>) => {
|
|
6
6
|
cy.visit(url, {
|
|
7
|
-
onBeforeLoad(win) {
|
|
8
|
-
(win as
|
|
7
|
+
onBeforeLoad(win: Cypress.AUTWindow) {
|
|
8
|
+
(win as unknown as Record<string, unknown>).grecaptcha = {
|
|
9
9
|
enterprise: {
|
|
10
|
-
ready: function(cb:
|
|
10
|
+
ready: function(cb: () => void) { cb(); },
|
|
11
11
|
execute: function() { return executeResult(); }
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -43,6 +43,13 @@ describe('fieldsCaptcha', () => {
|
|
|
43
43
|
cy.get('.unformatted').should('contain.text', 'fake-captcha-token')
|
|
44
44
|
})
|
|
45
45
|
|
|
46
|
+
it('shows error when reCAPTCHA returns empty token', () => {
|
|
47
|
+
visitWithCaptcha(() => Promise.resolve(''))
|
|
48
|
+
|
|
49
|
+
cy.contains('Verification failed. Please refresh and try again.').should('exist')
|
|
50
|
+
cy.get('.v-progress-circular').should('not.exist')
|
|
51
|
+
})
|
|
52
|
+
|
|
46
53
|
it('shows error when reCAPTCHA fails', () => {
|
|
47
54
|
visitWithCaptcha(() => Promise.reject(new Error('reCAPTCHA unavailable')))
|
|
48
55
|
|
package/doc/TESTING.md
CHANGED
|
@@ -52,7 +52,7 @@ You **cannot write frontend tests in isolation**.
|
|
|
52
52
|
|
|
53
53
|
---
|
|
54
54
|
|
|
55
|
-
These
|
|
55
|
+
These 7 concepts explain **why the test structure exists** and **what you need to get started**. Everything else (selectors, assertions, etc.) is standard Cypress mechanics.
|
|
56
56
|
|
|
57
57
|
### 7. **Do Not Run `bin/vite dev` Separately During Cypress Tests**
|
|
58
58
|
Running the Vite dev server separately (`bin/vite dev`) while running Cypress tests causes blank pages (Vue app fails to mount). Just use the Rails server alone — it handles Vite compilation internally.
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "glib-web",
|
|
4
|
-
"version": "4.44.
|
|
4
|
+
"version": "4.44.3",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"clean:coverage": "rm -rf coverage .nyc_output",
|
|
9
|
+
"pretest": "eslint .",
|
|
9
10
|
"lint": "eslint .",
|
|
10
11
|
"lint:fix": "eslint . --fix",
|
|
11
12
|
"test": "env -u ELECTRON_RUN_AS_NODE cypress run --browser chrome && env -u ELECTRON_RUN_AS_NODE cypress run --component",
|