@tappet/cypress 0.1.0-prealpha.1
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/MIT-LICENSE.txt +23 -0
- package/README.md +5 -0
- package/cypress/plugin/index.d.ts +35 -0
- package/cypress/plugin/index.d.ts.map +1 -0
- package/cypress/plugin/index.js +47 -0
- package/cypress/plugin/index.js.map +1 -0
- package/package.json +92 -0
- package/uniter/bootstraps/bootstrap.php +23 -0
- package/uniter/bootstraps/stub.php +21 -0
- package/uniter/defineConfig.d.ts +31 -0
- package/uniter/defineConfig.d.ts.map +1 -0
- package/uniter/defineConfig.js +96 -0
- package/uniter/defineConfig.js.map +1 -0
- package/uniter/plugin/index.d.ts +7 -0
- package/uniter/plugin/index.d.ts.map +1 -0
- package/uniter/plugin/index.js +22 -0
- package/uniter/plugin/index.js.map +1 -0
- package/uniter/plugin/phpcore.config.d.ts +26 -0
- package/uniter/plugin/phpcore.config.d.ts.map +1 -0
- package/uniter/plugin/phpcore.config.js +71 -0
- package/uniter/plugin/phpcore.config.js.map +1 -0
package/MIT-LICENSE.txt
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright 2026 Dan Phillimore (asmblah)
|
|
4
|
+
https://github.com/nytris/tappet-cypress/
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
7
|
+
a copy of this software and associated documentation files (the
|
|
8
|
+
"Software"), to deal in the Software without restriction, including
|
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
12
|
+
the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be
|
|
15
|
+
included in all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
20
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
21
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
22
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
23
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# Tappet - Enjoyable GUI testing with Tappet, using Cypress
|
|
2
|
+
|
|
3
|
+
[](https://github.com/nytris/tappet-cypress/actions?query=workflow%3ACI)
|
|
4
|
+
|
|
5
|
+
[EXPERIMENTAL] Cypress adapter for Tappet GUI testing.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import UniterPlugin = require('webpack-uniter-plugin');
|
|
2
|
+
/**
|
|
3
|
+
* Type of the preprocessor factory function from @cypress/webpack-preprocessor.
|
|
4
|
+
*/
|
|
5
|
+
export type WebpackPreprocessorFactory = (options: {
|
|
6
|
+
webpackOptions: {
|
|
7
|
+
plugins: unknown[];
|
|
8
|
+
};
|
|
9
|
+
}) => unknown;
|
|
10
|
+
/**
|
|
11
|
+
* Type of the Cypress `on` event registration function.
|
|
12
|
+
*/
|
|
13
|
+
export type CypressOnFunction = (event: string, handler: unknown) => void;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a Cypress plugin registration function with injectable dependencies.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createPlugin(webpackPreprocessor: WebpackPreprocessorFactory, UniterPluginCtor: typeof UniterPlugin): (on: CypressOnFunction) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Registers the Tappet Cypress Webpack preprocessor plugin with Cypress.
|
|
20
|
+
*
|
|
21
|
+
* Usage in `cypress.config.js`:
|
|
22
|
+
* ```js
|
|
23
|
+
* const { register } = require('@tappet/cypress/cypress/plugin');
|
|
24
|
+
*
|
|
25
|
+
* module.exports = defineConfig({
|
|
26
|
+
* e2e: {
|
|
27
|
+
* setupNodeEvents(on) {
|
|
28
|
+
* register(on);
|
|
29
|
+
* },
|
|
30
|
+
* },
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function register(on: CypressOnFunction): void;
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ts/cypress/plugin/index.ts"],"names":[],"mappings":"AAUA,OAAO,YAAY,GAAG,QAAQ,uBAAuB,CAAC,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,OAAO,EAAE;IAC/C,cAAc,EAAE;QACZ,OAAO,EAAE,OAAO,EAAE,CAAC;KACtB,CAAC;CACL,KAAK,OAAO,CAAC;AAEd;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;AAE1E;;GAEG;AACH,wBAAgB,YAAY,CACxB,mBAAmB,EAAE,0BAA0B,EAC/C,gBAAgB,EAAE,OAAO,YAAY,GACtC,CAAC,EAAE,EAAE,iBAAiB,KAAK,IAAI,CAWjC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CAAC,EAAE,EAAE,iBAAiB,GAAG,IAAI,CAGpD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Tappet Cypress - Enjoyable GUI testing with Tappet, using Cypress
|
|
4
|
+
* Copyright (c) Dan Phillimore (asmblah)
|
|
5
|
+
* https://github.com/nytris/tappet-cypress/
|
|
6
|
+
*
|
|
7
|
+
* Released under the MIT license.
|
|
8
|
+
* https://github.com/nytris/tappet-cypress/raw/main/MIT-LICENSE.txt
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.createPlugin = createPlugin;
|
|
12
|
+
exports.register = register;
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
14
|
+
const UniterPlugin = require("webpack-uniter-plugin");
|
|
15
|
+
/**
|
|
16
|
+
* Creates a Cypress plugin registration function with injectable dependencies.
|
|
17
|
+
*/
|
|
18
|
+
function createPlugin(webpackPreprocessor, UniterPluginCtor) {
|
|
19
|
+
return (on) => {
|
|
20
|
+
on('file:preprocessor', webpackPreprocessor({
|
|
21
|
+
webpackOptions: {
|
|
22
|
+
plugins: [new UniterPluginCtor()],
|
|
23
|
+
},
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Registers the Tappet Cypress Webpack preprocessor plugin with Cypress.
|
|
29
|
+
*
|
|
30
|
+
* Usage in `cypress.config.js`:
|
|
31
|
+
* ```js
|
|
32
|
+
* const { register } = require('@tappet/cypress/cypress/plugin');
|
|
33
|
+
*
|
|
34
|
+
* module.exports = defineConfig({
|
|
35
|
+
* e2e: {
|
|
36
|
+
* setupNodeEvents(on) {
|
|
37
|
+
* register(on);
|
|
38
|
+
* },
|
|
39
|
+
* },
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
function register(on) {
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
45
|
+
createPlugin(require('@cypress/webpack-preprocessor'), UniterPlugin)(on);
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ts/cypress/plugin/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAsBH,oCAcC;AAkBD,4BAGC;AAvDD,iEAAiE;AACjE,sDAAuD;AAgBvD;;GAEG;AACH,SAAgB,YAAY,CACxB,mBAA+C,EAC/C,gBAAqC;IAErC,OAAO,CAAC,EAAqB,EAAQ,EAAE;QACnC,EAAE,CACE,mBAAmB,EACnB,mBAAmB,CAAC;YAChB,cAAc,EAAE;gBACZ,OAAO,EAAE,CAAC,IAAI,gBAAgB,EAAE,CAAC;aACpC;SACJ,CAAC,CACL,CAAC;IACN,CAAC,CAAC;AACN,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,QAAQ,CAAC,EAAqB;IAC1C,iEAAiE;IACjE,YAAY,CAAC,OAAO,CAAC,+BAA+B,CAAC,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC;AAC7E,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.1.0-prealpha.1",
|
|
3
|
+
"name": "@tappet/cypress",
|
|
4
|
+
"description": "Enjoyable GUI testing with Tappet, using Cypress",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"testing",
|
|
7
|
+
"gui",
|
|
8
|
+
"e2e",
|
|
9
|
+
"cypress",
|
|
10
|
+
"tappet",
|
|
11
|
+
"nytris"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://github.com/nytris/tappet-cypress",
|
|
14
|
+
"author": "Dan Phillimore <dan@ovms.co> (https://github.com/asmblah)",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/nytris/tappet-cypress.git"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"email": "dan@ovms.co",
|
|
21
|
+
"url": "https://github.com/nytris/tappet-cypress/issues"
|
|
22
|
+
},
|
|
23
|
+
"main": "uniter/defineConfig.js",
|
|
24
|
+
"types": "uniter/defineConfig.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
".": {
|
|
27
|
+
"require": "./uniter/defineConfig.js",
|
|
28
|
+
"types": "./uniter/defineConfig.d.ts"
|
|
29
|
+
},
|
|
30
|
+
"./cypress/plugin": {
|
|
31
|
+
"require": "./cypress/plugin/index.js",
|
|
32
|
+
"types": "./cypress/plugin/index.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./uniter/plugin": {
|
|
35
|
+
"require": "./uniter/plugin/index.js",
|
|
36
|
+
"types": "./uniter/plugin/index.d.ts"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"cypress/**",
|
|
41
|
+
"uniter/**",
|
|
42
|
+
"MIT-LICENSE.txt",
|
|
43
|
+
"README.md"
|
|
44
|
+
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build": "tsc --build src/ts",
|
|
47
|
+
"build:clean": "tsc --build src/ts --clean",
|
|
48
|
+
"mocha": "mocha --import=tsx -r mocha-bootstrap --recursive 'test/functional/**/*Test.ts' 'test/integrated/**/*Test.ts' 'test/unit/**/*Test.ts'",
|
|
49
|
+
"lint:eslint:check": "eslint '{src/ts,test}/**/*.ts' --max-warnings=0",
|
|
50
|
+
"lint:eslint:fix": "eslint '{src/ts,test}/**/*.ts' --fix",
|
|
51
|
+
"lint:tsc:check": "tsc --noEmit",
|
|
52
|
+
"prepublishOnly": "npm test && npm run build:clean && npm run build",
|
|
53
|
+
"test": "npm run lint:eslint:check && npm run lint:tsc:check && npm run mocha"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"webpack-uniter-plugin": "^0.0.1"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"@cypress/webpack-preprocessor": ">=6",
|
|
60
|
+
"phpruntime": "*"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
|
64
|
+
"@types/chai": "^5.2.1",
|
|
65
|
+
"@types/chai-as-promised": "^8.0.2",
|
|
66
|
+
"@types/mocha": "^10.0.10",
|
|
67
|
+
"@types/node": "^22.14.1",
|
|
68
|
+
"@types/sinon": "^17.0.3",
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "^8.30.1",
|
|
70
|
+
"@typescript-eslint/parser": "^8.30.1",
|
|
71
|
+
"buildbelt": "^0.3.0",
|
|
72
|
+
"chai": "^4.3.10",
|
|
73
|
+
"chai-as-promised": "^7.1.1",
|
|
74
|
+
"eslint": "^9.25.0",
|
|
75
|
+
"eslint-config-prettier": "^10.1.2",
|
|
76
|
+
"eslint-plugin-prettier": "^5.2.6",
|
|
77
|
+
"mocha": "^11.1.0",
|
|
78
|
+
"mocha-bootstrap": "^1.1.1",
|
|
79
|
+
"phpruntime": "^9.2.1",
|
|
80
|
+
"prettier": "^3.5.3",
|
|
81
|
+
"sinon": "^17.0.1",
|
|
82
|
+
"sinon-chai": "^3.7.0",
|
|
83
|
+
"ts-mocha": "^11.1.0",
|
|
84
|
+
"ts-sinon": "^2.0.2",
|
|
85
|
+
"tsx": "^4.21.0",
|
|
86
|
+
"typescript": "^5.8.3"
|
|
87
|
+
},
|
|
88
|
+
"engines": {
|
|
89
|
+
"node": ">=18"
|
|
90
|
+
},
|
|
91
|
+
"license": "MIT"
|
|
92
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Tappet Cypress - Enjoyable GUI testing with Tappet, using Cypress
|
|
5
|
+
* Copyright (c) Dan Phillimore (asmblah)
|
|
6
|
+
* https://github.com/nytris/tappet-cypress/
|
|
7
|
+
*
|
|
8
|
+
* Released under the MIT license.
|
|
9
|
+
* https://github.com/nytris/tappet-cypress/raw/main/MIT-LICENSE.txt
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
declare(strict_types=1);
|
|
13
|
+
|
|
14
|
+
use Tappet\Core\Environment\Environment;
|
|
15
|
+
use Tappet\Core\Fixture\ModelRepository;
|
|
16
|
+
use Tappet\Core\Tappet;
|
|
17
|
+
use Tappet\Cypress\Automation\CypressAutomation;
|
|
18
|
+
|
|
19
|
+
$automation = new CypressAutomation(tappet_get_cypress_api());
|
|
20
|
+
$modelRepository = new ModelRepository(tappet_get_fixture_api());
|
|
21
|
+
$environment = new Environment($modelRepository, $automation);
|
|
22
|
+
|
|
23
|
+
Tappet::initialise(tappet_get_describe($modelRepository), $environment);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Tappet Cypress - Enjoyable GUI testing with Tappet, using Cypress
|
|
5
|
+
* Copyright (c) Dan Phillimore (asmblah)
|
|
6
|
+
* https://github.com/nytris/tappet-cypress/
|
|
7
|
+
*
|
|
8
|
+
* Released under the MIT license.
|
|
9
|
+
* https://github.com/nytris/tappet-cypress/raw/main/MIT-LICENSE.txt
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
declare(strict_types=1);
|
|
13
|
+
|
|
14
|
+
// <stubs>
|
|
15
|
+
function header() {
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
function headers_sent() {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
// </stubs>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface DefineConfigOptions {
|
|
2
|
+
include?: string[];
|
|
3
|
+
}
|
|
4
|
+
export interface PhpifySettings {
|
|
5
|
+
bootstraps?: string[];
|
|
6
|
+
include?: string[];
|
|
7
|
+
rootDir?: string;
|
|
8
|
+
stub?: Record<string, null>;
|
|
9
|
+
}
|
|
10
|
+
export interface PhpCoreSettings {
|
|
11
|
+
stackCleaning?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface PhpToJsSettings {
|
|
14
|
+
lineNumbers?: boolean;
|
|
15
|
+
mode?: string;
|
|
16
|
+
stackCleaning?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface UniterSettings {
|
|
19
|
+
phpcore?: PhpCoreSettings;
|
|
20
|
+
phpify?: PhpifySettings;
|
|
21
|
+
phptojs?: PhpToJsSettings;
|
|
22
|
+
}
|
|
23
|
+
export interface UniterConfig {
|
|
24
|
+
plugins?: unknown[];
|
|
25
|
+
settings?: UniterSettings;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Creates the Uniter configuration for Tappet Cypress.
|
|
29
|
+
*/
|
|
30
|
+
export declare function defineConfig(relativeRootDir: string, { include }?: DefineConfigOptions): UniterConfig;
|
|
31
|
+
//# sourceMappingURL=defineConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineConfig.d.ts","sourceRoot":"","sources":["../src/ts/uniter/defineConfig.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,mBAAmB;IAChC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC3B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,eAAe;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC3B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,OAAO,CAAC,EAAE,eAAe,CAAC;CAC7B;AAED,MAAM,WAAW,YAAY;IACzB,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAgB,YAAY,CACxB,eAAe,EAAE,MAAM,EACvB,EAAE,OAAY,EAAE,GAAE,mBAAwB,GAC3C,YAAY,CA2Cd"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.defineConfig = defineConfig;
|
|
40
|
+
/*
|
|
41
|
+
* Tappet Cypress - Enjoyable GUI testing with Tappet, using Cypress
|
|
42
|
+
* Copyright (c) Dan Phillimore (asmblah)
|
|
43
|
+
* https://github.com/nytris/tappet-cypress/
|
|
44
|
+
*
|
|
45
|
+
* Released under the MIT license.
|
|
46
|
+
* https://github.com/nytris/tappet-cypress/raw/main/MIT-LICENSE.txt
|
|
47
|
+
*/
|
|
48
|
+
const uniterPlugin = __importStar(require("./plugin/"));
|
|
49
|
+
const path_1 = __importDefault(require("path"));
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
51
|
+
const phpEvalPlugin = require("phpruntime/src/plugin/eval");
|
|
52
|
+
/**
|
|
53
|
+
* Creates the Uniter configuration for Tappet Cypress.
|
|
54
|
+
*/
|
|
55
|
+
function defineConfig(relativeRootDir, { include = [] } = {}) {
|
|
56
|
+
const bootstrapsDir = path_1.default.join(__dirname, 'bootstraps');
|
|
57
|
+
return {
|
|
58
|
+
plugins: [
|
|
59
|
+
// Install PHP eval(...) support.
|
|
60
|
+
phpEvalPlugin,
|
|
61
|
+
uniterPlugin,
|
|
62
|
+
],
|
|
63
|
+
settings: {
|
|
64
|
+
phpcore: {
|
|
65
|
+
// Make stack frames that come from PHP code that was transpiled to JavaScript
|
|
66
|
+
// appear more cleanly in the stack traces that Cypress displays.
|
|
67
|
+
stackCleaning: true,
|
|
68
|
+
},
|
|
69
|
+
phpify: {
|
|
70
|
+
bootstraps: [
|
|
71
|
+
path_1.default.join(bootstrapsDir, 'stub.php'),
|
|
72
|
+
// Pull in Composer's autoloader.
|
|
73
|
+
'vendor/autoload.php',
|
|
74
|
+
path_1.default.join(bootstrapsDir, 'bootstrap.php'),
|
|
75
|
+
],
|
|
76
|
+
include: [
|
|
77
|
+
'tests/tappet/app/**/*.php',
|
|
78
|
+
'vendor/autoload.php',
|
|
79
|
+
'vendor/composer/**/*.php',
|
|
80
|
+
'!vendor/composer/pcre/**',
|
|
81
|
+
'vendor/nytris/tappet/**/*.php',
|
|
82
|
+
'vendor/nytris/tappet-cypress/**/*.php',
|
|
83
|
+
...include,
|
|
84
|
+
],
|
|
85
|
+
rootDir: relativeRootDir,
|
|
86
|
+
},
|
|
87
|
+
phptojs: {
|
|
88
|
+
lineNumbers: true,
|
|
89
|
+
mode: 'async',
|
|
90
|
+
// As above.
|
|
91
|
+
stackCleaning: true,
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=defineConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defineConfig.js","sourceRoot":"","sources":["../src/ts/uniter/defineConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,oCA8CC;AA/FD;;;;;;;GAOG;AACH,wDAA0C;AAC1C,gDAAwB;AAExB,iEAAiE;AACjE,4DAA6D;AAkC7D;;GAEG;AACH,SAAgB,YAAY,CACxB,eAAuB,EACvB,EAAE,OAAO,GAAG,EAAE,KAA0B,EAAE;IAE1C,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAEzD,OAAO;QACH,OAAO,EAAE;YACL,iCAAiC;YACjC,aAAa;YAEb,YAAY;SACf;QACD,QAAQ,EAAE;YACN,OAAO,EAAE;gBACL,8EAA8E;gBAC9E,iEAAiE;gBACjE,aAAa,EAAE,IAAI;aACtB;YACD,MAAM,EAAE;gBACJ,UAAU,EAAE;oBACR,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC;oBACpC,iCAAiC;oBACjC,qBAAqB;oBACrB,cAAI,CAAC,IAAI,CAAC,aAAa,EAAE,eAAe,CAAC;iBAC5C;gBACD,OAAO,EAAE;oBACL,2BAA2B;oBAC3B,qBAAqB;oBACrB,0BAA0B;oBAC1B,0BAA0B;oBAC1B,+BAA+B;oBAC/B,uCAAuC;oBAEvC,GAAG,OAAO;iBACb;gBACD,OAAO,EAAE,eAAe;aAC3B;YACD,OAAO,EAAE;gBACL,WAAW,EAAE,IAAI;gBACjB,IAAI,EAAE,OAAO;gBACb,YAAY;gBACZ,aAAa,EAAE,IAAI;aACtB;SACJ;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ts/uniter/plugin/index.ts"],"names":[],"mappings":"AAUA;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,MAAkD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.phpcore = void 0;
|
|
7
|
+
/*
|
|
8
|
+
* Tappet Cypress - Enjoyable GUI testing with Tappet, using Cypress
|
|
9
|
+
* Copyright (c) Dan Phillimore (asmblah)
|
|
10
|
+
* https://github.com/nytris/tappet-cypress/
|
|
11
|
+
*
|
|
12
|
+
* Released under the MIT license.
|
|
13
|
+
* https://github.com/nytris/tappet-cypress/raw/main/MIT-LICENSE.txt
|
|
14
|
+
*/
|
|
15
|
+
const path_1 = __importDefault(require("path"));
|
|
16
|
+
/**
|
|
17
|
+
* Path to the PHPCore addon configuration for this plugin.
|
|
18
|
+
*
|
|
19
|
+
* Uniter requires this to be a filesystem path to the config module.
|
|
20
|
+
*/
|
|
21
|
+
exports.phpcore = path_1.default.join(__dirname, 'phpcore.config.js');
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ts/uniter/plugin/index.ts"],"names":[],"mappings":";;;;;;AAAA;;;;;;;GAOG;AACH,gDAAwB;AAExB;;;;GAIG;AACU,QAAA,OAAO,GAAW,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for the Uniter environment object provided to initialiser groups.
|
|
3
|
+
*/
|
|
4
|
+
export interface UniterEnvironment {
|
|
5
|
+
defineCoercingFunction(name: string, handler: (...args: unknown[]) => unknown): void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Interface for an initialiser group function.
|
|
9
|
+
*/
|
|
10
|
+
export type InitialiserGroup = (params: {
|
|
11
|
+
environment: UniterEnvironment;
|
|
12
|
+
}) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Interface for a Uniter addon configuration.
|
|
15
|
+
*/
|
|
16
|
+
export interface UniterAddon {
|
|
17
|
+
initialiserGroups: InitialiserGroup[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The PHPCore addon configuration for Tappet Cypress.
|
|
21
|
+
*
|
|
22
|
+
* Registers coercing functions that bridge between PHP (transpiled via Uniter)
|
|
23
|
+
* and the Cypress JavaScript environment.
|
|
24
|
+
*/
|
|
25
|
+
export declare const addons: UniterAddon[];
|
|
26
|
+
//# sourceMappingURL=phpcore.config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phpcore.config.d.ts","sourceRoot":"","sources":["../../src/ts/uniter/plugin/phpcore.config.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,sBAAsB,CAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,GACzC,IAAI,CAAC;CACX;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE;IACpC,WAAW,EAAE,iBAAiB,CAAC;CAClC,KAAK,IAAI,CAAC;AAEX;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;CACzC;AAED;;;;;GAKG;AACH,eAAO,MAAM,MAAM,EAAE,WAAW,EAuH/B,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Tappet Cypress - Enjoyable GUI testing with Tappet, using Cypress
|
|
4
|
+
* Copyright (c) Dan Phillimore (asmblah)
|
|
5
|
+
* https://github.com/nytris/tappet-cypress/
|
|
6
|
+
*
|
|
7
|
+
* Released under the MIT license.
|
|
8
|
+
* https://github.com/nytris/tappet-cypress/raw/main/MIT-LICENSE.txt
|
|
9
|
+
*/
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.addons = void 0;
|
|
12
|
+
/**
|
|
13
|
+
* The PHPCore addon configuration for Tappet Cypress.
|
|
14
|
+
*
|
|
15
|
+
* Registers coercing functions that bridge between PHP (transpiled via Uniter)
|
|
16
|
+
* and the Cypress JavaScript environment.
|
|
17
|
+
*/
|
|
18
|
+
exports.addons = [
|
|
19
|
+
{
|
|
20
|
+
initialiserGroups: [
|
|
21
|
+
({ environment }) => {
|
|
22
|
+
const cypressWindow = window;
|
|
23
|
+
const { describe, it, cy, Cypress, fetch } = cypressWindow;
|
|
24
|
+
const apiBaseUrl = Cypress.env('tappetBaseUrl');
|
|
25
|
+
environment.defineCoercingFunction('tappet_get_fixture_api', () => {
|
|
26
|
+
return {
|
|
27
|
+
loadFixture: async (fixtureFqcn, fixturePayload) => {
|
|
28
|
+
return (await fetch(apiBaseUrl + '/load/' + fixtureFqcn, {
|
|
29
|
+
method: 'POST',
|
|
30
|
+
body: fixturePayload,
|
|
31
|
+
})).text();
|
|
32
|
+
},
|
|
33
|
+
purge: async (modelsToPurge) => {
|
|
34
|
+
return (await fetch(apiBaseUrl + '/purge', {
|
|
35
|
+
method: 'POST',
|
|
36
|
+
body: JSON.stringify(modelsToPurge),
|
|
37
|
+
})).text();
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
environment.defineCoercingFunction('tappet_get_cypress_api', () => {
|
|
42
|
+
return cy;
|
|
43
|
+
});
|
|
44
|
+
environment.defineCoercingFunction('tappet_get_describe', (modelRepository) => {
|
|
45
|
+
return async (suite) => {
|
|
46
|
+
const scenarios = [];
|
|
47
|
+
for (const scenario of await suite.getScenarios()) {
|
|
48
|
+
scenarios.push({
|
|
49
|
+
description: await scenario.getDescription(),
|
|
50
|
+
scenario: scenario,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
describe(await suite.getDescription(), () => {
|
|
54
|
+
beforeEach(() => {
|
|
55
|
+
// TODO: scenario.beforeEach()?
|
|
56
|
+
// Perform cleanup inside Mocha beforeEach so that it happens regardless of errors.
|
|
57
|
+
cy.then(() => modelRepository.purge());
|
|
58
|
+
});
|
|
59
|
+
for (const { description, scenario, } of scenarios) {
|
|
60
|
+
it(description, () => {
|
|
61
|
+
return cy.then(() => scenario.perform());
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
//# sourceMappingURL=phpcore.config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phpcore.config.js","sourceRoot":"","sources":["../../src/ts/uniter/plugin/phpcore.config.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AA0BH;;;;;GAKG;AACU,QAAA,MAAM,GAAkB;IACjC;QACI,iBAAiB,EAAE;YACf,CAAC,EAAE,WAAW,EAAsC,EAAQ,EAAE;gBAC1D,MAAM,aAAa,GAAG,MAUrB,CAAC;gBAEF,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,aAAa,CAAC;gBAE3D,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;gBAEhD,WAAW,CAAC,sBAAsB,CAC9B,wBAAwB,EACxB,GAAG,EAAE;oBACD,OAAO;wBACH,WAAW,EAAE,KAAK,EACd,WAAmB,EACnB,cAAsB,EACxB,EAAE;4BACA,OAAO,CACH,MAAM,KAAK,CACP,UAAU,GAAG,QAAQ,GAAG,WAAW,EACnC;gCACI,MAAM,EAAE,MAAM;gCACd,IAAI,EAAE,cAAc;6BACvB,CACJ,CACJ,CAAC,IAAI,EAAE,CAAC;wBACb,CAAC;wBACD,KAAK,EAAE,KAAK,EACR,aAGG,EACL,EAAE;4BACA,OAAO,CACH,MAAM,KAAK,CAAC,UAAU,GAAG,QAAQ,EAAE;gCAC/B,MAAM,EAAE,MAAM;gCACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;6BACtC,CAAC,CACL,CAAC,IAAI,EAAE,CAAC;wBACb,CAAC;qBACJ,CAAC;gBACN,CAAC,CACJ,CAAC;gBAEF,WAAW,CAAC,sBAAsB,CAC9B,wBAAwB,EACxB,GAAG,EAAE;oBACD,OAAO,EAAE,CAAC;gBACd,CAAC,CACJ,CAAC;gBAEF,WAAW,CAAC,sBAAsB,CAC9B,qBAAqB,EACrB,CAAC,eAAwB,EAAE,EAAE;oBACzB,OAAO,KAAK,EAAE,KAQb,EAAE,EAAE;wBACD,MAAM,SAAS,GAKT,EAAE,CAAC;wBAET,KAAK,MAAM,QAAQ,IAAI,MAAM,KAAK,CAAC,YAAY,EAAE,EAAE,CAAC;4BAChD,SAAS,CAAC,IAAI,CAAC;gCACX,WAAW,EACP,MAAM,QAAQ,CAAC,cAAc,EAAE;gCACnC,QAAQ,EAAE,QAAQ;6BACrB,CAAC,CAAC;wBACP,CAAC;wBAED,QAAQ,CAAC,MAAM,KAAK,CAAC,cAAc,EAAE,EAAE,GAAG,EAAE;4BACxC,UAAU,CAAC,GAAG,EAAE;gCACZ,+BAA+B;gCAC/B,mFAAmF;gCACnF,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAEL,eAGH,CAAC,KAAK,EAAE,CACZ,CAAC;4BACN,CAAC,CAAC,CAAC;4BAEH,KAAK,MAAM,EACP,WAAW,EACX,QAAQ,GACX,IAAI,SAAS,EAAE,CAAC;gCACb,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE;oCACjB,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAChB,QAAQ,CAAC,OAAO,EAAE,CACrB,CAAC;gCACN,CAAC,CAAC,CAAC;4BACP,CAAC;wBACL,CAAC,CAAC,CAAC;oBACP,CAAC,CAAC;gBACN,CAAC,CACJ,CAAC;YACN,CAAC;SACJ;KACJ;CACJ,CAAC"}
|