dceky 1.0.0-beta.6 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +93 -0
- package/README.md +41 -0
- package/cypress/e2e/profile-test.cy.ts +10 -0
- package/cypress/fixtures/example.json +5 -0
- package/cypress/support/commands.ts +37 -0
- package/cypress/support/e2e.ts +17 -0
- package/cypress.config.ts +9 -0
- package/docs/GlobalsAndProfiles.md +23 -0
- package/lib/setup/addToGitIgnore.d.ts +6 -0
- package/lib/setup/addToGitIgnore.js +47 -0
- package/lib/setup/addToGitIgnore.js.map +1 -0
- package/lib/setup/checkRequiredFiles.d.ts +6 -0
- package/lib/setup/checkRequiredFiles.js +59 -0
- package/lib/setup/checkRequiredFiles.js.map +1 -0
- package/lib/setup/genCommandImportFile.d.ts +7 -0
- package/lib/setup/genCommandImportFile.js +67 -0
- package/lib/setup/genCommandImportFile.js.map +1 -0
- package/lib/setup/genDynamicConfigFile.d.ts +5 -0
- package/lib/setup/genDynamicConfigFile.js +29 -0
- package/lib/setup/genDynamicConfigFile.js.map +1 -0
- package/lib/setup/helpers/getRootPath.d.ts +7 -0
- package/lib/setup/helpers/getRootPath.js +17 -0
- package/lib/setup/helpers/getRootPath.js.map +1 -0
- package/lib/setup/index.d.ts +1 -0
- package/lib/setup/index.js +16 -0
- package/lib/setup/index.js.map +1 -0
- package/lib/setup/setupCypressDependencies.d.ts +6 -0
- package/lib/setup/setupCypressDependencies.js +40 -0
- package/lib/setup/setupCypressDependencies.js.map +1 -0
- package/lib/src/commands/assertDoesNotHaveClass.d.ts +20 -0
- package/lib/src/commands/assertDoesNotHaveClass.js +17 -0
- package/lib/src/commands/assertDoesNotHaveClass.js.map +1 -0
- package/lib/src/commands/assertHasClass.d.ts +20 -0
- package/lib/src/commands/assertHasClass.js +17 -0
- package/lib/src/commands/assertHasClass.js.map +1 -0
- package/lib/src/commands/assertNumElements.d.ts +19 -0
- package/lib/src/commands/assertNumElements.js +17 -0
- package/lib/src/commands/assertNumElements.js.map +1 -0
- package/lib/src/commands/extractDataFromClass.d.ts +18 -0
- package/lib/src/commands/extractDataFromClass.js +25 -0
- package/lib/src/commands/extractDataFromClass.js.map +1 -0
- package/lib/src/commands/extractDataFromClassByContents.d.ts +19 -0
- package/lib/src/commands/extractDataFromClassByContents.js +26 -0
- package/lib/src/commands/extractDataFromClassByContents.js.map +1 -0
- package/lib/src/commands/getJSON.d.ts +16 -0
- package/lib/src/commands/getJSON.js +21 -0
- package/lib/src/commands/getJSON.js.map +1 -0
- package/lib/src/commands/getNumElements.d.ts +15 -0
- package/lib/src/commands/getNumElements.js +19 -0
- package/lib/src/commands/getNumElements.js.map +1 -0
- package/lib/src/commands/handleHarvardKey.d.ts +15 -0
- package/lib/src/commands/handleHarvardKey.js +53 -0
- package/lib/src/commands/handleHarvardKey.js.map +1 -0
- package/lib/src/commands/launchAs.d.ts +25 -0
- package/lib/src/commands/launchAs.js +66 -0
- package/lib/src/commands/launchAs.js.map +1 -0
- package/lib/src/commands/launchLTIUsingToken.d.ts +21 -0
- package/lib/src/commands/launchLTIUsingToken.js +68 -0
- package/lib/src/commands/launchLTIUsingToken.js.map +1 -0
- package/lib/src/commands/navigateToHref.d.ts +15 -0
- package/lib/src/commands/navigateToHref.js +35 -0
- package/lib/src/commands/navigateToHref.js.map +1 -0
- package/lib/src/commands/runScript.d.ts +15 -0
- package/lib/src/commands/runScript.js +20 -0
- package/lib/src/commands/runScript.js.map +1 -0
- package/lib/src/commands/typeInto.d.ts +24 -0
- package/lib/src/commands/typeInto.js +41 -0
- package/lib/src/commands/typeInto.js.map +1 -0
- package/lib/src/commands/visitCanvasGETEndpoint.d.ts +20 -0
- package/lib/src/commands/visitCanvasGETEndpoint.js +26 -0
- package/lib/src/commands/visitCanvasGETEndpoint.js.map +1 -0
- package/lib/src/commands/waitForElementVisible.d.ts +16 -0
- package/lib/src/commands/waitForElementVisible.js +19 -0
- package/lib/src/commands/waitForElementVisible.js.map +1 -0
- package/lib/src/genConfiguration/helpers/getRootPath.d.ts +7 -0
- package/lib/src/genConfiguration/helpers/getRootPath.js +17 -0
- package/lib/src/genConfiguration/helpers/getRootPath.js.map +1 -0
- package/lib/src/genConfiguration/helpers/resolveDependents.d.ts +13 -0
- package/lib/src/genConfiguration/helpers/resolveDependents.js +50 -0
- package/lib/src/genConfiguration/helpers/resolveDependents.js.map +1 -0
- package/lib/src/genConfiguration/helpers/splitEnv.d.ts +10 -0
- package/lib/src/genConfiguration/helpers/splitEnv.js +27 -0
- package/lib/src/genConfiguration/helpers/splitEnv.js.map +1 -0
- package/{src/genConfiguration.ts → lib/src/genConfiguration/index.d.ts} +3 -6
- package/lib/src/genConfiguration/index.js +89 -0
- package/lib/src/genConfiguration/index.js.map +1 -0
- package/lib/src/genConfiguration/types/DependentValue.d.ts +11 -0
- package/lib/src/genConfiguration/types/DependentValue.js +3 -0
- package/lib/src/genConfiguration/types/DependentValue.js.map +1 -0
- package/lib/src/genConfiguration/types/GlobalsOrProfile.d.ts +9 -0
- package/lib/src/genConfiguration/types/GlobalsOrProfile.js +3 -0
- package/lib/src/genConfiguration/types/GlobalsOrProfile.js.map +1 -0
- package/lib/src/genConfiguration/types/SplitEnv.d.ts +13 -0
- package/lib/src/genConfiguration/types/SplitEnv.js +3 -0
- package/lib/src/genConfiguration/types/SplitEnv.js.map +1 -0
- package/lib/{index.d.ts → src/index.d.ts} +1 -1
- package/lib/{index.js → src/index.js} +6 -3
- package/lib/src/index.js.map +1 -0
- package/lib/src/init.d.ts +6 -0
- package/lib/src/init.js +45 -0
- package/lib/src/init.js.map +1 -0
- package/lib/start/constants/AVAILABLE_BROWSERS.d.ts +9 -0
- package/lib/start/constants/AVAILABLE_BROWSERS.js +27 -0
- package/lib/start/constants/AVAILABLE_BROWSERS.js.map +1 -0
- package/lib/start/helpers/exec.d.ts +8 -0
- package/lib/start/helpers/exec.js +18 -0
- package/lib/start/helpers/exec.js.map +1 -0
- package/lib/start/helpers/extractArgValue.d.ts +10 -0
- package/lib/start/helpers/extractArgValue.js +39 -0
- package/lib/start/helpers/extractArgValue.js.map +1 -0
- package/lib/start/helpers/findProfilesByNames.d.ts +16 -0
- package/lib/start/helpers/findProfilesByNames.js +35 -0
- package/lib/start/helpers/findProfilesByNames.js.map +1 -0
- package/lib/start/helpers/getRootPath.d.ts +7 -0
- package/lib/start/helpers/getRootPath.js +17 -0
- package/lib/start/helpers/getRootPath.js.map +1 -0
- package/lib/start/helpers/parseCommaSeparated.d.ts +8 -0
- package/lib/start/helpers/parseCommaSeparated.js +23 -0
- package/lib/start/helpers/parseCommaSeparated.js.map +1 -0
- package/lib/start/helpers/print.d.ts +38 -0
- package/lib/start/helpers/print.js +145 -0
- package/lib/start/helpers/print.js.map +1 -0
- package/lib/start/helpers/prompt.d.ts +8 -0
- package/lib/start/helpers/prompt.js +25 -0
- package/lib/start/helpers/prompt.js.map +1 -0
- package/lib/start/helpers/showChooser.d.ts +21 -0
- package/lib/start/helpers/showChooser.js +116 -0
- package/lib/start/helpers/showChooser.js.map +1 -0
- package/lib/start/helpers/validateBrowsers.d.ts +8 -0
- package/lib/start/helpers/validateBrowsers.js +36 -0
- package/lib/start/helpers/validateBrowsers.js.map +1 -0
- package/lib/start/index.d.ts +7 -0
- package/lib/start/index.js +140 -0
- package/lib/start/index.js.map +1 -0
- package/lib/start/types/ChooserOption.d.ts +10 -0
- package/lib/start/types/ChooserOption.js +3 -0
- package/lib/start/types/ChooserOption.js.map +1 -0
- package/package.json +28 -8
- package/setup/addToGitIgnore.ts +48 -0
- package/setup/checkRequiredFiles.ts +63 -0
- package/setup/genCommandImportFile.ts +76 -0
- package/setup/genDynamicConfigFile.ts +29 -0
- package/setup/helpers/getRootPath.ts +13 -0
- package/setup/index.ts +11 -0
- package/setup/setupCypressDependencies.ts +38 -0
- package/src/commands/assertDoesNotHaveClass.ts +51 -0
- package/src/commands/assertHasClass.ts +51 -0
- package/src/commands/assertNumElements.ts +50 -0
- package/src/commands/extractDataFromClass.ts +52 -0
- package/src/commands/extractDataFromClassByContents.ts +55 -0
- package/src/commands/getJSON.ts +45 -0
- package/src/commands/getNumElements.ts +45 -0
- package/src/commands/handleHarvardKey.ts +91 -0
- package/src/commands/launchAs.ts +120 -0
- package/src/commands/launchLTIUsingToken.ts +115 -0
- package/src/commands/navigateToHref.ts +60 -0
- package/src/commands/runScript.ts +44 -0
- package/src/commands/typeInto.ts +88 -0
- package/src/commands/visitCanvasGETEndpoint.ts +61 -0
- package/src/commands/waitForElementVisible.ts +49 -0
- package/src/genConfiguration/helpers/getRootPath.ts +13 -0
- package/src/genConfiguration/helpers/resolveDependents.ts +46 -0
- package/src/genConfiguration/helpers/splitEnv.ts +30 -0
- package/src/genConfiguration/index.ts +95 -0
- package/src/genConfiguration/types/DependentValue.ts +14 -0
- package/src/genConfiguration/types/GlobalsOrProfile.ts +12 -0
- package/src/genConfiguration/types/SplitEnv.ts +18 -0
- package/src/index.ts +7 -4
- package/src/init.ts +36 -17
- package/start/constants/AVAILABLE_BROWSERS.ts +28 -0
- package/start/helpers/exec.ts +17 -0
- package/start/helpers/extractArgValue.ts +42 -0
- package/start/helpers/findProfilesByNames.ts +39 -0
- package/start/helpers/getRootPath.ts +13 -0
- package/start/helpers/parseCommaSeparated.ts +23 -0
- package/start/helpers/print.ts +155 -0
- package/start/helpers/prompt.ts +23 -0
- package/start/helpers/showChooser.ts +140 -0
- package/start/helpers/validateBrowsers.ts +35 -0
- package/start/index.ts +164 -0
- package/start/types/ChooserOption.ts +11 -0
- package/tsconfig.json +3 -4
- package/.eslintrc.json +0 -58
- package/lib/genConfiguration.d.ts +0 -8
- package/lib/genConfiguration.js +0 -13
- package/lib/genConfiguration.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/init.d.ts +0 -13
- package/lib/init.js +0 -10
- package/lib/init.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertDoesNotHaveClass.js","sourceRoot":"","sources":["../../../src/commands/assertDoesNotHaveClass.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AA2BjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,sBAAsB,GAAG;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,wBAAwB,EACxB,UACE,IAGC;QAED,EAAE,CAAC,GAAG,CAAC,iBAAU,IAAI,CAAC,IAAI,kCAAwB,IAAI,CAAC,SAAS,CAAE,CAAC,CAAC;QACpE,OAAO,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACpE,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Assert that an element has a specific className
|
|
6
|
+
* @author Yuen Ler Chow
|
|
7
|
+
* @param opts object containing all arguments
|
|
8
|
+
* @param opts.item the css selector for finding the element
|
|
9
|
+
* @param opts.className the className to check for
|
|
10
|
+
* @return Cypress chainable containing the element that was checked
|
|
11
|
+
*/
|
|
12
|
+
assertHasClass(opts: {
|
|
13
|
+
item: string;
|
|
14
|
+
className: string;
|
|
15
|
+
}): Chainable<JQuery<HTMLElement>>;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
declare const assertHasClass: () => void;
|
|
20
|
+
export default assertHasClass;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var assertHasClass = function () {
|
|
8
|
+
Cypress.Commands.add('assertHasClass', function (opts) {
|
|
9
|
+
cy.log("Assert ".concat(opts.item, " has class ").concat(opts.className));
|
|
10
|
+
return cy.get(opts.item).should('have.class', opts.className);
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
/*----------------------------------------*/
|
|
14
|
+
/* --------------- Export --------------- */
|
|
15
|
+
/*----------------------------------------*/
|
|
16
|
+
exports.default = assertHasClass;
|
|
17
|
+
//# sourceMappingURL=assertHasClass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertHasClass.js","sourceRoot":"","sources":["../../../src/commands/assertHasClass.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AA2BjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,cAAc,GAAG;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,gBAAgB,EAChB,UACE,IAGC;QAED,EAAE,CAAC,GAAG,CAAC,iBAAU,IAAI,CAAC,IAAI,wBAAc,IAAI,CAAC,SAAS,CAAE,CAAC,CAAC;QAC1D,OAAO,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Assert a certain number of elements
|
|
6
|
+
* @author Yuen Ler Chow
|
|
7
|
+
* @param opts object containing all arguments
|
|
8
|
+
* @param opts.item a CSS selector corresponding to the item
|
|
9
|
+
* @param opts.num the precise number of elements expected
|
|
10
|
+
*/
|
|
11
|
+
assertNumElements(opts: {
|
|
12
|
+
item: string;
|
|
13
|
+
num: number;
|
|
14
|
+
}): Chainable<Element>;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
declare const assertNumElements: () => void;
|
|
19
|
+
export default assertNumElements;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var assertNumElements = function () {
|
|
8
|
+
Cypress.Commands.add('assertNumElements', function (opts) {
|
|
9
|
+
cy.log("Assert ".concat(opts.num, " elements match ").concat(opts.item));
|
|
10
|
+
cy.get(opts.item).should('have.length', opts.num);
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
/*----------------------------------------*/
|
|
14
|
+
/* --------------- Export --------------- */
|
|
15
|
+
/*----------------------------------------*/
|
|
16
|
+
exports.default = assertNumElements;
|
|
17
|
+
//# sourceMappingURL=assertNumElements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertNumElements.js","sourceRoot":"","sources":["../../../src/commands/assertNumElements.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AA0BjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,iBAAiB,GAAG;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,mBAAmB,EACnB,UACE,IAGC;QAED,EAAE,CAAC,GAAG,CAAC,iBAAU,IAAI,CAAC,GAAG,6BAAmB,IAAI,CAAC,IAAI,CAAE,CAAC,CAAC;QACzD,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Obtain data from a class attribute that starts with a specific prefix
|
|
6
|
+
* and return it
|
|
7
|
+
* @author Allison Zhang
|
|
8
|
+
* @param selector the css selector for finding the element
|
|
9
|
+
* @param classPrefix the prefix to look for in the class attribute
|
|
10
|
+
* @returns the extracted data
|
|
11
|
+
* @example cy.extractDataFromClass('.item', 'data-').then((data) => { ... })
|
|
12
|
+
*/
|
|
13
|
+
extractDataFromClass(selector: string, classPrefix: string): Chainable<string[]>;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
declare const extractDataFromClass: () => void;
|
|
18
|
+
export default extractDataFromClass;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var extractDataFromClass = function () {
|
|
8
|
+
Cypress.Commands.add('extractDataFromClass', function (selector, classPrefix) {
|
|
9
|
+
return (cy
|
|
10
|
+
.get(selector)
|
|
11
|
+
.invoke('attr', 'class')
|
|
12
|
+
.then(function (classAttr) {
|
|
13
|
+
var classList = classAttr.split(' ');
|
|
14
|
+
var data = classList
|
|
15
|
+
.filter(function (className) { return className.startsWith(classPrefix); })
|
|
16
|
+
.map(function (className) { return className.replace(classPrefix, ''); });
|
|
17
|
+
return data;
|
|
18
|
+
}));
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
/*----------------------------------------*/
|
|
22
|
+
/* --------------- Export --------------- */
|
|
23
|
+
/*----------------------------------------*/
|
|
24
|
+
exports.default = extractDataFromClass;
|
|
25
|
+
//# sourceMappingURL=extractDataFromClass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractDataFromClass.js","sourceRoot":"","sources":["../../../src/commands/extractDataFromClass.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AA0BjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,oBAAoB,GAAG;IAC3B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,sBAAsB,EAAE,UAAC,QAAgB,EAAE,WAAmB;QACjF,OAAO,CACL,EAAE;aACC,GAAG,CAAC,QAAQ,CAAC;aACb,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;aACvB,IAAI,CAAC,UAAC,SAAiB;YACtB,IAAM,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACvC,IAAM,IAAI,GAAG,SAAS;iBACnB,MAAM,CAAC,UAAC,SAAS,IAAO,OAAO,SAAS,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;iBACpE,GAAG,CAAC,UAAC,SAAS,IAAO,OAAO,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACtE,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CACL,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Obtain data from a class attribute that starts with a specific prefix
|
|
6
|
+
* and with specific contents, and return it
|
|
7
|
+
* @author Allison Zhang
|
|
8
|
+
* @param contents the contents of the element to find
|
|
9
|
+
* @param selector the css selector for finding the element
|
|
10
|
+
* @param classPrefix the prefix to look for in the class attribute
|
|
11
|
+
* @returns the extracted data
|
|
12
|
+
* @example cy.extractDataFromClassByContents('Submit', '.button', 'btn-').then((data) => { ... })
|
|
13
|
+
*/
|
|
14
|
+
extractDataFromClassByContents(contents: string, selector: string, classPrefix: string): Chainable<string[]>;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
declare const extractDataFromClassByContents: () => void;
|
|
19
|
+
export default extractDataFromClassByContents;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var extractDataFromClassByContents = function () {
|
|
8
|
+
Cypress.Commands.add('extractDataFromClassByContents', function (contents, selector, classPrefix) {
|
|
9
|
+
return (cy
|
|
10
|
+
.get(selector)
|
|
11
|
+
.contains(contents)
|
|
12
|
+
.invoke('attr', 'class')
|
|
13
|
+
.then(function (classAttr) {
|
|
14
|
+
var classList = classAttr.split(' ');
|
|
15
|
+
var data = classList
|
|
16
|
+
.filter(function (className) { return className.startsWith(classPrefix); })
|
|
17
|
+
.map(function (className) { return className.replace(classPrefix, ''); });
|
|
18
|
+
return data;
|
|
19
|
+
}));
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
/*----------------------------------------*/
|
|
23
|
+
/* --------------- Export --------------- */
|
|
24
|
+
/*----------------------------------------*/
|
|
25
|
+
exports.default = extractDataFromClassByContents;
|
|
26
|
+
//# sourceMappingURL=extractDataFromClassByContents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractDataFromClassByContents.js","sourceRoot":"","sources":["../../../src/commands/extractDataFromClassByContents.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AA4BjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,8BAA8B,GAAG;IACrC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,gCAAgC,EAAE,UAAC,QAAgB,EAAE,QAAgB,EAAE,WAAmB;QAC7G,OAAO,CACL,EAAE;aACC,GAAG,CAAC,QAAQ,CAAC;aACb,QAAQ,CAAC,QAAQ,CAAC;aAClB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;aACvB,IAAI,CAAC,UAAC,SAAiB;YACtB,IAAM,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACvC,IAAM,IAAI,GAAG,SAAS;iBACnB,MAAM,CAAC,UAAC,SAAS,IAAO,OAAO,SAAS,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;iBACpE,GAAG,CAAC,UAAC,SAAS,IAAO,OAAO,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACtE,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CACL,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Obtain JSON data from a request and return it.
|
|
6
|
+
* @author Allison Zhang
|
|
7
|
+
* @param url the URL to fetch the JSON data from
|
|
8
|
+
* @returns the JSON data
|
|
9
|
+
* @example cy.getJSON('https://api.example.com/data').then((data) => { ... })
|
|
10
|
+
*/
|
|
11
|
+
getJSON(url: string): Chainable<any>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
declare const getJSON: () => void;
|
|
16
|
+
export default getJSON;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var getJSON = function () {
|
|
8
|
+
Cypress.Commands.add('getJSON', function (url) {
|
|
9
|
+
return (cy
|
|
10
|
+
.request(url)
|
|
11
|
+
.its('body')
|
|
12
|
+
.then(function (body) {
|
|
13
|
+
return body;
|
|
14
|
+
}));
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
/*----------------------------------------*/
|
|
18
|
+
/* --------------- Export --------------- */
|
|
19
|
+
/*----------------------------------------*/
|
|
20
|
+
exports.default = getJSON;
|
|
21
|
+
//# sourceMappingURL=getJSON.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getJSON.js","sourceRoot":"","sources":["../../../src/commands/getJSON.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAuBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,OAAO,GAAG;IACd,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,UAAC,GAAW;QAC1C,OAAO,CACL,EAAE;aACC,OAAO,CAAC,GAAG,CAAC;aACZ,GAAG,CAAC,MAAM,CAAC;aACX,IAAI,CAAC,UAAC,IAAI;YACT,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CACL,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Get number of elements
|
|
6
|
+
* @author Yuen Ler Chow
|
|
7
|
+
* @param selector a CSS selector corresponding to the item to count
|
|
8
|
+
* @return Cypress chainable containing the number of elements matching the selector
|
|
9
|
+
*/
|
|
10
|
+
getNumElements(selector: string): Chainable<number>;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
declare const getNumElements: () => void;
|
|
15
|
+
export default getNumElements;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var getNumElements = function () {
|
|
8
|
+
Cypress.Commands.add('getNumElements', function (selector) {
|
|
9
|
+
cy.log("Count elements matching ".concat(selector));
|
|
10
|
+
return cy.get(selector).then(function ($elements) {
|
|
11
|
+
return Cypress.$($elements).length;
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
/*----------------------------------------*/
|
|
16
|
+
/* --------------- Export --------------- */
|
|
17
|
+
/*----------------------------------------*/
|
|
18
|
+
exports.default = getNumElements;
|
|
19
|
+
//# sourceMappingURL=getNumElements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNumElements.js","sourceRoot":"","sources":["../../../src/commands/getNumElements.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAsBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,cAAc,GAAG;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,gBAAgB,EAChB,UACE,QAAgB;QAEhB,EAAE,CAAC,GAAG,CAAC,kCAA2B,QAAQ,CAAE,CAAC,CAAC;QAC9C,OAAO,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,UAAC,SAA8B;YAC1D,OAAO,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;QACrC,CAAC,CAAC,CAAC;IACL,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Handle a HarvardKey login page for a user
|
|
6
|
+
* @author Yuen Ler Chow
|
|
7
|
+
* @param name the name of the user environment variable
|
|
8
|
+
* @return Cypress chainable (void) - performs authentication flow, no return value
|
|
9
|
+
*/
|
|
10
|
+
handleHarvardKey(name: string): Chainable<void>;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
declare const handleHarvardKey: () => void;
|
|
15
|
+
export default handleHarvardKey;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var handleHarvardKey = function () {
|
|
8
|
+
Cypress.Commands.add('handleHarvardKey', function (name) {
|
|
9
|
+
cy.log('Handling HarvardKey authentication');
|
|
10
|
+
var userInfo = Cypress.env(name);
|
|
11
|
+
if (!userInfo) {
|
|
12
|
+
throw new Error("Could not find ".concat(name, " in environment variables"));
|
|
13
|
+
}
|
|
14
|
+
// Destructure the user info object to get the username and password
|
|
15
|
+
var username = userInfo.username;
|
|
16
|
+
var password = userInfo.password;
|
|
17
|
+
// Get the Harvard login URL using originWithKaixa with auto-initialized functions
|
|
18
|
+
cy.origin('https://apps.cirrusidentity.com', function () {
|
|
19
|
+
Cypress.require('dceky');
|
|
20
|
+
// Clicking the button doesn't work for some reason, so we access the href attribute instead
|
|
21
|
+
return cy.navigateToHref('#idp_1001962798_button');
|
|
22
|
+
}).then(function (fullUrl) {
|
|
23
|
+
// Navigate to the Harvard login page using originWithKaixa
|
|
24
|
+
cy.origin('https://harvard.idp.cirrusidentity.com', {
|
|
25
|
+
args: { username: username, password: password, fullUrl: fullUrl },
|
|
26
|
+
}, function (args) {
|
|
27
|
+
Cypress.require('dceky');
|
|
28
|
+
var harvardUsername = args.username, harvardPassword = args.password, harvardLoginUrl = args.fullUrl;
|
|
29
|
+
cy.on('uncaught:exception', function (e) {
|
|
30
|
+
// Ignore known HarvardKey errors
|
|
31
|
+
if (!e.message.includes('ready is not defined')) {
|
|
32
|
+
throw e;
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
});
|
|
36
|
+
// Visit the Harvard login page
|
|
37
|
+
cy.visit(harvardLoginUrl);
|
|
38
|
+
// Wait for and fill in the login form
|
|
39
|
+
cy.waitForElementVisible('#username');
|
|
40
|
+
cy.waitForElementVisible('#password');
|
|
41
|
+
cy.typeInto({ item: '#username', text: harvardUsername });
|
|
42
|
+
cy.typeInto({ item: '#password', text: harvardPassword });
|
|
43
|
+
// Submit the form
|
|
44
|
+
cy.get('input[type="submit"], button[type="submit"], .btn-primary').click();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
/*----------------------------------------*/
|
|
50
|
+
/* --------------- Export --------------- */
|
|
51
|
+
/*----------------------------------------*/
|
|
52
|
+
exports.default = handleHarvardKey;
|
|
53
|
+
//# sourceMappingURL=handleHarvardKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleHarvardKey.js","sourceRoot":"","sources":["../../../src/commands/handleHarvardKey.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAsBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,gBAAgB,GAAG;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,kBAAkB,EAClB,UACE,IAAY;QAEZ,EAAE,CAAC,G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CAAC,CAAC;gBACtC,EAAE,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;gBAEtC,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;gBAC1D,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;gBAE1D,kBAAkB;gBAClB,EAAE,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC,KAAK,EAAE,CAAC;YAC9E,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Log into Canvas and launch an LTI app as a specific user from environment variables.
|
|
6
|
+
* The user should be defined as an environment variable with the following properties:
|
|
7
|
+
* - accessToken: Canvas access token for the user (required for production mode)
|
|
8
|
+
* - type: User type ('student', 'ta', 'teacher') for local mode (defaults to 'teacher')
|
|
9
|
+
* - simIndex: Simulator index for local mode (defaults to '0')
|
|
10
|
+
* @author Yuen Ler Chow
|
|
11
|
+
* @param name the name of the user environment variable
|
|
12
|
+
* @param opts object containing all arguments
|
|
13
|
+
* @param [opts.courseId] the Canvas ID of the course to launch from
|
|
14
|
+
* @param [opts.appName] the name of the app as it appears in the course's left-hand nav
|
|
15
|
+
* @return Cypress chainable (void) - launches the LTI app, no return value
|
|
16
|
+
*/
|
|
17
|
+
launchAs(name: string, opts?: {
|
|
18
|
+
courseId?: number;
|
|
19
|
+
appName?: string;
|
|
20
|
+
}): Chainable<void>;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
declare const launchAs: () => void;
|
|
25
|
+
export default launchAs;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var launchAs = function () {
|
|
8
|
+
Cypress.Commands.add('launchAs', function (name, opts) {
|
|
9
|
+
if (opts === void 0) { opts = {}; }
|
|
10
|
+
var courseId = opts.courseId, appName = opts.appName;
|
|
11
|
+
// Get courseId from environment variables if not provided
|
|
12
|
+
if (!courseId) {
|
|
13
|
+
var envCourseId = Cypress.env('courseId');
|
|
14
|
+
if (!envCourseId) {
|
|
15
|
+
throw new Error('Could not find courseId in environment variables');
|
|
16
|
+
}
|
|
17
|
+
courseId = Number.parseInt(envCourseId, 10);
|
|
18
|
+
}
|
|
19
|
+
// Get appName from environment variables if not provided
|
|
20
|
+
appName = appName || Cypress.env('appName');
|
|
21
|
+
if (!appName) {
|
|
22
|
+
throw new Error('Could not find appName in environment variables');
|
|
23
|
+
}
|
|
24
|
+
// Get user info from environment variables
|
|
25
|
+
var userInfo = Cypress.env(name);
|
|
26
|
+
if (!userInfo) {
|
|
27
|
+
throw new Error("Could not find ".concat(name, " in environment variables"));
|
|
28
|
+
}
|
|
29
|
+
cy.log("\uD83D\uDE80 Launch as ".concat(name));
|
|
30
|
+
// Check if this is a local launch
|
|
31
|
+
var isLocal = Cypress.env('local') === 'true';
|
|
32
|
+
if (isLocal) {
|
|
33
|
+
// Handle local simulator launch
|
|
34
|
+
var userType = userInfo.type || 'teacher';
|
|
35
|
+
var simIndex = userInfo.simIndex || '0';
|
|
36
|
+
var simLaunchButtonId = "".concat(userType, "_").concat(simIndex, "-launch-button");
|
|
37
|
+
cy.log('Local mode: launching simulator');
|
|
38
|
+
cy.visit('https://localhost:8088/simulator');
|
|
39
|
+
// Handle potential SSL certificate issues
|
|
40
|
+
cy.get('body').then(function ($body) {
|
|
41
|
+
if ($body.find('.ssl').length > 0) {
|
|
42
|
+
cy.log('Handling SSL certificate issue');
|
|
43
|
+
cy.get('#details-button').click();
|
|
44
|
+
cy.get('#proceed-link').click();
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
// Launch the app
|
|
48
|
+
cy.get("#".concat(simLaunchButtonId)).click();
|
|
49
|
+
// Click the authorize button
|
|
50
|
+
cy.get('.authorize-button', { timeout: 1000 }).click();
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
// Handle production launch with access token
|
|
54
|
+
var accessToken = userInfo.accessToken;
|
|
55
|
+
if (!accessToken) {
|
|
56
|
+
throw new Error("Could not find accessToken for ".concat(name, " in environment variables"));
|
|
57
|
+
}
|
|
58
|
+
// Launch using the access token
|
|
59
|
+
cy.launchLTIUsingToken(accessToken, { courseId: courseId, appName: appName });
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
/*----------------------------------------*/
|
|
63
|
+
/* --------------- Export --------------- */
|
|
64
|
+
/*----------------------------------------*/
|
|
65
|
+
exports.default = launchAs;
|
|
66
|
+
//# sourceMappingURL=launchAs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launchAs.js","sourceRoot":"","sources":["../../../src/commands/launchAs.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAiCjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,QAAQ,GAAG;IACf,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,UAAU,EACV,UACE,IAAY,EACZ,IAGM;QAHN,qBAAA,EAAA,SAGM;QAEA,IAAA,QAAQ,GAAc,IAAI,SAAlB,EAAE,OAAO,GAAK,IAAI,QAAT,CAAU;QAEjC,0DAA0D;QAC1D,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,IAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC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AC,EAAE,CAAC;oBAClC,EAAE,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;oBACzC,EAAE,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,KAAK,EAAE,CAAC;oBAClC,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,KAAK,EAAE,CAAC;gBAClC,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,iBAAiB;YACjB,EAAE,CAAC,GAAG,CAAC,WAAI,iBAAiB,CAAE,CAAC,CAAC,KAAK,EAAE,CAAC;YAExC,6BAA6B;YAC7B,EAAE,CAAC,GAAG,CAAC,mBAAmB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;YAEvD,OAAO;QACT,CAAC;QAED,6CAA6C;QACrC,IAAA,WAAW,GAAK,QAAQ,YAAb,CAAc;QAEjC,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,yCAAkC,IAAI,8BAA2B,CAAC,CAAC;QACrF,CAAC;QAED,gCAAgC;QAChC,EAAE,CAAC,mBAAmB,CAAC,WAAW,EAAE,EAAE,QAAQ,UAAA,EAAE,OAAO,SAAA,EAAE,CAAC,CAAC;IAC7D,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Log into Canvas using an access token and launch an LTI app
|
|
6
|
+
* @author Yuen Ler Chow
|
|
7
|
+
* @param accessToken the user's Canvas access token
|
|
8
|
+
* @param opts object containing all arguments
|
|
9
|
+
* @param [opts.courseId] the Canvas ID of the course to launch from
|
|
10
|
+
* @param [opts.appName] the name of the app as it appears in the course's left-hand nav
|
|
11
|
+
* @return Cypress chainable (void) - launches the LTI app and navigates to it, no return value
|
|
12
|
+
*/
|
|
13
|
+
launchLTIUsingToken(accessToken: string, opts?: {
|
|
14
|
+
courseId?: number;
|
|
15
|
+
appName?: string;
|
|
16
|
+
}): Chainable<void>;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
declare const launchLTIUsingToken: () => void;
|
|
21
|
+
export default launchLTIUsingToken;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var launchLTIUsingToken = function () {
|
|
8
|
+
Cypress.Commands.add('launchLTIUsingToken', function (accessToken, opts) {
|
|
9
|
+
if (opts === void 0) { opts = {}; }
|
|
10
|
+
var courseId = opts.courseId, appName = opts.appName;
|
|
11
|
+
if (!courseId) {
|
|
12
|
+
var envCourseId = Cypress.env('courseId');
|
|
13
|
+
if (!envCourseId) {
|
|
14
|
+
throw new Error('Could not find courseId in environment variables');
|
|
15
|
+
}
|
|
16
|
+
courseId = Number.parseInt(envCourseId, 10);
|
|
17
|
+
}
|
|
18
|
+
appName = appName || Cypress.env('appName');
|
|
19
|
+
if (!appName) {
|
|
20
|
+
throw new Error('Could not find appName in environment variables');
|
|
21
|
+
}
|
|
22
|
+
cy.log("Launch LTI app \"".concat(appName, "\" in course ").concat(courseId, " using access token"));
|
|
23
|
+
// Get the external tools for the course
|
|
24
|
+
cy.visitCanvasGETEndpoint({
|
|
25
|
+
path: "/courses/".concat(courseId, "/external_tools"),
|
|
26
|
+
accessToken: accessToken,
|
|
27
|
+
}).then(function (externalTools) {
|
|
28
|
+
cy.log("Found ".concat(externalTools.length, " external tools"));
|
|
29
|
+
// Find the external tool of interest
|
|
30
|
+
var matchingTool = externalTools.find(function (externalTool) {
|
|
31
|
+
// Skip non-nav items
|
|
32
|
+
if (!externalTool.course_navigation || typeof externalTool.course_navigation !== 'object') {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
// Skip non-labeled items
|
|
36
|
+
if (!externalTool.course_navigation.text) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
// Skip if the app name does not match the expected name
|
|
40
|
+
var thisAppName = externalTool.course_navigation.text.trim().toLowerCase();
|
|
41
|
+
return thisAppName === appName.trim().toLowerCase();
|
|
42
|
+
});
|
|
43
|
+
var toolId = (matchingTool === null || matchingTool === void 0 ? void 0 : matchingTool.id) || 0;
|
|
44
|
+
if (matchingTool) {
|
|
45
|
+
cy.log("Found matching app: \"".concat(matchingTool.course_navigation.text, "\" with ID ").concat(toolId));
|
|
46
|
+
}
|
|
47
|
+
// Make sure we found the app
|
|
48
|
+
if (toolId === 0) {
|
|
49
|
+
throw new Error("Could not find any apps named \"".concat(appName, "\" in course ").concat(courseId));
|
|
50
|
+
}
|
|
51
|
+
// Get a sessionless launch URL
|
|
52
|
+
cy.visitCanvasGETEndpoint({
|
|
53
|
+
path: "/courses/".concat(courseId, "/external_tools/sessionless_launch?id=").concat(toolId),
|
|
54
|
+
accessToken: accessToken,
|
|
55
|
+
}).then(function (sessionlessLaunchInfo) {
|
|
56
|
+
var launchURL = sessionlessLaunchInfo.url;
|
|
57
|
+
cy.log("Launching LTI app at: ".concat(launchURL));
|
|
58
|
+
// Launch the tool
|
|
59
|
+
cy.visit(launchURL);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
/*----------------------------------------*/
|
|
65
|
+
/* --------------- Export --------------- */
|
|
66
|
+
/*----------------------------------------*/
|
|
67
|
+
exports.default = launchLTIUsingToken;
|
|
68
|
+
//# sourceMappingURL=launchLTIUsingToken.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launchLTIUsingToken.js","sourceRoot":"","sources":["../../../src/commands/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4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Navigate to href attribute of Harvard identity provider button
|
|
6
|
+
* @author Yuen Ler Chow
|
|
7
|
+
* @param item the CSS selector of interest
|
|
8
|
+
* @return Cypress chainable containing the full URL string (hostname + href attribute value)
|
|
9
|
+
*/
|
|
10
|
+
navigateToHref(item: string): Chainable<string>;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
declare const navigateToHref: () => void;
|
|
15
|
+
export default navigateToHref;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var navigateToHref = function () {
|
|
8
|
+
Cypress.Commands.add('navigateToHref', function (item) {
|
|
9
|
+
cy.waitForElementVisible(item);
|
|
10
|
+
return cy
|
|
11
|
+
.url()
|
|
12
|
+
// get origin (protocol + '//' + host) from current URL
|
|
13
|
+
.then(function (url) {
|
|
14
|
+
var _a = new URL(url), protocol = _a.protocol, host = _a.host;
|
|
15
|
+
return "".concat(protocol, "//").concat(host);
|
|
16
|
+
})
|
|
17
|
+
.then(function (origin) {
|
|
18
|
+
return cy
|
|
19
|
+
.get(item)
|
|
20
|
+
.invoke('attr', 'href')
|
|
21
|
+
.then(function (href) {
|
|
22
|
+
// If the href is a relative URL, prepend the hostname
|
|
23
|
+
if (href.startsWith('/')) {
|
|
24
|
+
return origin + href;
|
|
25
|
+
}
|
|
26
|
+
return href;
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
/*----------------------------------------*/
|
|
32
|
+
/* --------------- Export --------------- */
|
|
33
|
+
/*----------------------------------------*/
|
|
34
|
+
exports.default = navigateToHref;
|
|
35
|
+
//# sourceMappingURL=navigateToHref.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigateToHref.js","sourceRoot":"","sources":["../../../src/commands/navigateToHref.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAoBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,cAAc,GAAG;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,gBAAgB,EAChB,UACE,IAAY;QAEZ,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAE/B,OAAO,EAAE;aACN,GAAG,EAAE;YACN,uDAAuD;aACtD,IAAI,CAAC,UAAC,GAAW;YACV,IAAA,KAAqB,IAAI,GAAG,CAAC,GAAG,CAAC,EAA/B,QAAQ,cAAA,EAAE,IAAI,UAAiB,CAAC;YACxC,OAAO,UAAG,QAAQ,eAAK,IAAI,CAAE,CAAC;QAChC,CAAC,CAAC;aACD,IAAI,CAAC,UAAC,MAAc;YACnB,OAAO,EAAE;iBACN,GAAG,CAAC,IAAI,CAAC;iBACT,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;iBACtB,IAAI,CAAC,UAAC,IAAY;gBACjB,sDAAsD;gBACtD,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;oBACzB,OAAO,MAAM,GAAG,IAAI,CAAC;gBACvB,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Run a script on the page
|
|
6
|
+
* @author Yuen Ler Chow
|
|
7
|
+
* @param script the script to run
|
|
8
|
+
* @return Cypress chainable containing the return value from executing the script
|
|
9
|
+
*/
|
|
10
|
+
runScript(scriptLines: string): Chainable<any>;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
declare const runScript: () => void;
|
|
15
|
+
export default runScript;
|