dceky 1.0.6 → 1.0.7
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/setup/checkRequiredFiles/genExampleTest.d.ts +9 -0
- package/lib/setup/checkRequiredFiles/genExampleTest.js +46 -0
- package/lib/setup/checkRequiredFiles/genExampleTest.js.map +1 -0
- package/lib/setup/checkRequiredFiles/index.js +3 -0
- package/lib/setup/checkRequiredFiles/index.js.map +1 -1
- package/lib/src/commands/index.js +2 -0
- package/lib/src/commands/index.js.map +1 -1
- package/lib/src/commands/tap.d.ts +15 -0
- package/lib/src/commands/tap.js +16 -0
- package/lib/src/commands/tap.js.map +1 -0
- package/lib/src/commands/uniquify.d.ts +1 -1
- package/lib/src/commands/uniquify.js +1 -1
- package/lib/src/commands/uniquify.js.map +1 -1
- package/package.json +1 -1
- package/setup/checkRequiredFiles/genExampleTest.ts +46 -0
- package/setup/checkRequiredFiles/index.ts +4 -0
- package/src/commands/index.ts +2 -0
- package/src/commands/tap.ts +42 -0
- package/src/commands/uniquify.ts +2 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generate an example test file at /cypress/e2e/example.test.ts
|
|
3
|
+
* Does not create test file if e2e folder already exists
|
|
4
|
+
* @author Gabe Abrams
|
|
5
|
+
* @author Yuen Ler Chow
|
|
6
|
+
* @author Allison Zhang
|
|
7
|
+
*/
|
|
8
|
+
declare const genExampleTest: () => void;
|
|
9
|
+
export default genExampleTest;
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
var fs_1 = __importDefault(require("fs"));
|
|
7
|
+
var path_1 = __importDefault(require("path"));
|
|
8
|
+
// Import shared helpers
|
|
9
|
+
var getRootPath_1 = __importDefault(require("../helpers/getRootPath"));
|
|
10
|
+
/**
|
|
11
|
+
* Generate an example test file at /cypress/e2e/example.test.ts
|
|
12
|
+
* Does not create test file if e2e folder already exists
|
|
13
|
+
* @author Gabe Abrams
|
|
14
|
+
* @author Yuen Ler Chow
|
|
15
|
+
* @author Allison Zhang
|
|
16
|
+
*/
|
|
17
|
+
var genExampleTest = function () {
|
|
18
|
+
var root = (0, getRootPath_1.default)();
|
|
19
|
+
// Log the action
|
|
20
|
+
// eslint-disable-next-line no-console
|
|
21
|
+
console.log('Adding dummy test file: e2e/example.test.ts');
|
|
22
|
+
var e2eDir = path_1.default.join(root, 'cypress/e2e');
|
|
23
|
+
var outputFile = path_1.default.join(e2eDir, 'example.test.ts');
|
|
24
|
+
// Check if the directory exists
|
|
25
|
+
if (!fs_1.default.existsSync(e2eDir)) {
|
|
26
|
+
// Create the directory
|
|
27
|
+
fs_1.default.mkdirSync(e2eDir, { recursive: true });
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
// Create an empty file with a comment
|
|
33
|
+
var fileContents = [
|
|
34
|
+
'describe(\'Example Test Suite\', () => {',
|
|
35
|
+
' it(\'Should fill out form\', () => {',
|
|
36
|
+
' cy.visit(\'https://formy-project.herokuapp.com/form\');',
|
|
37
|
+
' cy.typeInto({ item: \'#first-name\', text: \'John\' });',
|
|
38
|
+
' cy.tap(\'#radio-button-2\');',
|
|
39
|
+
' });',
|
|
40
|
+
'});',
|
|
41
|
+
'',
|
|
42
|
+
];
|
|
43
|
+
fs_1.default.writeFileSync(outputFile, fileContents.join('\n'), 'utf8');
|
|
44
|
+
};
|
|
45
|
+
exports.default = genExampleTest;
|
|
46
|
+
//# sourceMappingURL=genExampleTest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"genExampleTest.js","sourceRoot":"","sources":["../../../setup/checkRequiredFiles/genExampleTest.ts"],"names":[],"mappings":";;;;;AAAA,0CAAoB;AACpB,8CAAwB;AAExB,wBAAwB;AACxB,uEAAiD;AAEjD;;;;;;GAMG;AACH,IAAM,cAAc,GAAG;IACrB,IAAM,IAAI,GAAG,IAAA,qBAAW,GAAE,CAAC;IAE3B,iBAAiB;IACjB,sCAAsC;IACtC,OAAO,CAAC,GAAG,CAAC,6CAA6C,CAAC,CAAC;IAE3D,IAAM,MAAM,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAC9C,IAAM,UAAU,GAAG,cAAI,CAAC,IAAI,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAExD,gCAAgC;IAChC,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,uBAAuB;QACvB,YAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;SAAM,CAAC;QACN,OAAO;IACT,CAAC;IAED,sCAAsC;IACtC,IAAM,YAAY,GAAG;QACnB,0CAA0C;QAC1C,wCAAwC;QACxC,6DAA6D;QAC7D,6DAA6D;QAC7D,kCAAkC;QAClC,OAAO;QACP,KAAK;QACL,EAAE;KACH,CAAC;IACF,YAAE,CAAC,aAAa,CAAC,UAAU,EAAE,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF,kBAAe,cAAc,CAAC"}
|
|
@@ -10,6 +10,7 @@ var path_1 = __importDefault(require("path"));
|
|
|
10
10
|
var getRootPath_1 = __importDefault(require("../helpers/getRootPath"));
|
|
11
11
|
var genEmptyGlobalFile_1 = __importDefault(require("./genEmptyGlobalFile"));
|
|
12
12
|
var genEmptyProfileFile_1 = __importDefault(require("./genEmptyProfileFile"));
|
|
13
|
+
var genExampleTest_1 = __importDefault(require("./genExampleTest"));
|
|
13
14
|
/**
|
|
14
15
|
* Ensure required configuration files exist in the consumer repo
|
|
15
16
|
* @author Yuen Ler Chow
|
|
@@ -49,6 +50,8 @@ var checkRequiredFiles = function () {
|
|
|
49
50
|
if (!defaultProfileFound) {
|
|
50
51
|
(0, genEmptyProfileFile_1.default)(defaultProfileName);
|
|
51
52
|
}
|
|
53
|
+
// Generate example test file
|
|
54
|
+
(0, genExampleTest_1.default)();
|
|
52
55
|
};
|
|
53
56
|
exports.default = checkRequiredFiles;
|
|
54
57
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../setup/checkRequiredFiles/index.ts"],"names":[],"mappings":";;;;;AAAA,cAAc;AACd,yBAAgC;AAChC,8CAAwB;AAExB,wBAAwB;AACxB,uEAAiD;AACjD,4EAAsD;AACtD,8EAAwD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../setup/checkRequiredFiles/index.ts"],"names":[],"mappings":";;;;;AAAA,cAAc;AACd,yBAAgC;AAChC,8CAAwB;AAExB,wBAAwB;AACxB,uEAAiD;AACjD,4EAAsD;AACtD,8EAAwD;AACxD,oEAA8C;AAE9C;;;GAGG;AACH,IAAM,kBAAkB,GAAG;IACzB,IAAM,IAAI,GAAG,IAAA,qBAAW,GAAE,CAAC;IAE3B,IAAM,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;IACvD,IAAM,YAAY,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;IAEzD,wBAAwB;IACxB,IAAM,eAAe,GAAG;QACtB,aAAa;QACb,WAAW;QACX,QAAQ;KACT,CAAC;IAEF,iDAAiD;IACjD,IAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,OAAO,CAAC;IAC3D,IAAM,kBAAkB,GAAG,SAAS,CAAC;IACrC,IAAM,eAAe,GAAG,UAAG,WAAW,gBAAa,CAAC;IAEpD,qBAAqB;IACrB,eAAe,CAAC,OAAO,CAAC,UAAC,UAAU;QACjC,IAAM,QAAQ,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,gBAAS,UAAU,QAAK,CAAC,CAAC;QAClE,IAAM,KAAK,GAAG,IAAA,eAAU,EAAC,QAAQ,CAAC,CAAC;QACnC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,kBAAkB;YAClB,IAAA,4BAAkB,EAAC,UAAU,CAAC,CAAC;QACjC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,qBAAqB;IACrB,IAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;IACjE,IAAM,YAAY,GAAG,IAAA,eAAU,EAAC,eAAe,CAAC,CAAC;IACjD,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,IAAA,6BAAmB,EAAC,WAAW,CAAC,CAAC;IACnC,CAAC;IACD,6BAA6B;IAC7B,IAAM,sBAAsB,GAAG,cAAI,CAAC,IAAI,CAAC,YAAY,EAAE,UAAG,kBAAkB,gBAAa,CAAC,CAAC;IAC3F,IAAM,mBAAmB,GAAG,IAAA,eAAU,EAAC,sBAAsB,CAAC,CAAC;IAC/D,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,IAAA,6BAAmB,EAAC,kBAAkB,CAAC,CAAC;IAC1C,CAAC;IAED,6BAA6B;IAC7B,IAAA,wBAAc,GAAE,CAAC;AACnB,CAAC,CAAC;AAEF,kBAAe,kBAAkB,CAAC"}
|
|
@@ -28,6 +28,7 @@ var padWithZeros_1 = __importDefault(require("./padWithZeros"));
|
|
|
28
28
|
var runScript_1 = __importDefault(require("./runScript"));
|
|
29
29
|
var typeInto_1 = __importDefault(require("./typeInto"));
|
|
30
30
|
var uniquify_1 = __importDefault(require("./uniquify"));
|
|
31
|
+
var tap_1 = __importDefault(require("./tap"));
|
|
31
32
|
var visitCanvasEndpoint_1 = __importDefault(require("./visitCanvasEndpoint"));
|
|
32
33
|
var waitForAtLeastOneElementPresent_1 = __importDefault(require("./waitForAtLeastOneElementPresent"));
|
|
33
34
|
var waitForElementVisible_1 = __importDefault(require("./waitForElementVisible"));
|
|
@@ -61,6 +62,7 @@ var commands = function () {
|
|
|
61
62
|
(0, runScript_1.default)();
|
|
62
63
|
(0, typeInto_1.default)();
|
|
63
64
|
(0, uniquify_1.default)();
|
|
65
|
+
(0, tap_1.default)();
|
|
64
66
|
(0, visitCanvasEndpoint_1.default)();
|
|
65
67
|
(0, waitForAtLeastOneElementPresent_1.default)();
|
|
66
68
|
(0, waitForElementVisible_1.default)();
|
|
@@ -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,oGAA8E;AAC9E,sEAAgD;AAChD,gEAA0C;AAC1C,gEAA0C;AAC1C,4EAAsD;AACtD,kDAA4B;AAC5B,sDAAgC;AAChC,oEAA8C;AAC9C,sEAAgD;AAChD,wDAAkC;AAClC,wEAAkD;AAClD,wDAAkC;AAClC,8EAAwD;AACxD,wEAAkD;AAClD,wEAAkD;AAClD,oEAA8C;AAC9C,gEAA0C;AAC1C,0DAAoC;AACpC,wDAAkC;AAClC,wDAAkC;AAClC,8EAAwD;AACxD,sGAAgF;AAChF,kFAA4D;AAE5D;;;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,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,6BAAmB,GAAE,CAAC;IACtB,IAAA,0BAAgB,GAAE,CAAC;IACnB,IAAA,0BAAgB,GAAE,CAAC;IACnB,IAAA,wBAAc,GAAE,CAAC;IACjB,IAAA,sBAAY,GAAE,CAAC;IACf,IAAA,mBAAS,GAAE,CAAC;IACZ,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;AAC1B,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
|
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,oGAA8E;AAC9E,sEAAgD;AAChD,gEAA0C;AAC1C,gEAA0C;AAC1C,4EAAsD;AACtD,kDAA4B;AAC5B,sDAAgC;AAChC,oEAA8C;AAC9C,sEAAgD;AAChD,wDAAkC;AAClC,wEAAkD;AAClD,wDAAkC;AAClC,8EAAwD;AACxD,wEAAkD;AAClD,wEAAkD;AAClD,oEAA8C;AAC9C,gEAA0C;AAC1C,0DAAoC;AACpC,wDAAkC;AAClC,wDAAkC;AAClC,8CAAwB;AACxB,8EAAwD;AACxD,sGAAgF;AAChF,kFAA4D;AAE5D;;;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,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,6BAAmB,GAAE,CAAC;IACtB,IAAA,0BAAgB,GAAE,CAAC;IACnB,IAAA,0BAAgB,GAAE,CAAC;IACnB,IAAA,wBAAc,GAAE,CAAC;IACjB,IAAA,sBAAY,GAAE,CAAC;IACf,IAAA,mBAAS,GAAE,CAAC;IACZ,IAAA,kBAAQ,GAAE,CAAC;IACX,IAAA,kBAAQ,GAAE,CAAC;IACX,IAAA,aAAG,GAAE,CAAC;IACN,IAAA,6BAAmB,GAAE,CAAC;IACtB,IAAA,yCAA+B,GAAE,CAAC;IAClC,IAAA,+BAAqB,GAAE,CAAC;AAC1B,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Click on an element.
|
|
6
|
+
* @author Yuen Ler Chow
|
|
7
|
+
* @param item the CSS selector of interest
|
|
8
|
+
* @return Cypress chainable containing the clicked element
|
|
9
|
+
*/
|
|
10
|
+
tap(item: string): Chainable<JQuery<HTMLElement>>;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
declare const tap: () => void;
|
|
15
|
+
export default tap;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var tap = function () {
|
|
8
|
+
Cypress.Commands.add('tap', function (item) {
|
|
9
|
+
return cy.get(item).click();
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
/*----------------------------------------*/
|
|
13
|
+
/* --------------- Export --------------- */
|
|
14
|
+
/*----------------------------------------*/
|
|
15
|
+
exports.default = tap;
|
|
16
|
+
//# sourceMappingURL=tap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tap.js","sourceRoot":"","sources":["../../../src/commands/tap.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAsBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,GAAG,GAAG;IACV,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,KAAK,EACL,UACE,IAAY;QAEZ,OAAO,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,GAAG,CAAC"}
|
|
@@ -16,7 +16,7 @@ var uniquify = function () {
|
|
|
16
16
|
Cypress.Commands.add('uniquify', function (text) {
|
|
17
17
|
var thisCounter = uniqueCounter;
|
|
18
18
|
uniqueCounter += 1;
|
|
19
|
-
return "".concat(text, " [").concat(shorten(Number.parseInt("".concat(Date.now()).concat(thisCounter).concat(id), 10)), "]");
|
|
19
|
+
return cy.wrap("".concat(text, " [").concat(shorten(Number.parseInt("".concat(Date.now()).concat(thisCounter).concat(id), 10)), "]"));
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
/*----------------------------------------*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniquify.js","sourceRoot":"","sources":["../../../src/commands/uniquify.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAoBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB,IAAM,OAAO,GAAG,UAAC,GAAW;IAC1B,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAClC,CAAC,CAAC;AAEF,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC;AAEtD,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,QAAQ,GAAG;IACf,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,UAAC,IAAY;QAC5C,IAAM,WAAW,GAAG,aAAa,CAAC;QAClC,aAAa,IAAI,CAAC,CAAC;QACnB,OAAO,UAAG,IAAI,eAAK,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAG,IAAI,CAAC,GAAG,EAAE,SAAG,WAAW,SAAG,EAAE,CAAE,EAAE,EAAE,CAAC,CAAC,MAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"uniquify.js","sourceRoot":"","sources":["../../../src/commands/uniquify.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAoBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAI,aAAa,GAAG,CAAC,CAAC;AAEtB,IAAM,OAAO,GAAG,UAAC,GAAW;IAC1B,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAClC,CAAC,CAAC;AAEF,IAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC;AAEtD,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,QAAQ,GAAG;IACf,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,UAAC,IAAY;QAC5C,IAAM,WAAW,GAAG,aAAa,CAAC;QAClC,aAAa,IAAI,CAAC,CAAC;QACnB,OAAO,EAAE,CAAC,IAAI,CAAC,UAAG,IAAI,eAAK,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAG,IAAI,CAAC,GAAG,EAAE,SAAG,WAAW,SAAG,EAAE,CAAE,EAAE,EAAE,CAAC,CAAC,MAAG,CAAC,CAAC;IAClG,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,QAAQ,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
// Import shared helpers
|
|
5
|
+
import getRootPath from '../helpers/getRootPath';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Generate an example test file at /cypress/e2e/example.test.ts
|
|
9
|
+
* Does not create test file if e2e folder already exists
|
|
10
|
+
* @author Gabe Abrams
|
|
11
|
+
* @author Yuen Ler Chow
|
|
12
|
+
* @author Allison Zhang
|
|
13
|
+
*/
|
|
14
|
+
const genExampleTest = () => {
|
|
15
|
+
const root = getRootPath();
|
|
16
|
+
|
|
17
|
+
// Log the action
|
|
18
|
+
// eslint-disable-next-line no-console
|
|
19
|
+
console.log('Adding dummy test file: e2e/example.test.ts');
|
|
20
|
+
|
|
21
|
+
const e2eDir = path.join(root, 'cypress/e2e');
|
|
22
|
+
const outputFile = path.join(e2eDir, 'example.test.ts');
|
|
23
|
+
|
|
24
|
+
// Check if the directory exists
|
|
25
|
+
if (!fs.existsSync(e2eDir)) {
|
|
26
|
+
// Create the directory
|
|
27
|
+
fs.mkdirSync(e2eDir, { recursive: true });
|
|
28
|
+
} else {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Create an empty file with a comment
|
|
33
|
+
const fileContents = [
|
|
34
|
+
'describe(\'Example Test Suite\', () => {',
|
|
35
|
+
' it(\'Should fill out form\', () => {',
|
|
36
|
+
' cy.visit(\'https://formy-project.herokuapp.com/form\');',
|
|
37
|
+
' cy.typeInto({ item: \'#first-name\', text: \'John\' });',
|
|
38
|
+
' cy.tap(\'#radio-button-2\');',
|
|
39
|
+
' });',
|
|
40
|
+
'});',
|
|
41
|
+
'',
|
|
42
|
+
];
|
|
43
|
+
fs.writeFileSync(outputFile, fileContents.join('\n'), 'utf8');
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default genExampleTest;
|
|
@@ -6,6 +6,7 @@ import path from 'path';
|
|
|
6
6
|
import getRootPath from '../helpers/getRootPath';
|
|
7
7
|
import genEmptyGlobalFile from './genEmptyGlobalFile';
|
|
8
8
|
import genEmptyProfileFile from './genEmptyProfileFile';
|
|
9
|
+
import genExampleTest from './genExampleTest';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Ensure required configuration files exist in the consumer repo
|
|
@@ -51,6 +52,9 @@ const checkRequiredFiles = (): void => {
|
|
|
51
52
|
if (!defaultProfileFound) {
|
|
52
53
|
genEmptyProfileFile(defaultProfileName);
|
|
53
54
|
}
|
|
55
|
+
|
|
56
|
+
// Generate example test file
|
|
57
|
+
genExampleTest();
|
|
54
58
|
};
|
|
55
59
|
|
|
56
60
|
export default checkRequiredFiles;
|
package/src/commands/index.ts
CHANGED
|
@@ -23,6 +23,7 @@ import padWithZeros from './padWithZeros';
|
|
|
23
23
|
import runScript from './runScript';
|
|
24
24
|
import typeInto from './typeInto';
|
|
25
25
|
import uniquify from './uniquify';
|
|
26
|
+
import tap from './tap';
|
|
26
27
|
import visitCanvasEndpoint from './visitCanvasEndpoint';
|
|
27
28
|
import waitForAtLeastOneElementPresent from './waitForAtLeastOneElementPresent';
|
|
28
29
|
import waitForElementVisible from './waitForElementVisible';
|
|
@@ -57,6 +58,7 @@ const commands = () => {
|
|
|
57
58
|
runScript();
|
|
58
59
|
typeInto();
|
|
59
60
|
uniquify();
|
|
61
|
+
tap();
|
|
60
62
|
visitCanvasEndpoint();
|
|
61
63
|
waitForAtLeastOneElementPresent();
|
|
62
64
|
waitForElementVisible();
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/// <reference types="cypress" />
|
|
2
|
+
|
|
3
|
+
/*----------------------------------------*/
|
|
4
|
+
/* ---------------- Type ---------------- */
|
|
5
|
+
/*----------------------------------------*/
|
|
6
|
+
|
|
7
|
+
declare global {
|
|
8
|
+
namespace Cypress {
|
|
9
|
+
interface Chainable {
|
|
10
|
+
/**
|
|
11
|
+
* Click on an element.
|
|
12
|
+
* @author Yuen Ler Chow
|
|
13
|
+
* @param item the CSS selector of interest
|
|
14
|
+
* @return Cypress chainable containing the clicked element
|
|
15
|
+
*/
|
|
16
|
+
tap(
|
|
17
|
+
item: string,
|
|
18
|
+
): Chainable<JQuery<HTMLElement>>;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/*----------------------------------------*/
|
|
24
|
+
/* --------------- Command -------------- */
|
|
25
|
+
/*----------------------------------------*/
|
|
26
|
+
|
|
27
|
+
const tap = () => {
|
|
28
|
+
Cypress.Commands.add(
|
|
29
|
+
'tap',
|
|
30
|
+
(
|
|
31
|
+
item: string,
|
|
32
|
+
) => {
|
|
33
|
+
return cy.get(item).click();
|
|
34
|
+
},
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/*----------------------------------------*/
|
|
39
|
+
/* --------------- Export --------------- */
|
|
40
|
+
/*----------------------------------------*/
|
|
41
|
+
|
|
42
|
+
export default tap;
|
package/src/commands/uniquify.ts
CHANGED
|
@@ -13,7 +13,7 @@ declare global {
|
|
|
13
13
|
* @param text the original string
|
|
14
14
|
* @returns the uniquified string
|
|
15
15
|
*/
|
|
16
|
-
uniquify(text: string): string
|
|
16
|
+
uniquify(text: string): Chainable<string>;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -38,7 +38,7 @@ const uniquify = () => {
|
|
|
38
38
|
Cypress.Commands.add('uniquify', (text: string) => {
|
|
39
39
|
const thisCounter = uniqueCounter;
|
|
40
40
|
uniqueCounter += 1;
|
|
41
|
-
return `${text} [${shorten(Number.parseInt(`${Date.now()}${thisCounter}${id}`, 10))}]
|
|
41
|
+
return cy.wrap(`${text} [${shorten(Number.parseInt(`${Date.now()}${thisCounter}${id}`, 10))}]`);
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
44
|
|