dceky 1.0.0-beta-yuenler.1 → 1.0.0-beta-auto-import.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +93 -0
- package/lib/commands/assertDoesNotHaveClass.d.ts +2 -1
- package/lib/commands/assertDoesNotHaveClass.js.map +1 -1
- package/lib/commands/assertHasClass.d.ts +2 -1
- package/lib/commands/assertHasClass.js.map +1 -1
- package/lib/commands/assertNumElements.d.ts +2 -1
- package/lib/commands/assertNumElements.js.map +1 -1
- package/lib/commands/clickWithRetry.d.ts +8 -4
- package/lib/commands/clickWithRetry.js +3 -3
- package/lib/commands/clickWithRetry.js.map +1 -1
- package/lib/commands/getNumElements.d.ts +4 -4
- package/lib/commands/getNumElements.js +1 -1
- package/lib/commands/getNumElements.js.map +1 -1
- package/lib/commands/handleHarvardKey.d.ts +9 -3
- package/lib/commands/handleHarvardKey.js +20 -24
- package/lib/commands/handleHarvardKey.js.map +1 -1
- package/lib/commands/handleHarvardKey2.d.ts +14 -0
- package/lib/commands/handleHarvardKey2.js +88 -0
- package/lib/commands/handleHarvardKey2.js.map +1 -0
- package/lib/commands/launchAs.d.ts +14 -12
- package/lib/commands/launchAs.js +24 -23
- package/lib/commands/launchAs.js.map +1 -1
- package/lib/commands/launchLTIUsingToken.d.ts +9 -4
- package/lib/commands/launchLTIUsingToken.js +25 -14
- package/lib/commands/launchLTIUsingToken.js.map +1 -1
- package/lib/commands/navigateToHref.d.ts +4 -9
- package/lib/commands/navigateToHref.js +10 -3
- package/lib/commands/navigateToHref.js.map +1 -1
- package/lib/commands/runScript.d.ts +3 -3
- package/lib/commands/runScript.js +2 -6
- package/lib/commands/runScript.js.map +1 -1
- package/lib/commands/typeInto.d.ts +5 -2
- package/lib/commands/typeInto.js +14 -4
- package/lib/commands/typeInto.js.map +1 -1
- package/lib/commands/visitCanvasGETEndpoint.d.ts +2 -2
- package/lib/commands/visitCanvasGETEndpoint.js +4 -4
- package/lib/commands/visitCanvasGETEndpoint.js.map +1 -1
- package/lib/commands/waitForElementVisible.d.ts +3 -2
- package/lib/commands/waitForElementVisible.js +1 -2
- package/lib/commands/waitForElementVisible.js.map +1 -1
- package/lib/genCommandPaths.d.ts +9 -0
- package/lib/genCommandPaths.js +86 -0
- package/lib/genCommandPaths.js.map +1 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/init.d.ts +1 -5
- package/lib/init.js +71 -33
- package/lib/init.js.map +1 -1
- package/package.json +8 -2
- package/src/commands/assertDoesNotHaveClass.ts +20 -9
- package/src/commands/assertHasClass.ts +20 -9
- package/src/commands/assertNumElements.ts +20 -6
- package/src/commands/getNumElements.ts +17 -10
- package/src/commands/handleHarvardKey.ts +68 -53
- package/src/commands/launchAs.ts +79 -63
- package/src/commands/launchLTIUsingToken.ts +78 -47
- package/src/commands/navigateToHref.ts +28 -17
- package/src/commands/runScript.ts +16 -11
- package/src/commands/typeInto.ts +54 -26
- package/src/commands/visitCanvasGETEndpoint.ts +29 -16
- package/src/commands/waitForElementVisible.ts +19 -10
- package/src/genCommandPaths.ts +65 -0
- package/src/index.ts +2 -3
- package/src/init.ts +80 -34
- package/.eslintrc.json +0 -58
- package/src/commands/clickWithRetry.ts +0 -51
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
const config = {
|
|
2
|
+
extends: [
|
|
3
|
+
'airbnb',
|
|
4
|
+
'airbnb/hooks',
|
|
5
|
+
],
|
|
6
|
+
overrides: [
|
|
7
|
+
{
|
|
8
|
+
files: [
|
|
9
|
+
'*.ts',
|
|
10
|
+
'*.tsx',
|
|
11
|
+
],
|
|
12
|
+
extends: [
|
|
13
|
+
'airbnb-typescript',
|
|
14
|
+
],
|
|
15
|
+
parserOptions: {
|
|
16
|
+
project: './tsconfig.json',
|
|
17
|
+
tsconfigRootDir: __dirname,
|
|
18
|
+
sourceType: 'module',
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
'@typescript-eslint/lines-between-class-members': 'off',
|
|
22
|
+
'@typescript-eslint/no-unused-expressions': 'off',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
rules: {
|
|
27
|
+
'arrow-body-style': [
|
|
28
|
+
'warn',
|
|
29
|
+
'always',
|
|
30
|
+
],
|
|
31
|
+
'react/prop-types': 'off',
|
|
32
|
+
'react/function-component-definition': [
|
|
33
|
+
2,
|
|
34
|
+
{
|
|
35
|
+
namedComponents: 'arrow-function',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
'no-spaced-func': 'off',
|
|
39
|
+
'react-hooks/exhaustive-deps': 'off',
|
|
40
|
+
'lines-between-class-members': 'off',
|
|
41
|
+
'no-case-declarations': 'off',
|
|
42
|
+
'react/require-default-props': 'off',
|
|
43
|
+
'react/react-in-jsx-scope': 'off',
|
|
44
|
+
'arrow-parens': [
|
|
45
|
+
'warn',
|
|
46
|
+
'always',
|
|
47
|
+
],
|
|
48
|
+
'comma-dangle': [
|
|
49
|
+
'error',
|
|
50
|
+
{
|
|
51
|
+
arrays: 'always-multiline',
|
|
52
|
+
objects: 'always-multiline',
|
|
53
|
+
imports: 'always-multiline',
|
|
54
|
+
exports: 'always-multiline',
|
|
55
|
+
functions: 'always-multiline',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
'consistent-return': 'off',
|
|
59
|
+
'id-length': 'off',
|
|
60
|
+
'max-len': [
|
|
61
|
+
'error',
|
|
62
|
+
{
|
|
63
|
+
code: 125,
|
|
64
|
+
ignoreStrings: true,
|
|
65
|
+
ignoreTemplateLiterals: true,
|
|
66
|
+
ignoreUrls: true,
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
'newline-per-chained-call': [
|
|
70
|
+
'error',
|
|
71
|
+
{
|
|
72
|
+
ignoreChainWithDepth: 2,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
'no-plusplus': [
|
|
76
|
+
'warn',
|
|
77
|
+
{
|
|
78
|
+
allowForLoopAfterthoughts: true,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
'prefer-template': 1,
|
|
82
|
+
radix: 'error',
|
|
83
|
+
'no-await-in-loop': 'off',
|
|
84
|
+
'max-params': [
|
|
85
|
+
'warn',
|
|
86
|
+
{
|
|
87
|
+
max: 3,
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
module.exports = config;
|
|
@@ -3,10 +3,11 @@ declare global {
|
|
|
3
3
|
interface Chainable {
|
|
4
4
|
/**
|
|
5
5
|
* Assert that an element does not have a specific className
|
|
6
|
+
* @author Yuen Ler Chow
|
|
6
7
|
* @param opts object containing all arguments
|
|
7
8
|
* @param opts.item the css selector for finding the element
|
|
8
9
|
* @param opts.className the className to check for
|
|
9
|
-
* @
|
|
10
|
+
* @return Cypress chainable containing the element that was checked
|
|
10
11
|
*/
|
|
11
12
|
assertDoesNotHaveClass(opts: {
|
|
12
13
|
item: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertDoesNotHaveClass.js","sourceRoot":"","sources":["../../src/commands/assertDoesNotHaveClass.ts"],"names":[],"mappings":";AAAA,iCAAiC;;
|
|
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"}
|
|
@@ -3,10 +3,11 @@ declare global {
|
|
|
3
3
|
interface Chainable {
|
|
4
4
|
/**
|
|
5
5
|
* Assert that an element has a specific className
|
|
6
|
+
* @author Yuen Ler Chow
|
|
6
7
|
* @param opts object containing all arguments
|
|
7
8
|
* @param opts.item the css selector for finding the element
|
|
8
9
|
* @param opts.className the className to check for
|
|
9
|
-
* @
|
|
10
|
+
* @return Cypress chainable containing the element that was checked
|
|
10
11
|
*/
|
|
11
12
|
assertHasClass(opts: {
|
|
12
13
|
item: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertHasClass.js","sourceRoot":"","sources":["../../src/commands/assertHasClass.ts"],"names":[],"mappings":";AAAA,iCAAiC;;
|
|
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"}
|
|
@@ -3,10 +3,11 @@ declare global {
|
|
|
3
3
|
interface Chainable {
|
|
4
4
|
/**
|
|
5
5
|
* Assert a certain number of elements
|
|
6
|
+
* @author Yuen Ler Chow
|
|
6
7
|
* @param opts object containing all arguments
|
|
7
8
|
* @param opts.item a CSS selector corresponding to the item
|
|
8
9
|
* @param opts.num the precise number of elements expected
|
|
9
|
-
* @
|
|
10
|
+
* @return Cypress chainable
|
|
10
11
|
*/
|
|
11
12
|
assertNumElements(opts: {
|
|
12
13
|
item: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertNumElements.js","sourceRoot":"","sources":["../../src/commands/assertNumElements.ts"],"names":[],"mappings":";AAAA,iCAAiC;;
|
|
1
|
+
{"version":3,"file":"assertNumElements.js","sourceRoot":"","sources":["../../src/commands/assertNumElements.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AA2BjC,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"}
|
|
@@ -4,11 +4,15 @@ declare global {
|
|
|
4
4
|
/**
|
|
5
5
|
* Click an element with visibility checking, scrolling, and timeout handling
|
|
6
6
|
* @param item the CSS selector of interest
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
* @
|
|
7
|
+
* @param opts object containing all arguments
|
|
8
|
+
* @param opts.timeoutSec the number of seconds to wait before timing out (default: 10)
|
|
9
|
+
* @param opts.dontScrollTo if true, do not scroll to the element (default: false)
|
|
10
|
+
* @example cy.clickWithRetry('.submit-button', { timeoutSec: 15, dontScrollTo: false })
|
|
10
11
|
*/
|
|
11
|
-
clickWithRetry(item: string,
|
|
12
|
+
clickWithRetry(item: string, opts?: {
|
|
13
|
+
timeoutSec?: number;
|
|
14
|
+
dontScrollTo?: boolean;
|
|
15
|
+
}): Chainable<JQuery<HTMLElement>>;
|
|
12
16
|
}
|
|
13
17
|
}
|
|
14
18
|
}
|
|
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
/* --------------- Command -------------- */
|
|
6
6
|
/*----------------------------------------*/
|
|
7
7
|
var clickWithRetry = function () {
|
|
8
|
-
Cypress.Commands.add('clickWithRetry', function (item,
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
Cypress.Commands.add('clickWithRetry', function (item, opts) {
|
|
9
|
+
if (opts === void 0) { opts = {}; }
|
|
10
|
+
var timeoutSec = opts.timeoutSec, dontScrollTo = opts.dontScrollTo;
|
|
11
11
|
cy.log("Click ".concat(item));
|
|
12
12
|
// Wait for element to be visible first using our own function
|
|
13
13
|
cy.waitForElementVisible(item, timeoutSec);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clickWithRetry.js","sourceRoot":"","sources":["../../src/commands/clickWithRetry.ts"],"names":[],"mappings":";AAAA,iCAAiC;;
|
|
1
|
+
{"version":3,"file":"clickWithRetry.js","sourceRoot":"","sources":["../../src/commands/clickWithRetry.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AA4BjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,cAAc,GAAG;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,gBAAgB,EAChB,UACE,IAAY,EACZ,IAGM;QAHN,qBAAA,EAAA,SAGM;QAEA,IAAA,UAAU,GAAmB,IAAI,WAAvB,EAAE,YAAY,GAAK,IAAI,aAAT,CAAU;QAE1C,EAAE,CAAC,GAAG,CAAC,gBAAS,IAAI,CAAE,CAAC,CAAC;QAExB,8DAA8D;QAC9D,EAAE,CAAC,qBAAqB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAE3C,kDAAkD;QAClD,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;QAC9B,CAAC;aAAM,CAAC;YACN,0DAA0D;YAC1D,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;YAC9B,OAAO,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,cAAc,CAAC"}
|
|
@@ -3,11 +3,11 @@ declare global {
|
|
|
3
3
|
interface Chainable {
|
|
4
4
|
/**
|
|
5
5
|
* Get number of elements
|
|
6
|
-
* @
|
|
7
|
-
* @
|
|
8
|
-
* @
|
|
6
|
+
* @author Yuen Ler Chow
|
|
7
|
+
* @param selector a CSS selector corresponding to the item
|
|
8
|
+
* @return Cypress chainable containing the number of elements matching the selector
|
|
9
9
|
*/
|
|
10
|
-
getNumElements(
|
|
10
|
+
getNumElements(selector: string): Chainable<number>;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -8,7 +8,7 @@ var getNumElements = function () {
|
|
|
8
8
|
Cypress.Commands.add('getNumElements', function (selector) {
|
|
9
9
|
cy.log("Count elements matching ".concat(selector));
|
|
10
10
|
return cy.get(selector).then(function ($elements) {
|
|
11
|
-
return
|
|
11
|
+
return Cypress.$($elements).length;
|
|
12
12
|
});
|
|
13
13
|
});
|
|
14
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getNumElements.js","sourceRoot":"","sources":["../../src/commands/getNumElements.ts"],"names":[],"mappings":";AAAA,iCAAiC;;
|
|
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"}
|
|
@@ -3,10 +3,16 @@ declare global {
|
|
|
3
3
|
interface Chainable {
|
|
4
4
|
/**
|
|
5
5
|
* Handle a HarvardKey login page for a user
|
|
6
|
-
* @
|
|
7
|
-
* @
|
|
6
|
+
* @author Yuen Ler Chow
|
|
7
|
+
* @param opts object containing all arguments
|
|
8
|
+
* @param opts.url the URL to visit for HarvardKey authentication
|
|
9
|
+
* @param opts.name the name of the user environment variable
|
|
10
|
+
* @return Cypress chainable (void) - performs authentication flow, no return value
|
|
8
11
|
*/
|
|
9
|
-
handleHarvardKey(
|
|
12
|
+
handleHarvardKey(opts: {
|
|
13
|
+
url: string;
|
|
14
|
+
name: string;
|
|
15
|
+
}): Chainable<void>;
|
|
10
16
|
}
|
|
11
17
|
}
|
|
12
18
|
}
|
|
@@ -5,33 +5,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
/* --------------- Command -------------- */
|
|
6
6
|
/*----------------------------------------*/
|
|
7
7
|
var handleHarvardKey = function () {
|
|
8
|
-
Cypress.Commands.add('handleHarvardKey', function (
|
|
8
|
+
Cypress.Commands.add('handleHarvardKey', function (opts) {
|
|
9
|
+
var url = opts.url, name = opts.name;
|
|
9
10
|
cy.log('Handling HarvardKey authentication');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (!username) {
|
|
14
|
-
throw new Error("HARVARD_USERNAME environment variable is not set");
|
|
15
|
-
}
|
|
16
|
-
if (!password) {
|
|
17
|
-
throw new Error("HARVARD_PASSWORD environment variable is not set");
|
|
11
|
+
var userInfo = Cypress.env(name);
|
|
12
|
+
if (!userInfo) {
|
|
13
|
+
throw new Error("Could not find ".concat(name, " in environment variables"));
|
|
18
14
|
}
|
|
15
|
+
// Destructure the user info object to get the username and password
|
|
16
|
+
var username = userInfo.username;
|
|
17
|
+
var password = userInfo.password;
|
|
19
18
|
cy.visit(url);
|
|
20
19
|
// Get the Harvard login URL using originWithKaixa with auto-initialized functions
|
|
21
20
|
cy.origin('https://apps.cirrusidentity.com', function () {
|
|
22
21
|
Cypress.require('dceky');
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
domain: 'https://apps.cirrusidentity.com'
|
|
26
|
-
});
|
|
22
|
+
// Clicking the button doesn't work for some reason, so we access the href attribute instead
|
|
23
|
+
return cy.navigateToHref('#idp_1001962798_button');
|
|
27
24
|
}).then(function (fullUrl) {
|
|
28
25
|
// Navigate to the Harvard login page using originWithKaixa
|
|
29
26
|
cy.origin('https://harvard.idp.cirrusidentity.com', {
|
|
30
|
-
args: { username: username, password: password, fullUrl: fullUrl }
|
|
31
|
-
}, function (
|
|
32
|
-
var args = _a.args;
|
|
27
|
+
args: { username: username, password: password, fullUrl: fullUrl },
|
|
28
|
+
}, function (args) {
|
|
33
29
|
Cypress.require('dceky');
|
|
34
|
-
var
|
|
30
|
+
var harvardUsername = args.username, harvardPassword = args.password, harvardLoginUrl = args.fullUrl;
|
|
35
31
|
cy.on('uncaught:exception', function (e) {
|
|
36
32
|
// Ignore known HarvardKey errors
|
|
37
33
|
if (!e.message.includes('ready is not defined')) {
|
|
@@ -39,15 +35,15 @@ var handleHarvardKey = function () {
|
|
|
39
35
|
}
|
|
40
36
|
return false;
|
|
41
37
|
});
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
// Visit the Harvard login page
|
|
39
|
+
cy.visit(harvardLoginUrl);
|
|
40
|
+
// Wait for and fill in the login form
|
|
44
41
|
cy.waitForElementVisible('#username');
|
|
45
42
|
cy.waitForElementVisible('#password');
|
|
46
|
-
|
|
47
|
-
cy.typeInto({ item: '#
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
cy.clickWithRetry('input[type="submit"], button[type="submit"], .btn-primary');
|
|
43
|
+
cy.typeInto({ item: '#username', text: harvardUsername });
|
|
44
|
+
cy.typeInto({ item: '#password', text: harvardPassword });
|
|
45
|
+
// Submit the form
|
|
46
|
+
cy.get('input[type="submit"], button[type="submit"], .btn-primary').click();
|
|
51
47
|
});
|
|
52
48
|
});
|
|
53
49
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleHarvardKey.js","sourceRoot":"","sources":["../../src/commands/handleHarvardKey.ts"],"names":[],"mappings":";AAAA,iCAAiC;;
|
|
1
|
+
{"version":3,"file":"handleHarvardKey.js","sourceRoot":"","sources":["../../src/commands/handleHarvardKey.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AA2BjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,gBAAgB,GAAG;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,kBAAkB,EAClB,UACE,IAGC;QAEO,IAAA,GAAG,GAAW,IAAI,IAAf,EAAE,IAAI,GAAK,IAAI,KAAT,CAAU;QAC3B,EAAE,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;QAE7C,IAAM,QAAQ,GAAG,OAAO,CAAC,G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E,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,14 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Handle a HarvardKey login page for a user (using native Cypress commands only)
|
|
6
|
+
* @param url the URL to visit for HarvardKey authentication
|
|
7
|
+
* @example cy.handleHarvardKey2('https://canvas.harvard.edu/login/saml')
|
|
8
|
+
*/
|
|
9
|
+
handleHarvardKey2(url: string): Chainable<void>;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
declare const handleHarvardKey2: () => void;
|
|
14
|
+
export default handleHarvardKey2;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var handleHarvardKey2 = function () {
|
|
8
|
+
Cypress.Commands.add('handleHarvardKey2', function (url) {
|
|
9
|
+
cy.log('Handling HarvardKey authentication (native Cypress only)');
|
|
10
|
+
// Get credentials from environment variables
|
|
11
|
+
var username = Cypress.env('HARVARD_USERNAME');
|
|
12
|
+
var password = Cypress.env('HARVARD_PASSWORD');
|
|
13
|
+
if (!username) {
|
|
14
|
+
throw new Error("HARVARD_USERNAME environment variable is not set");
|
|
15
|
+
}
|
|
16
|
+
if (!password) {
|
|
17
|
+
throw new Error("HARVARD_PASSWORD environment variable is not set");
|
|
18
|
+
}
|
|
19
|
+
cy.log('Starting HarvardKey authentication with credentials check');
|
|
20
|
+
cy.log('Username: ' + (username ? 'SET' : 'NOT SET'));
|
|
21
|
+
cy.log('Password: ' + (password ? 'SET' : 'NOT SET'));
|
|
22
|
+
cy.visit(url);
|
|
23
|
+
// Get the Harvard login URL using native Cypress commands only
|
|
24
|
+
cy.origin('https://apps.cirrusidentity.com', function () {
|
|
25
|
+
// Wait for the Harvard identity provider button and get its href using native Cypress commands only
|
|
26
|
+
cy.visit('https://google.com');
|
|
27
|
+
}).then(function (fullUrl) {
|
|
28
|
+
cy.log('Received full URL from first origin: ' + fullUrl);
|
|
29
|
+
// Navigate to the Harvard login page using native Cypress commands
|
|
30
|
+
cy.origin('https://google.com', {
|
|
31
|
+
args: { fullUrl: fullUrl }
|
|
32
|
+
}, function (_a) {
|
|
33
|
+
var args = _a.args;
|
|
34
|
+
cy.log('Inside second origin - args received:');
|
|
35
|
+
cy.log('args object: ' + JSON.stringify(args));
|
|
36
|
+
if (!args || !args.fullUrl) {
|
|
37
|
+
throw new Error('Args object or fullUrl is undefined');
|
|
38
|
+
}
|
|
39
|
+
// Get credentials from Cypress env instead of args
|
|
40
|
+
var username = Cypress.env('HARVARD_USERNAME');
|
|
41
|
+
var password = Cypress.env('HARVARD_PASSWORD');
|
|
42
|
+
var fullUrl = args.fullUrl;
|
|
43
|
+
cy.log('Full URL: ' + fullUrl);
|
|
44
|
+
cy.log('Username: ' + username);
|
|
45
|
+
cy.log('Password: ' + password);
|
|
46
|
+
// Handle known HarvardKey errors
|
|
47
|
+
cy.on('uncaught:exception', function (e) {
|
|
48
|
+
if (!e.message.includes('ready is not defined')) {
|
|
49
|
+
throw e;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
});
|
|
53
|
+
// Visit the Harvard login page
|
|
54
|
+
cy.visit(fullUrl.toString());
|
|
55
|
+
// Wait for and fill in the login form using native Cypress commands
|
|
56
|
+
cy.get('#username', { timeout: 10000 })
|
|
57
|
+
.should('be.visible')
|
|
58
|
+
.clear()
|
|
59
|
+
.type(username);
|
|
60
|
+
cy.get('#password', { timeout: 10000 })
|
|
61
|
+
.should('be.visible')
|
|
62
|
+
.clear()
|
|
63
|
+
.type(password);
|
|
64
|
+
// Submit the form - try multiple possible submit selectors
|
|
65
|
+
cy.get('body').then(function ($body) {
|
|
66
|
+
if ($body.find('input[type="submit"]').length > 0) {
|
|
67
|
+
cy.get('input[type="submit"]').first().click();
|
|
68
|
+
}
|
|
69
|
+
else if ($body.find('button[type="submit"]').length > 0) {
|
|
70
|
+
cy.get('button[type="submit"]').first().click();
|
|
71
|
+
}
|
|
72
|
+
else if ($body.find('.btn-primary').length > 0) {
|
|
73
|
+
cy.get('.btn-primary').first().click();
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
// Fallback - look for any button or submit input
|
|
77
|
+
cy.get('button, input[type="submit"]').first().click();
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
/*----------------------------------------*/
|
|
85
|
+
/* --------------- Export --------------- */
|
|
86
|
+
/*----------------------------------------*/
|
|
87
|
+
exports.default = handleHarvardKey2;
|
|
88
|
+
//# sourceMappingURL=handleHarvardKey2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleHarvardKey2.js","sourceRoot":"","sources":["../../src/commands/handleHarvardKey2.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAmBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM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AAE,KAAK,EAAE,CAAC;qBACpC,MAAM,CAAC,YAAY,CAAC;qBACpB,KAAK,EAAE;qBACP,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAElB,2DAA2D;gBAC3D,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,UAAC,KAAK;oBACxB,IAAI,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBAClD,EAAE,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC;oBACjD,CAAC;yBAAM,IAAI,KAAK,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBAC1D,EAAE,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC;oBAClD,CAAC;yBAAM,IAAI,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBACjD,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC;oBACzC,CAAC;yBAAM,CAAC;wBACN,iDAAiD;wBACjD,EAAE,CAAC,GAAG,CAAC,8BAA8B,CAAC,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC;oBACzD,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,iBAAiB,CAAC"}
|
|
@@ -3,19 +3,21 @@ declare global {
|
|
|
3
3
|
interface Chainable {
|
|
4
4
|
/**
|
|
5
5
|
* Log into Canvas and launch an LTI app as a specific user from environment variables.
|
|
6
|
-
* The user should be defined as environment
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* @
|
|
16
|
-
* @example cy.launchAs('student1', 12345, 'My LTI App')
|
|
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
|
|
17
16
|
*/
|
|
18
|
-
launchAs(name: string,
|
|
17
|
+
launchAs(name: string, opts?: {
|
|
18
|
+
courseId?: number;
|
|
19
|
+
appName?: string;
|
|
20
|
+
}): Chainable<void>;
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
23
|
}
|
package/lib/commands/launchAs.js
CHANGED
|
@@ -5,28 +5,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
/* --------------- Command -------------- */
|
|
6
6
|
/*----------------------------------------*/
|
|
7
7
|
var launchAs = function () {
|
|
8
|
-
Cypress.Commands.add('launchAs', function (name,
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
11
12
|
if (!courseId) {
|
|
12
|
-
var envCourseId = Cypress.env('
|
|
13
|
+
var envCourseId = Cypress.env('courseId');
|
|
13
14
|
if (!envCourseId) {
|
|
14
|
-
throw new Error('
|
|
15
|
+
throw new Error('Could not find courseId in environment variables');
|
|
15
16
|
}
|
|
16
|
-
courseId = parseInt(envCourseId, 10);
|
|
17
|
+
courseId = Number.parseInt(envCourseId, 10);
|
|
17
18
|
}
|
|
19
|
+
// Get appName from environment variables if not provided
|
|
20
|
+
appName = appName || Cypress.env('appName');
|
|
18
21
|
if (!appName) {
|
|
19
|
-
|
|
20
|
-
if (!appName) {
|
|
21
|
-
throw new Error('appName parameter is required or APP_NAME environment variable must be set');
|
|
22
|
-
}
|
|
22
|
+
throw new Error('Could not find appName in environment variables');
|
|
23
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));
|
|
24
30
|
// Check if this is a local launch
|
|
25
|
-
var isLocal = Cypress.env('
|
|
31
|
+
var isLocal = Cypress.env('local') === 'true';
|
|
26
32
|
if (isLocal) {
|
|
27
33
|
// Handle local simulator launch
|
|
28
|
-
var userType =
|
|
29
|
-
var simIndex =
|
|
34
|
+
var userType = userInfo.type || 'teacher';
|
|
35
|
+
var simIndex = userInfo.simIndex || '0';
|
|
30
36
|
var simLaunchButtonId = "".concat(userType, "_").concat(simIndex, "-launch-button");
|
|
31
37
|
cy.log('Local mode: launching simulator');
|
|
32
38
|
cy.visit('https://localhost:8088/simulator');
|
|
@@ -40,22 +46,17 @@ var launchAs = function () {
|
|
|
40
46
|
});
|
|
41
47
|
// Launch the app
|
|
42
48
|
cy.get("#".concat(simLaunchButtonId)).click();
|
|
43
|
-
//
|
|
44
|
-
cy.
|
|
45
|
-
cy.get('body').then(function ($body) {
|
|
46
|
-
if ($body.find('.authorize-button').length > 0) {
|
|
47
|
-
cy.get('.authorize-button').click();
|
|
48
|
-
}
|
|
49
|
-
});
|
|
49
|
+
// Click the authorize button
|
|
50
|
+
cy.get('.authorize-button', { timeout: 1000 }).click();
|
|
50
51
|
return;
|
|
51
52
|
}
|
|
52
53
|
// Handle production launch with access token
|
|
53
|
-
var accessToken =
|
|
54
|
+
var accessToken = userInfo.accessToken;
|
|
54
55
|
if (!accessToken) {
|
|
55
|
-
throw new Error("
|
|
56
|
+
throw new Error("Could not find accessToken for ".concat(name, " in environment variables"));
|
|
56
57
|
}
|
|
57
58
|
// Launch using the access token
|
|
58
|
-
cy.launchLTIUsingToken(accessToken, courseId, appName);
|
|
59
|
+
cy.launchLTIUsingToken(accessToken, { courseId: courseId, appName: appName });
|
|
59
60
|
});
|
|
60
61
|
};
|
|
61
62
|
/*----------------------------------------*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launchAs.js","sourceRoot":"","sources":["../../src/commands/launchAs.ts"],"names":[],"mappings":";AAAA,iCAAiC;;
|
|
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,CAAC;YAC5C,IAAI,CAAC,WAAW,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;YACtE,CAAC;YACD,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAC9C,CAAC;QAED,yDAAyD;QACzD,OAAO,G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,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"}
|
|
@@ -3,12 +3,17 @@ declare global {
|
|
|
3
3
|
interface Chainable {
|
|
4
4
|
/**
|
|
5
5
|
* Log into Canvas using an access token and launch an LTI app
|
|
6
|
+
* @author Yuen Ler Chow
|
|
6
7
|
* @param accessToken the user's Canvas access token
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
* @
|
|
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
|
|
10
12
|
*/
|
|
11
|
-
launchLTIUsingToken(accessToken: string,
|
|
13
|
+
launchLTIUsingToken(accessToken: string, opts?: {
|
|
14
|
+
courseId?: number;
|
|
15
|
+
appName?: string;
|
|
16
|
+
}): Chainable<void>;
|
|
12
17
|
}
|
|
13
18
|
}
|
|
14
19
|
}
|