@tappet/cypress 0.1.0-prealpha.1 → 0.1.0
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/cypress/plugin/index.d.ts +1 -1
- package/cypress/plugin/index.d.ts.map +1 -1
- package/cypress/plugin/index.js +8 -6
- package/cypress/plugin/index.js.map +1 -1
- package/package.json +7 -5
- package/uniter/bootstraps/bootstrap.php +14 -3
- package/uniter/defineConfig.d.ts +5 -1
- package/uniter/defineConfig.d.ts.map +1 -1
- package/uniter/defineConfig.js +24 -5
- package/uniter/defineConfig.js.map +1 -1
- package/uniter/env/composer/get_autoload_files.php +24 -0
- package/uniter/env/composer/uniter.config.js +18 -0
- package/uniter/plugin/phpcore.config.d.ts.map +1 -1
- package/uniter/plugin/phpcore.config.js +77 -12
- package/uniter/plugin/phpcore.config.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ts/cypress/plugin/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ts/cypress/plugin/index.ts"],"names":[],"mappings":"AAQA,OAAO,YAAY,MAAM,uBAAuB,CAAC;AAEjD;;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"}
|
package/cypress/plugin/index.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
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.createPlugin = createPlugin;
|
|
7
|
+
exports.register = register;
|
|
2
8
|
/*
|
|
3
9
|
* Tappet Cypress - Enjoyable GUI testing with Tappet, using Cypress
|
|
4
10
|
* Copyright (c) Dan Phillimore (asmblah)
|
|
@@ -7,11 +13,7 @@
|
|
|
7
13
|
* Released under the MIT license.
|
|
8
14
|
* https://github.com/nytris/tappet-cypress/raw/main/MIT-LICENSE.txt
|
|
9
15
|
*/
|
|
10
|
-
|
|
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");
|
|
16
|
+
const webpack_uniter_plugin_1 = __importDefault(require("webpack-uniter-plugin"));
|
|
15
17
|
/**
|
|
16
18
|
* Creates a Cypress plugin registration function with injectable dependencies.
|
|
17
19
|
*/
|
|
@@ -42,6 +44,6 @@ function createPlugin(webpackPreprocessor, UniterPluginCtor) {
|
|
|
42
44
|
*/
|
|
43
45
|
function register(on) {
|
|
44
46
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
45
|
-
createPlugin(require('@cypress/webpack-preprocessor'),
|
|
47
|
+
createPlugin(require('@cypress/webpack-preprocessor'), webpack_uniter_plugin_1.default)(on);
|
|
46
48
|
}
|
|
47
49
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ts/cypress/plugin/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ts/cypress/plugin/index.ts"],"names":[],"mappings":";;;;;AA2BA,oCAcC;AAkBD,4BAGC;AA9DD;;;;;;;GAOG;AACH,kFAAiD;AAgBjD;;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,+BAAY,CAAC,CAAC,EAAE,CAAC,CAAC;AAC7E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.0
|
|
2
|
+
"version": "0.1.0",
|
|
3
3
|
"name": "@tappet/cypress",
|
|
4
4
|
"description": "Enjoyable GUI testing with Tappet, using Cypress",
|
|
5
5
|
"keywords": [
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"main": "uniter/defineConfig.js",
|
|
24
24
|
"types": "uniter/defineConfig.d.ts",
|
|
25
25
|
"exports": {
|
|
26
|
-
".": {
|
|
27
|
-
"require": "./uniter/defineConfig.js",
|
|
28
|
-
"types": "./uniter/defineConfig.d.ts"
|
|
29
|
-
},
|
|
30
26
|
"./cypress/plugin": {
|
|
31
27
|
"require": "./cypress/plugin/index.js",
|
|
32
28
|
"types": "./cypress/plugin/index.d.ts"
|
|
33
29
|
},
|
|
30
|
+
"./uniter/defineConfig": {
|
|
31
|
+
"require": "./uniter/defineConfig.js",
|
|
32
|
+
"types": "./uniter/defineConfig.d.ts"
|
|
33
|
+
},
|
|
34
34
|
"./uniter/plugin": {
|
|
35
35
|
"require": "./uniter/plugin/index.js",
|
|
36
36
|
"types": "./uniter/plugin/index.d.ts"
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"test": "npm run lint:eslint:check && npm run lint:tsc:check && npm run mocha"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
+
"dotphp": "^3.9.0",
|
|
56
57
|
"webpack-uniter-plugin": "^0.0.1"
|
|
57
58
|
},
|
|
58
59
|
"peerDependencies": {
|
|
@@ -71,6 +72,7 @@
|
|
|
71
72
|
"buildbelt": "^0.3.0",
|
|
72
73
|
"chai": "^4.3.10",
|
|
73
74
|
"chai-as-promised": "^7.1.1",
|
|
75
|
+
"cypress": "^14",
|
|
74
76
|
"eslint": "^9.25.0",
|
|
75
77
|
"eslint-config-prettier": "^10.1.2",
|
|
76
78
|
"eslint-plugin-prettier": "^5.2.6",
|
|
@@ -11,13 +11,24 @@
|
|
|
11
11
|
|
|
12
12
|
declare(strict_types=1);
|
|
13
13
|
|
|
14
|
+
use Composer\Autoload\ClassLoader;
|
|
14
15
|
use Tappet\Core\Environment\Environment;
|
|
15
16
|
use Tappet\Core\Fixture\ModelRepository;
|
|
17
|
+
use Tappet\Core\Project\ProjectRootResolver;
|
|
16
18
|
use Tappet\Core\Tappet;
|
|
17
|
-
use Tappet\Cypress\
|
|
19
|
+
use Tappet\Cypress\Suite\CypressSuite;
|
|
20
|
+
use Tappet\Suite\SuiteResolver;
|
|
18
21
|
|
|
19
|
-
$
|
|
22
|
+
$projectRootResolver = new ProjectRootResolver(new ReflectionClass(ClassLoader::class));
|
|
23
|
+
$suiteResolver = new SuiteResolver(CypressSuite::class, [
|
|
24
|
+
tappet_get_cypress_project_root(),
|
|
25
|
+
$projectRootResolver->resolveProjectRoot()
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
$suite = $suiteResolver->resolveSuite(tappet_get_suite_name());
|
|
29
|
+
|
|
30
|
+
$automation = $suite->getAutomation(tappet_get_cypress_api());
|
|
20
31
|
$modelRepository = new ModelRepository(tappet_get_fixture_api());
|
|
21
|
-
$environment = new Environment($modelRepository, $automation);
|
|
32
|
+
$environment = new Environment($modelRepository, $automation, tappet_get_base_url());
|
|
22
33
|
|
|
23
34
|
Tappet::initialise(tappet_get_describe($modelRepository), $environment);
|
package/uniter/defineConfig.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import dotPhpFactoryImport = require('dotphp');
|
|
1
2
|
export interface DefineConfigOptions {
|
|
3
|
+
bootstraps?: string[];
|
|
2
4
|
include?: string[];
|
|
5
|
+
stub?: Record<string, null>;
|
|
6
|
+
stubComposerAutoloadFiles?: boolean;
|
|
3
7
|
}
|
|
4
8
|
export interface PhpifySettings {
|
|
5
9
|
bootstraps?: string[];
|
|
@@ -27,5 +31,5 @@ export interface UniterConfig {
|
|
|
27
31
|
/**
|
|
28
32
|
* Creates the Uniter configuration for Tappet Cypress.
|
|
29
33
|
*/
|
|
30
|
-
export declare function defineConfig(relativeRootDir: string, { include }?: DefineConfigOptions): UniterConfig;
|
|
34
|
+
export declare function defineConfig(configDir: string, relativeRootDir: string, { bootstraps, include, stub, stubComposerAutoloadFiles, }?: DefineConfigOptions, dotPhpFactory?: typeof dotPhpFactoryImport): UniterConfig;
|
|
31
35
|
//# sourceMappingURL=defineConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineConfig.d.ts","sourceRoot":"","sources":["../src/ts/uniter/defineConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"defineConfig.d.ts","sourceRoot":"","sources":["../src/ts/uniter/defineConfig.ts"],"names":[],"mappings":"AAYA,OAAO,mBAAmB,GAAG,QAAQ,QAAQ,CAAC,CAAC;AAI/C,MAAM,WAAW,mBAAmB;IAChC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC5B,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACvC;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,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,MAAM,EACvB,EACI,UAAe,EACf,OAAY,EACZ,IAAS,EACT,yBAAgC,GACnC,GAAE,mBAAwB,EAC3B,aAAa,GAAE,OAAO,mBAAyC,GAChE,YAAY,CA0Ed"}
|
package/uniter/defineConfig.js
CHANGED
|
@@ -48,12 +48,29 @@ exports.defineConfig = defineConfig;
|
|
|
48
48
|
const uniterPlugin = __importStar(require("./plugin/"));
|
|
49
49
|
const path_1 = __importDefault(require("path"));
|
|
50
50
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
51
|
+
const dotPhpFactoryImport = require("dotphp");
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
51
53
|
const phpEvalPlugin = require("phpruntime/src/plugin/eval");
|
|
52
54
|
/**
|
|
53
55
|
* Creates the Uniter configuration for Tappet Cypress.
|
|
54
56
|
*/
|
|
55
|
-
function defineConfig(relativeRootDir, { include = [] } = {}) {
|
|
57
|
+
function defineConfig(configDir, relativeRootDir, { bootstraps = [], include = [], stub = {}, stubComposerAutoloadFiles = true, } = {}, dotPhpFactory = dotPhpFactoryImport) {
|
|
56
58
|
const bootstrapsDir = path_1.default.join(__dirname, 'bootstraps');
|
|
59
|
+
if (stubComposerAutoloadFiles) {
|
|
60
|
+
// Composer autoload files will cause fatal errors if missing from the bundle,
|
|
61
|
+
// as Composer require()'s them - so we must either include them (and any other modules they require)
|
|
62
|
+
// or stub them out for the browser build.
|
|
63
|
+
const dotPhp = dotPhpFactory.create(path_1.default.join(__dirname, 'env/composer/'));
|
|
64
|
+
const autoloadFilesGetterModule = dotPhp.require(path_1.default.resolve(__dirname, 'env/composer/get_autoload_files.php'));
|
|
65
|
+
const projectRoot = path_1.default.resolve(configDir, relativeRootDir);
|
|
66
|
+
const files = autoloadFilesGetterModule().execute().getNative()(projectRoot);
|
|
67
|
+
for (const file of files) {
|
|
68
|
+
// Paths must be relative to the project root.
|
|
69
|
+
const relativeFile = path_1.default.relative(projectRoot, file);
|
|
70
|
+
include.push(relativeFile);
|
|
71
|
+
stub[relativeFile] = null;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
57
74
|
return {
|
|
58
75
|
plugins: [
|
|
59
76
|
// Install PHP eval(...) support.
|
|
@@ -72,17 +89,19 @@ function defineConfig(relativeRootDir, { include = [] } = {}) {
|
|
|
72
89
|
// Pull in Composer's autoloader.
|
|
73
90
|
'vendor/autoload.php',
|
|
74
91
|
path_1.default.join(bootstrapsDir, 'bootstrap.php'),
|
|
92
|
+
...bootstraps,
|
|
75
93
|
],
|
|
76
94
|
include: [
|
|
77
|
-
'tests/tappet/app/**/*.php',
|
|
78
|
-
'vendor/autoload.php',
|
|
79
95
|
'vendor/composer/**/*.php',
|
|
80
96
|
'!vendor/composer/pcre/**',
|
|
81
|
-
'vendor/
|
|
82
|
-
'vendor/
|
|
97
|
+
'vendor/tappet/tappet/src/{Core,Suite}/**/*.php',
|
|
98
|
+
'vendor/tappet/cypress/src/php/**/*.php',
|
|
83
99
|
...include,
|
|
84
100
|
],
|
|
85
101
|
rootDir: relativeRootDir,
|
|
102
|
+
stub: {
|
|
103
|
+
...stub,
|
|
104
|
+
},
|
|
86
105
|
},
|
|
87
106
|
phptojs: {
|
|
88
107
|
lineNumbers: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineConfig.js","sourceRoot":"","sources":["../src/ts/uniter/defineConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"defineConfig.js","sourceRoot":"","sources":["../src/ts/uniter/defineConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,oCAoFC;AA1ID;;;;;;;GAOG;AACH,wDAA0C;AAC1C,gDAAwB;AAExB,iEAAiE;AACjE,8CAA+C;AAC/C,iEAAiE;AACjE,4DAA6D;AAqC7D;;GAEG;AACH,SAAgB,YAAY,CACxB,SAAiB,EACjB,eAAuB,EACvB,EACI,UAAU,GAAG,EAAE,EACf,OAAO,GAAG,EAAE,EACZ,IAAI,GAAG,EAAE,EACT,yBAAyB,GAAG,IAAI,MACX,EAAE,EAC3B,gBAA4C,mBAAmB;IAE/D,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAEzD,IAAI,yBAAyB,EAAE,CAAC;QAC5B,8EAA8E;QAC9E,qGAAqG;QACrG,0CAA0C;QAE1C,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAC/B,cAAI,CAAC,IAAI,CAAC,SAAS,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EAAE,IAAI;aACtB;SACJ;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
/*
|
|
15
|
+
* Fetches the autoload _files_ (a list of paths always required,
|
|
16
|
+
* for defining global functions, which are not autoloaded, for example)
|
|
17
|
+
* of installed Composer dependencies.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
return function (string $projectRoot) {
|
|
21
|
+
$autoloadFiles = require $projectRoot . '/vendor/composer/autoload_files.php';
|
|
22
|
+
|
|
23
|
+
return array_values($autoloadFiles);
|
|
24
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Tappet Cypress - Enjoyable GUI testing with Tappet, using Cypress
|
|
3
|
+
* Copyright (c) Dan Phillimore (asmblah)
|
|
4
|
+
* https://github.com/nytris/tappet-cypress/
|
|
5
|
+
*
|
|
6
|
+
* Released under the MIT license.
|
|
7
|
+
* https://github.com/nytris/tappet-cypress/raw/main/MIT-LICENSE.txt
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
settings: {
|
|
12
|
+
phptojs: {
|
|
13
|
+
// Use sync mode when fetching the Composer autoload files,
|
|
14
|
+
// as the host application's `uniter.config.js` where this is needed will also be loaded synchronously.
|
|
15
|
+
mode: 'sync'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -1 +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,
|
|
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,EAyO/B,CAAC"}
|
|
@@ -21,49 +21,114 @@ exports.addons = [
|
|
|
21
21
|
({ environment }) => {
|
|
22
22
|
const cypressWindow = window;
|
|
23
23
|
const { describe, it, cy, Cypress, fetch } = cypressWindow;
|
|
24
|
-
const apiBaseUrl = Cypress.env('
|
|
24
|
+
const apiBaseUrl = Cypress.env('tappetApiBaseUrl');
|
|
25
|
+
if (!apiBaseUrl) {
|
|
26
|
+
throw new Error('Tappet Cypress: Cypress environment variable "tappetApiBaseUrl" not set');
|
|
27
|
+
}
|
|
28
|
+
const apiKey = Cypress.env('tappetApiKey');
|
|
29
|
+
if (!apiKey) {
|
|
30
|
+
throw new Error('Tappet Cypress: Cypress environment variable "tappetApiKey" not set');
|
|
31
|
+
}
|
|
32
|
+
environment.defineCoercingFunction('tappet_get_base_url', () => {
|
|
33
|
+
return Cypress.config('baseUrl');
|
|
34
|
+
});
|
|
25
35
|
environment.defineCoercingFunction('tappet_get_fixture_api', () => {
|
|
26
36
|
return {
|
|
27
|
-
loadFixture: async (
|
|
28
|
-
|
|
37
|
+
loadFixture: async (fixtureClass, fixturePayload) => {
|
|
38
|
+
const response = await fetch(apiBaseUrl +
|
|
39
|
+
'/.well-known/tappet/fixture/' +
|
|
40
|
+
fixtureClass.replace(/\\/g, '--'), {
|
|
29
41
|
method: 'POST',
|
|
30
|
-
|
|
31
|
-
|
|
42
|
+
headers: {
|
|
43
|
+
Authorization: `Bearer ${apiKey}`,
|
|
44
|
+
'Content-Type': 'application/json',
|
|
45
|
+
},
|
|
46
|
+
// JSON-encode the fixture serialisation payload,
|
|
47
|
+
// as it may contain special characters.
|
|
48
|
+
body: JSON.stringify({
|
|
49
|
+
serialisation: fixturePayload,
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
// Response fixture model's serialisation payload will be JSON-encoded
|
|
53
|
+
// to support special characters.
|
|
54
|
+
return (await response.json()).serialisation;
|
|
32
55
|
},
|
|
33
|
-
|
|
34
|
-
|
|
56
|
+
loadMultipleFixtures: async (fixturesPayload) => {
|
|
57
|
+
const response = await fetch(apiBaseUrl + '/.well-known/tappet/fixtures', {
|
|
35
58
|
method: 'POST',
|
|
59
|
+
headers: {
|
|
60
|
+
Authorization: `Bearer ${apiKey}`,
|
|
61
|
+
'Content-Type': 'application/json',
|
|
62
|
+
},
|
|
63
|
+
// JSON-encode the fixture serialisation payload,
|
|
64
|
+
// as it may contain special characters.
|
|
65
|
+
body: JSON.stringify({
|
|
66
|
+
serialisation: fixturesPayload,
|
|
67
|
+
}),
|
|
68
|
+
});
|
|
69
|
+
// Response fixture models' serialisation payload will be JSON-encoded
|
|
70
|
+
// to support special characters.
|
|
71
|
+
return (await response.json()).serialisation;
|
|
72
|
+
},
|
|
73
|
+
purge: async (modelsToPurge) => {
|
|
74
|
+
await fetch(apiBaseUrl + '/.well-known/tappet/fixtures', {
|
|
75
|
+
method: 'DELETE',
|
|
76
|
+
headers: {
|
|
77
|
+
Authorization: `Bearer ${apiKey}`,
|
|
78
|
+
},
|
|
36
79
|
body: JSON.stringify(modelsToPurge),
|
|
37
|
-
})
|
|
80
|
+
});
|
|
38
81
|
},
|
|
39
82
|
};
|
|
40
83
|
});
|
|
41
84
|
environment.defineCoercingFunction('tappet_get_cypress_api', () => {
|
|
42
85
|
return cy;
|
|
43
86
|
});
|
|
87
|
+
const filterString = Cypress.env('tappetFilter');
|
|
88
|
+
const filterRegex = filterString
|
|
89
|
+
? new RegExp(filterString)
|
|
90
|
+
: null;
|
|
44
91
|
environment.defineCoercingFunction('tappet_get_describe', (modelRepository) => {
|
|
45
|
-
return async (
|
|
92
|
+
return async (module) => {
|
|
46
93
|
const scenarios = [];
|
|
47
|
-
for (const scenario of await
|
|
94
|
+
for (const scenario of await module.getScenarios()) {
|
|
48
95
|
scenarios.push({
|
|
49
96
|
description: await scenario.getDescription(),
|
|
50
97
|
scenario: scenario,
|
|
51
98
|
});
|
|
52
99
|
}
|
|
53
|
-
|
|
100
|
+
const moduleDescription = await module.getDescription();
|
|
101
|
+
const moduleMatchesFilter = filterRegex === null ||
|
|
102
|
+
filterRegex.test(moduleDescription);
|
|
103
|
+
describe(moduleDescription, () => {
|
|
54
104
|
beforeEach(() => {
|
|
55
105
|
// TODO: scenario.beforeEach()?
|
|
56
106
|
// Perform cleanup inside Mocha beforeEach so that it happens regardless of errors.
|
|
57
107
|
cy.then(() => modelRepository.purge());
|
|
58
108
|
});
|
|
59
109
|
for (const { description, scenario, } of scenarios) {
|
|
60
|
-
|
|
110
|
+
const scenarioMatchesFilter = moduleMatchesFilter ||
|
|
111
|
+
filterRegex.test(description);
|
|
112
|
+
(scenarioMatchesFilter ? it : it.skip)(description, () => {
|
|
61
113
|
return cy.then(() => scenario.perform());
|
|
62
114
|
});
|
|
63
115
|
}
|
|
64
116
|
});
|
|
65
117
|
};
|
|
66
118
|
});
|
|
119
|
+
const cypressProjectRoot = Cypress.config('projectRoot');
|
|
120
|
+
const repoRoot = Cypress.config('repoRoot');
|
|
121
|
+
const projectRoot = cypressProjectRoot.startsWith(repoRoot)
|
|
122
|
+
? cypressProjectRoot.substring(repoRoot.length + 1)
|
|
123
|
+
: cypressProjectRoot;
|
|
124
|
+
environment.defineCoercingFunction('tappet_get_cypress_project_root', () => projectRoot);
|
|
125
|
+
const suiteName = Cypress.env('tappetSuite');
|
|
126
|
+
if (!suiteName) {
|
|
127
|
+
throw new Error('Tappet Cypress: Cypress environment variable "tappetSuite" not set');
|
|
128
|
+
}
|
|
129
|
+
environment.defineCoercingFunction('tappet_get_suite_name', () => {
|
|
130
|
+
return suiteName;
|
|
131
|
+
});
|
|
67
132
|
},
|
|
68
133
|
],
|
|
69
134
|
},
|
|
@@ -1 +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,
|
|
1
|
+
{"version":3,"file":"phpcore.config.js","sourceRoot":"","sources":["../../src/ts/uniter/plugin/phpcore.config.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AA0BH;;;;;GAKG;AACU,QAA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