dceky 1.0.24 → 1.0.25
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/lib/src/commands/getCredentialValue.d.ts +18 -0
- package/lib/src/commands/getCredentialValue.js +19 -0
- package/lib/src/commands/getCredentialValue.js.map +1 -0
- package/lib/src/commands/getCredentialValues.d.ts +18 -0
- package/lib/src/commands/getCredentialValues.js +16 -0
- package/lib/src/commands/getCredentialValues.js.map +1 -0
- package/lib/src/commands/getProfileValue.d.ts +15 -0
- package/lib/src/commands/getProfileValue.js +16 -0
- package/lib/src/commands/getProfileValue.js.map +1 -0
- package/lib/src/commands/index.js +6 -0
- package/lib/src/commands/index.js.map +1 -1
- package/lib/src/genConfiguration/index.js +7 -4
- package/lib/src/genConfiguration/index.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/getCredentialValue.ts +45 -0
- package/src/commands/getCredentialValues.ts +43 -0
- package/src/commands/getProfileValue.ts +40 -0
- package/src/commands/index.ts +6 -0
- package/src/genConfiguration/index.ts +11 -4
- package/cypress/e2e/profile-test.cy.ts +0 -10
- package/cypress/fixtures/example.json +0 -5
- package/cypress/support/commands.ts +0 -37
- package/cypress/support/e2e.ts +0 -17
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Alias for cy.env for retrieving a single environment variable
|
|
6
|
+
* Obtains a credential value from the Cypress env depending on
|
|
7
|
+
* the provided key.
|
|
8
|
+
* @author Allison Zhang
|
|
9
|
+
* @param key the key of the environment variable to retrieve
|
|
10
|
+
* @return The value of the specified environment variable
|
|
11
|
+
* the corresponding environment variable values from global credentials
|
|
12
|
+
*/
|
|
13
|
+
getCredentialValue(key: string): Chainable<any>;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
declare const getCredentialValue: () => void;
|
|
18
|
+
export default getCredentialValue;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var getCredentialValue = function () {
|
|
8
|
+
Cypress.Commands.add('getCredentialValue', function (key) {
|
|
9
|
+
return cy.env([key]).then(function (_a) {
|
|
10
|
+
var _b = key, value = _a[_b];
|
|
11
|
+
return cy.wrap(value);
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
/*----------------------------------------*/
|
|
16
|
+
/* --------------- Export --------------- */
|
|
17
|
+
/*----------------------------------------*/
|
|
18
|
+
exports.default = getCredentialValue;
|
|
19
|
+
//# sourceMappingURL=getCredentialValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCredentialValue.js","sourceRoot":"","sources":["../../../src/commands/getCredentialValue.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAyBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,kBAAkB,GAAG;IACzB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,oBAAoB,EACpB,UAAC,GAAG;QACF,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,UAAC,EAAgB;gBAAd,KAAC,GAAI,EAAE,KAAK,SAAA;YACvC,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Alias for cy.env for retrieving multiple environment variables at once
|
|
6
|
+
* Obtains multiple credential values from the Cypress env depending on
|
|
7
|
+
* the provided keys.
|
|
8
|
+
* @author Allison Zhang
|
|
9
|
+
* @param keys the keys of the environment variables to retrieve
|
|
10
|
+
* @return Object where keys are the provided keys and the values are
|
|
11
|
+
* the corresponding environment variable values from global credentials
|
|
12
|
+
*/
|
|
13
|
+
getCredentialValues(keys: string[]): Chainable<Record<string, any>>;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
declare const getCredentialValues: () => void;
|
|
18
|
+
export default getCredentialValues;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var getCredentialValues = function () {
|
|
8
|
+
Cypress.Commands.add('getCredentialValues', function (keys) {
|
|
9
|
+
return cy.env(keys);
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
/*----------------------------------------*/
|
|
13
|
+
/* --------------- Export --------------- */
|
|
14
|
+
/*----------------------------------------*/
|
|
15
|
+
exports.default = getCredentialValues;
|
|
16
|
+
//# sourceMappingURL=getCredentialValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getCredentialValues.js","sourceRoot":"","sources":["../../../src/commands/getCredentialValues.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAyBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,mBAAmB,GAAG;IAC1B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,qBAAqB,EACrB,UAAC,IAAI;QACH,OAAO,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Alias for Cypress.expose
|
|
6
|
+
* @author Allison Zhang
|
|
7
|
+
* @param key the key of the environment variable to retrieve
|
|
8
|
+
* @return Environment variable from the exposed environment
|
|
9
|
+
*/
|
|
10
|
+
getProfileValue(key: string): ObjectLike;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
declare const getProfileValue: () => void;
|
|
15
|
+
export default getProfileValue;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var getProfileValue = function () {
|
|
8
|
+
Cypress.Commands.add('getProfileValue', function (key) {
|
|
9
|
+
return Cypress.expose(key);
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
/*----------------------------------------*/
|
|
13
|
+
/* --------------- Export --------------- */
|
|
14
|
+
/*----------------------------------------*/
|
|
15
|
+
exports.default = getProfileValue;
|
|
16
|
+
//# sourceMappingURL=getProfileValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getProfileValue.js","sourceRoot":"","sources":["../../../src/commands/getProfileValue.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAsBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,eAAe,GAAG;IACtB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,iBAAiB,EACjB,UAAC,GAAG;QACF,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,eAAe,CAAC"}
|
|
@@ -34,6 +34,9 @@ var uniquify_1 = __importDefault(require("./uniquify"));
|
|
|
34
34
|
var visitCanvasEndpoint_1 = __importDefault(require("./visitCanvasEndpoint"));
|
|
35
35
|
var waitForAtLeastOneElementPresent_1 = __importDefault(require("./waitForAtLeastOneElementPresent"));
|
|
36
36
|
var waitForElementVisible_1 = __importDefault(require("./waitForElementVisible"));
|
|
37
|
+
var getProfileValue_1 = __importDefault(require("./getProfileValue"));
|
|
38
|
+
var getCredentialValue_1 = __importDefault(require("./getCredentialValue"));
|
|
39
|
+
var getCredentialValues_1 = __importDefault(require("./getCredentialValues"));
|
|
37
40
|
/**
|
|
38
41
|
* Initialize custom commands
|
|
39
42
|
* @author Gabe Abrams
|
|
@@ -70,6 +73,9 @@ var commands = function () {
|
|
|
70
73
|
(0, visitCanvasEndpoint_1.default)();
|
|
71
74
|
(0, waitForAtLeastOneElementPresent_1.default)();
|
|
72
75
|
(0, waitForElementVisible_1.default)();
|
|
76
|
+
(0, getProfileValue_1.default)();
|
|
77
|
+
(0, getCredentialValue_1.default)();
|
|
78
|
+
(0, getCredentialValues_1.default)();
|
|
73
79
|
};
|
|
74
80
|
exports.default = commands;
|
|
75
81
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":";;;;;AAAA,sBAAsB;AACtB,oFAA8D;AAC9D,oEAA8C;AAC9C,0EAAoD;AACpD,gFAA0D;AAC1D,gFAA0D;AAC1D,oGAA8E;AAC9E,sEAAgD;AAChD,gEAA0C;AAC1C,gEAA0C;AAC1C,4EAAsD;AACtD,kDAA4B;AAC5B,sDAAgC;AAChC,oEAA8C;AAC9C,sEAAgD;AAChD,wDAAkC;AAClC,wEAAkD;AAClD,wDAAkC;AAClC,wEAAkD;AAClD,wEAAkD;AAClD,gEAA0C;AAC1C,oEAA8C;AAC9C,gEAA0C;AAC1C,0DAAoC;AACpC,8CAAwB;AACxB,8DAAwC;AACxC,wDAAkC;AAClC,wDAAkC;AAClC,8EAAwD;AACxD,sGAAgF;AAChF,kFAA4D;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/index.ts"],"names":[],"mappings":";;;;;AAAA,sBAAsB;AACtB,oFAA8D;AAC9D,oEAA8C;AAC9C,0EAAoD;AACpD,gFAA0D;AAC1D,gFAA0D;AAC1D,oGAA8E;AAC9E,sEAAgD;AAChD,gEAA0C;AAC1C,gEAA0C;AAC1C,4EAAsD;AACtD,kDAA4B;AAC5B,sDAAgC;AAChC,oEAA8C;AAC9C,sEAAgD;AAChD,wDAAkC;AAClC,wEAAkD;AAClD,wDAAkC;AAClC,wEAAkD;AAClD,wEAAkD;AAClD,gEAA0C;AAC1C,oEAA8C;AAC9C,gEAA0C;AAC1C,0DAAoC;AACpC,8CAAwB;AACxB,8DAAwC;AACxC,wDAAkC;AAClC,wDAAkC;AAClC,8EAAwD;AACxD,sGAAgF;AAChF,kFAA4D;AAC5D,sEAAgD;AAChD,4EAAsD;AACtD,8EAAwD;AAExD;;;GAGG;AACH,IAAM,QAAQ,GAAG;IACf,6BAA6B;IAC7B,IAAA,gCAAsB,GAAE,CAAC;IACzB,IAAA,wBAAc,GAAE,CAAC;IACjB,IAAA,2BAAiB,GAAE,CAAC;IACpB,IAAA,8BAAoB,GAAE,CAAC;IACvB,IAAA,8BAAoB,GAAE,CAAC;IACvB,IAAA,wCAA8B,GAAE,CAAC;IACjC,IAAA,yBAAe,GAAE,CAAC;IAClB,IAAA,sBAAY,GAAE,CAAC;IACf,IAAA,sBAAY,GAAE,CAAC;IACf,IAAA,4BAAkB,GAAE,CAAC;IACrB,IAAA,eAAK,GAAE,CAAC;IACR,IAAA,iBAAO,GAAE,CAAC;IACV,IAAA,wBAAc,GAAE,CAAC;IACjB,IAAA,yBAAe,GAAE,CAAC;IAClB,IAAA,kBAAQ,GAAE,CAAC;IACX,IAAA,0BAAgB,GAAE,CAAC;IACnB,IAAA,kBAAQ,GAAE,CAAC;IACX,IAAA,0BAAgB,GAAE,CAAC;IACnB,IAAA,0BAAgB,GAAE,CAAC;IACnB,IAAA,sBAAY,GAAE,CAAC;IACf,IAAA,wBAAc,GAAE,CAAC;IACjB,IAAA,sBAAY,GAAE,CAAC;IACf,IAAA,mBAAS,GAAE,CAAC;IACZ,IAAA,aAAG,GAAE,CAAC;IACN,IAAA,qBAAW,GAAE,CAAC;IACd,IAAA,kBAAQ,GAAE,CAAC;IACX,IAAA,kBAAQ,GAAE,CAAC;IACX,IAAA,6BAAmB,GAAE,CAAC;IACtB,IAAA,yCAA+B,GAAE,CAAC;IAClC,IAAA,+BAAqB,GAAE,CAAC;IACxB,IAAA,yBAAe,GAAE,CAAC;IAClB,IAAA,4BAAkB,GAAE,CAAC;IACrB,IAAA,6BAAmB,GAAE,CAAC;AACxB,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
|
@@ -70,7 +70,6 @@ var genConfiguration = function () {
|
|
|
70
70
|
}
|
|
71
71
|
// NOTE: Order matters (later overrides earlier)
|
|
72
72
|
var sources = [
|
|
73
|
-
GlobalCredentials,
|
|
74
73
|
GlobalResources,
|
|
75
74
|
GlobalValues,
|
|
76
75
|
profileModules,
|
|
@@ -92,8 +91,11 @@ var genConfiguration = function () {
|
|
|
92
91
|
// Resolve dependencies
|
|
93
92
|
var dependents = (0, resolveDependents_1.default)(dependentValues, basics);
|
|
94
93
|
// Add basics, depends, and profileName into the final env
|
|
95
|
-
var
|
|
96
|
-
|
|
94
|
+
var exposed = __assign(__assign(__assign({}, basics), dependents), { profileName: profileName });
|
|
95
|
+
// Add all global values and credentials into the final env
|
|
96
|
+
// Does not support dependent values in GlobalCredentials, TODO: Fix
|
|
97
|
+
var securedEnv = __assign(__assign({}, GlobalCredentials), exposed);
|
|
98
|
+
var baseUrl = exposed.baseURL;
|
|
97
99
|
if (!(baseUrl === null || baseUrl === void 0 ? void 0 : baseUrl.startsWith('http'))) {
|
|
98
100
|
baseUrl = "https://".concat(baseUrl);
|
|
99
101
|
}
|
|
@@ -103,7 +105,8 @@ var genConfiguration = function () {
|
|
|
103
105
|
experimentalWebKitSupport: true,
|
|
104
106
|
experimentalOriginDependencies: true,
|
|
105
107
|
baseUrl: baseUrl,
|
|
106
|
-
|
|
108
|
+
expose: exposed,
|
|
109
|
+
env: securedEnv,
|
|
107
110
|
},
|
|
108
111
|
});
|
|
109
112
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/genConfiguration/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+BAA+B;AAC/B,mCAAmC;AACnC,8CAA8C;AAC9C,8CAAwB;AAExB,iBAAiB;AACjB,mCAAuC;AAEvC,4BAA4B;AAC5B,wDAAkC;AAElC,iBAAiB;AACjB,gEAA0C;AAC1C,kFAA4D;AAC5D,sEAAgD;AAMhD,8BAA8B;AAC9B,IAAM,GAAG,GAAG,IAAA,qBAAW,GAAE,CAAC;AAE1B;;;;;GAKG;AACH,IAAM,gBAAgB,GAAG;;IACvB,eAAe;IACf,IAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;IACxD,IAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC;IAE1D,gCAAgC;IAChC,IAAM,iBAAiB,GAAqB,OAAO,CAAC,cAAI,CAAC,IAAI,CAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC,CAAC,OAAO,CAAC;IAC3G,IAAM,eAAe,GAAqB,OAAO,CAAC,cAAI,CAAC,IAAI,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAA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C,CAAC;IACH,IAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAC,UAAC,CAAC;QACnC,OAAO,CAAC,CAAC,SAAS,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,0BAA0B;IAC1B,IAAM,MAAM,GAAqB,mBAAS,CAAC,GAAG,CAAmB,WAAW,CAAC,CAAC;IAE9E,uBAAuB;IACvB,IAAM,UAAU,GAAqB,IAAA,2BAAiB,EAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IAEhF,0DAA0D;IAC1D,IAAM,OAAO,kCACR,MAAM,GACN,UAAU,KACb,WAAW,aAAA,GACZ,CAAC;IAEF,2DAA2D;IAC3D,oEAAoE;IACpE,IAAM,UAAU,yBACX,iBAAiB,GACjB,OAAO,CACX,CAAC;IAEF,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAC9B,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,CAAC,MAAM,CAAC,CAAA,EAAE,CAAC;QACjC,OAAO,GAAG,kBAAW,OAAO,CAAE,CAAC;IACjC,CAAC;IAED,kCAAkC;IAClC,OAAO,IAAA,sBAAY,EAAC;QAClB,GAAG,EAAE;YACH,yBAAyB,EAAE,IAAI;YAC/B,8BAA8B,EAAE,IAAI;YACpC,OAAO,SAAA;YACP,MAAM,EAAE,OAAO;YACf,GAAG,EAAE,UAAU;SAChB;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,kBAAe,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
|
|
3
|
+
/*----------------------------------------*/
|
|
4
|
+
/* ---------------- Type ---------------- */
|
|
5
|
+
/*----------------------------------------*/
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
namespace Cypress {
|
|
9
|
+
interface Chainable {
|
|
10
|
+
/**
|
|
11
|
+
* Alias for cy.env for retrieving a single environment variable
|
|
12
|
+
* Obtains a credential value from the Cypress env depending on
|
|
13
|
+
* the provided key.
|
|
14
|
+
* @author Allison Zhang
|
|
15
|
+
* @param key the key of the environment variable to retrieve
|
|
16
|
+
* @return The value of the specified environment variable
|
|
17
|
+
* the corresponding environment variable values from global credentials
|
|
18
|
+
*/
|
|
19
|
+
getCredentialValue(
|
|
20
|
+
key: string,
|
|
21
|
+
): Chainable<any>;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/*----------------------------------------*/
|
|
27
|
+
/* --------------- Command -------------- */
|
|
28
|
+
/*----------------------------------------*/
|
|
29
|
+
|
|
30
|
+
const getCredentialValue = () => {
|
|
31
|
+
Cypress.Commands.add(
|
|
32
|
+
'getCredentialValue',
|
|
33
|
+
(key) => {
|
|
34
|
+
return cy.env([key]).then(({ [key]: value }) => {
|
|
35
|
+
return cy.wrap(value);
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/*----------------------------------------*/
|
|
42
|
+
/* --------------- Export --------------- */
|
|
43
|
+
/*----------------------------------------*/
|
|
44
|
+
|
|
45
|
+
export default getCredentialValue;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
|
|
3
|
+
/*----------------------------------------*/
|
|
4
|
+
/* ---------------- Type ---------------- */
|
|
5
|
+
/*----------------------------------------*/
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
namespace Cypress {
|
|
9
|
+
interface Chainable {
|
|
10
|
+
/**
|
|
11
|
+
* Alias for cy.env for retrieving multiple environment variables at once
|
|
12
|
+
* Obtains multiple credential values from the Cypress env depending on
|
|
13
|
+
* the provided keys.
|
|
14
|
+
* @author Allison Zhang
|
|
15
|
+
* @param keys the keys of the environment variables to retrieve
|
|
16
|
+
* @return Object where keys are the provided keys and the values are
|
|
17
|
+
* the corresponding environment variable values from global credentials
|
|
18
|
+
*/
|
|
19
|
+
getCredentialValues(
|
|
20
|
+
keys: string[],
|
|
21
|
+
): Chainable<Record<string, any>>;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/*----------------------------------------*/
|
|
27
|
+
/* --------------- Command -------------- */
|
|
28
|
+
/*----------------------------------------*/
|
|
29
|
+
|
|
30
|
+
const getCredentialValues = () => {
|
|
31
|
+
Cypress.Commands.add(
|
|
32
|
+
'getCredentialValues',
|
|
33
|
+
(keys) => {
|
|
34
|
+
return cy.env(keys);
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/*----------------------------------------*/
|
|
40
|
+
/* --------------- Export --------------- */
|
|
41
|
+
/*----------------------------------------*/
|
|
42
|
+
|
|
43
|
+
export default getCredentialValues;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
|
|
3
|
+
/*----------------------------------------*/
|
|
4
|
+
/* ---------------- Type ---------------- */
|
|
5
|
+
/*----------------------------------------*/
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
namespace Cypress {
|
|
9
|
+
interface Chainable {
|
|
10
|
+
/**
|
|
11
|
+
* Alias for Cypress.expose
|
|
12
|
+
* @author Allison Zhang
|
|
13
|
+
* @param key the key of the environment variable to retrieve
|
|
14
|
+
* @return Environment variable from the exposed environment
|
|
15
|
+
*/
|
|
16
|
+
getProfileValue(
|
|
17
|
+
key: string,
|
|
18
|
+
): ObjectLike;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/*----------------------------------------*/
|
|
24
|
+
/* --------------- Command -------------- */
|
|
25
|
+
/*----------------------------------------*/
|
|
26
|
+
|
|
27
|
+
const getProfileValue = () => {
|
|
28
|
+
Cypress.Commands.add(
|
|
29
|
+
'getProfileValue',
|
|
30
|
+
(key) => {
|
|
31
|
+
return Cypress.expose(key);
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/*----------------------------------------*/
|
|
37
|
+
/* --------------- Export --------------- */
|
|
38
|
+
/*----------------------------------------*/
|
|
39
|
+
|
|
40
|
+
export default getProfileValue;
|
package/src/commands/index.ts
CHANGED
|
@@ -29,6 +29,9 @@ import uniquify from './uniquify';
|
|
|
29
29
|
import visitCanvasEndpoint from './visitCanvasEndpoint';
|
|
30
30
|
import waitForAtLeastOneElementPresent from './waitForAtLeastOneElementPresent';
|
|
31
31
|
import waitForElementVisible from './waitForElementVisible';
|
|
32
|
+
import getProfileValue from './getProfileValue';
|
|
33
|
+
import getCredentialValue from './getCredentialValue';
|
|
34
|
+
import getCredentialValues from './getCredentialValues';
|
|
32
35
|
|
|
33
36
|
/**
|
|
34
37
|
* Initialize custom commands
|
|
@@ -66,6 +69,9 @@ const commands = () => {
|
|
|
66
69
|
visitCanvasEndpoint();
|
|
67
70
|
waitForAtLeastOneElementPresent();
|
|
68
71
|
waitForElementVisible();
|
|
72
|
+
getProfileValue();
|
|
73
|
+
getCredentialValue();
|
|
74
|
+
getCredentialValues();
|
|
69
75
|
};
|
|
70
76
|
|
|
71
77
|
export default commands;
|
|
@@ -65,7 +65,6 @@ const genConfiguration = () => {
|
|
|
65
65
|
|
|
66
66
|
// NOTE: Order matters (later overrides earlier)
|
|
67
67
|
const sources: GlobalsOrProfile[] = [
|
|
68
|
-
GlobalCredentials,
|
|
69
68
|
GlobalResources,
|
|
70
69
|
GlobalValues,
|
|
71
70
|
profileModules,
|
|
@@ -92,13 +91,20 @@ const genConfiguration = () => {
|
|
|
92
91
|
const dependents: GlobalsOrProfile = resolveDependents(dependentValues, basics);
|
|
93
92
|
|
|
94
93
|
// Add basics, depends, and profileName into the final env
|
|
95
|
-
const
|
|
94
|
+
const exposed: GlobalsOrProfile = {
|
|
96
95
|
...basics,
|
|
97
96
|
...dependents,
|
|
98
97
|
profileName,
|
|
99
98
|
};
|
|
100
99
|
|
|
101
|
-
|
|
100
|
+
// Add all global values and credentials into the final env
|
|
101
|
+
// Does not support dependent values in GlobalCredentials, TODO: Fix
|
|
102
|
+
const securedEnv = {
|
|
103
|
+
...GlobalCredentials,
|
|
104
|
+
...exposed,
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
let baseUrl = exposed.baseURL;
|
|
102
108
|
if (!baseUrl?.startsWith('http')) {
|
|
103
109
|
baseUrl = `https://${baseUrl}`;
|
|
104
110
|
}
|
|
@@ -109,7 +115,8 @@ const genConfiguration = () => {
|
|
|
109
115
|
experimentalWebKitSupport: true,
|
|
110
116
|
experimentalOriginDependencies: true,
|
|
111
117
|
baseUrl,
|
|
112
|
-
|
|
118
|
+
expose: exposed,
|
|
119
|
+
env: securedEnv,
|
|
113
120
|
},
|
|
114
121
|
});
|
|
115
122
|
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/// <reference types="cypress" />
|
|
2
|
-
// ***********************************************
|
|
3
|
-
// This example commands.ts shows you how to
|
|
4
|
-
// create various custom commands and overwrite
|
|
5
|
-
// existing commands.
|
|
6
|
-
//
|
|
7
|
-
// For more comprehensive examples of custom
|
|
8
|
-
// commands please read more here:
|
|
9
|
-
// https://on.cypress.io/custom-commands
|
|
10
|
-
// ***********************************************
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
// -- This is a parent command --
|
|
14
|
-
// Cypress.Commands.add('login', (email, password) => { ... })
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
// -- This is a child command --
|
|
18
|
-
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
// -- This is a dual command --
|
|
22
|
-
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
// -- This will overwrite an existing command --
|
|
26
|
-
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
|
27
|
-
//
|
|
28
|
-
// declare global {
|
|
29
|
-
// namespace Cypress {
|
|
30
|
-
// interface Chainable {
|
|
31
|
-
// login(email: string, password: string): Chainable<void>
|
|
32
|
-
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
|
|
33
|
-
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
|
|
34
|
-
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
|
|
35
|
-
// }
|
|
36
|
-
// }
|
|
37
|
-
// }
|
package/cypress/support/e2e.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// ***********************************************************
|
|
2
|
-
// This example support/e2e.ts is processed and
|
|
3
|
-
// loaded automatically before your test files.
|
|
4
|
-
//
|
|
5
|
-
// This is a great place to put global configuration and
|
|
6
|
-
// behavior that modifies Cypress.
|
|
7
|
-
//
|
|
8
|
-
// You can change the location of this file or turn off
|
|
9
|
-
// automatically serving support files with the
|
|
10
|
-
// 'supportFile' configuration option.
|
|
11
|
-
//
|
|
12
|
-
// You can read more here:
|
|
13
|
-
// https://on.cypress.io/configuration
|
|
14
|
-
// ***********************************************************
|
|
15
|
-
|
|
16
|
-
// Import commands.js using ES2015 syntax:
|
|
17
|
-
import './commands'
|