dceky 1.0.0-beta-profile.1 → 1.0.0-beta-yuenler.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/lib/commands/assertDoesNotHaveClass.d.ts +19 -0
- package/lib/commands/assertDoesNotHaveClass.js +17 -0
- package/lib/commands/assertDoesNotHaveClass.js.map +1 -0
- package/lib/commands/assertHasClass.d.ts +19 -0
- package/lib/commands/assertHasClass.js +17 -0
- package/lib/commands/assertHasClass.js.map +1 -0
- package/lib/commands/assertNumElements.d.ts +19 -0
- package/lib/commands/assertNumElements.js +17 -0
- package/lib/commands/assertNumElements.js.map +1 -0
- package/lib/commands/clickWithRetry.d.ts +16 -0
- package/lib/commands/clickWithRetry.js +29 -0
- package/lib/commands/clickWithRetry.js.map +1 -0
- package/lib/commands/getNumElements.d.ts +15 -0
- package/lib/commands/getNumElements.js +19 -0
- package/lib/commands/getNumElements.js.map +1 -0
- package/lib/commands/handleHarvardKey.d.ts +14 -0
- package/lib/commands/handleHarvardKey.js +59 -0
- package/lib/commands/handleHarvardKey.js.map +1 -0
- package/lib/commands/launchAs.d.ts +23 -0
- package/lib/commands/launchAs.js +65 -0
- package/lib/commands/launchAs.js.map +1 -0
- package/lib/commands/launchLTIUsingToken.d.ts +16 -0
- package/lib/commands/launchLTIUsingToken.js +57 -0
- package/lib/commands/launchLTIUsingToken.js.map +1 -0
- package/lib/commands/navigateToHref.d.ts +20 -0
- package/lib/commands/navigateToHref.js +23 -0
- package/lib/commands/navigateToHref.js.map +1 -0
- package/lib/commands/runScript.d.ts +17 -0
- package/lib/commands/runScript.js +25 -0
- package/lib/commands/runScript.js.map +1 -0
- package/lib/commands/typeInto.d.ts +21 -0
- package/lib/commands/typeInto.js +28 -0
- package/lib/commands/typeInto.js.map +1 -0
- package/lib/commands/visitCanvasGETEndpoint.d.ts +20 -0
- package/lib/commands/visitCanvasGETEndpoint.js +26 -0
- package/lib/commands/visitCanvasGETEndpoint.js.map +1 -0
- package/lib/commands/waitForElementVisible.d.ts +15 -0
- package/lib/commands/waitForElementVisible.js +20 -0
- package/lib/commands/waitForElementVisible.js.map +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/init.d.ts +4 -11
- package/lib/init.js +35 -4
- package/lib/init.js.map +1 -1
- package/package.json +4 -20
- package/src/commands/assertDoesNotHaveClass.ts +40 -0
- package/src/commands/assertHasClass.ts +40 -0
- package/src/commands/assertNumElements.ts +37 -0
- package/src/commands/clickWithRetry.ts +51 -0
- package/src/commands/getNumElements.ts +38 -0
- package/src/commands/handleHarvardKey.ts +87 -0
- package/src/commands/launchAs.ts +104 -0
- package/src/commands/launchLTIUsingToken.ts +84 -0
- package/src/commands/navigateToHref.ts +45 -0
- package/src/commands/runScript.ts +42 -0
- package/src/commands/typeInto.ts +57 -0
- package/src/commands/visitCanvasGETEndpoint.ts +48 -0
- package/src/commands/waitForElementVisible.ts +40 -0
- package/src/genConfiguration.ts +11 -0
- package/src/index.ts +2 -7
- package/src/init.ts +26 -2
- package/tsconfig.json +0 -1
- package/docs/GlobalsAndProfiles.md +0 -23
- package/profileChooser/chooseProfile.ts +0 -35
- package/profileChooser/helpers/print.ts +0 -155
- package/profileChooser/helpers/prompt.ts +0 -23
- package/profileChooser/helpers/showChooser.ts +0 -95
- package/profileChooser/types/ChooserOption.ts +0 -11
- package/src/commands/clickSomething.ts +0 -33
- package/src/genConfiguration/helpers/resolveDependents.ts +0 -47
- package/src/genConfiguration/helpers/splitEnv.ts +0 -30
- package/src/genConfiguration/index.ts +0 -83
- package/src/genConfiguration/types/DependentValue.ts +0 -14
- package/src/genConfiguration/types/GlobalsOrProfile.ts +0 -12
- package/src/genConfiguration/types/SplitEnv.ts +0 -18
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Assert that an element does not have a specific className
|
|
6
|
+
* @param opts object containing all arguments
|
|
7
|
+
* @param opts.item the css selector for finding the element
|
|
8
|
+
* @param opts.className the className to check for
|
|
9
|
+
* @example cy.assertDoesNotHaveClass({ item: '.my-button', className: 'disabled' })
|
|
10
|
+
*/
|
|
11
|
+
assertDoesNotHaveClass(opts: {
|
|
12
|
+
item: string;
|
|
13
|
+
className: string;
|
|
14
|
+
}): Chainable<JQuery<HTMLElement>>;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
declare const assertDoesNotHaveClass: () => void;
|
|
19
|
+
export default assertDoesNotHaveClass;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var assertDoesNotHaveClass = function () {
|
|
8
|
+
Cypress.Commands.add('assertDoesNotHaveClass', function (opts) {
|
|
9
|
+
cy.log("Assert ".concat(opts.item, " does not have class ").concat(opts.className));
|
|
10
|
+
return cy.get(opts.item).should('not.have.class', opts.className);
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
/*----------------------------------------*/
|
|
14
|
+
/* --------------- Export --------------- */
|
|
15
|
+
/*----------------------------------------*/
|
|
16
|
+
exports.default = assertDoesNotHaveClass;
|
|
17
|
+
//# sourceMappingURL=assertDoesNotHaveClass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertDoesNotHaveClass.js","sourceRoot":"","sources":["../../src/commands/assertDoesNotHaveClass.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAwBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,sBAAsB,GAAG;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,wBAAwB,EAAE,UAAC,IAAyC;QACvF,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,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Assert that an element has a specific className
|
|
6
|
+
* @param opts object containing all arguments
|
|
7
|
+
* @param opts.item the css selector for finding the element
|
|
8
|
+
* @param opts.className the className to check for
|
|
9
|
+
* @example cy.assertHasClass({ item: '.my-button', className: 'active' })
|
|
10
|
+
*/
|
|
11
|
+
assertHasClass(opts: {
|
|
12
|
+
item: string;
|
|
13
|
+
className: string;
|
|
14
|
+
}): Chainable<JQuery<HTMLElement>>;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
declare const assertHasClass: () => void;
|
|
19
|
+
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;;AAwBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,cAAc,GAAG;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,EAAE,UAAC,IAAyC;QAC/E,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,CAAC,CAAC;AACL,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
|
+
* @param opts object containing all arguments
|
|
7
|
+
* @param opts.item a CSS selector corresponding to the item
|
|
8
|
+
* @param opts.num the precise number of elements expected
|
|
9
|
+
* @example cy.assertNumElements({ item: '.list-item', num: 5 })
|
|
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;;AAqBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,iBAAiB,GAAG;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,mBAAmB,EAAE,UAAC,IAAmC;QAC5E,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,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Click an element with visibility checking, scrolling, and timeout handling
|
|
6
|
+
* @param item the CSS selector of interest
|
|
7
|
+
* @param timeoutSec the number of seconds to wait before timing out (default: 10)
|
|
8
|
+
* @param dontScrollTo if true, do not scroll to the element (default: false)
|
|
9
|
+
* @example cy.clickWithRetry('.submit-button', 15, false)
|
|
10
|
+
*/
|
|
11
|
+
clickWithRetry(item: string, timeoutSec?: number, dontScrollTo?: boolean): Chainable<JQuery<HTMLElement>>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
declare const clickWithRetry: () => void;
|
|
16
|
+
export default clickWithRetry;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var clickWithRetry = function () {
|
|
8
|
+
Cypress.Commands.add('clickWithRetry', function (item, timeoutSec, dontScrollTo) {
|
|
9
|
+
timeoutSec = timeoutSec || 10;
|
|
10
|
+
dontScrollTo = dontScrollTo || false;
|
|
11
|
+
cy.log("Click ".concat(item));
|
|
12
|
+
// Wait for element to be visible first using our own function
|
|
13
|
+
cy.waitForElementVisible(item, timeoutSec);
|
|
14
|
+
// If scrolling is disabled, try to click directly
|
|
15
|
+
if (dontScrollTo) {
|
|
16
|
+
return cy.get(item).click();
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
// Scroll to element and then click using our own function
|
|
20
|
+
cy.get(item).scrollIntoView();
|
|
21
|
+
return cy.get(item).click();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
/*----------------------------------------*/
|
|
26
|
+
/* --------------- Export --------------- */
|
|
27
|
+
/*----------------------------------------*/
|
|
28
|
+
exports.default = clickWithRetry;
|
|
29
|
+
//# sourceMappingURL=clickWithRetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clickWithRetry.js","sourceRoot":"","sources":["../../src/commands/clickWithRetry.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAqBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,cAAc,GAAG;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,EAAE,UAAC,IAAY,EAAE,UAAmB,EAAE,YAAsB;QAC/F,UAAU,GAAG,UAAU,IAAI,EAAE,CAAC;QAC9B,YAAY,GAAG,YAAY,IAAI,KAAK,CAAC;QAErC,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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Get number of elements
|
|
6
|
+
* @param item a CSS selector corresponding to the item
|
|
7
|
+
* @returns the number of elements on the page
|
|
8
|
+
* @example cy.getNumElements('.list-item').then((count) => { ... })
|
|
9
|
+
*/
|
|
10
|
+
getNumElements(item: string): Chainable<JQuery<any>>;
|
|
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 cy.wrap($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;;AAoBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,cAAc,GAAG;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,EAAE,UAAC,QAAgB;QACtD,EAAE,CAAC,GAAG,CAAC,kCAA2B,QAAQ,CAAE,CAAC,CAAC;QAC9C,OAAO,EAAE,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,UAAC,SAAc;YAC1C,OAAO,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Handle a HarvardKey login page for a user
|
|
6
|
+
* @param url the URL to visit for HarvardKey authentication
|
|
7
|
+
* @example cy.handleHarvardKey('https://canvas.harvard.edu/login/saml')
|
|
8
|
+
*/
|
|
9
|
+
handleHarvardKey(url: string): Chainable<void>;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
declare const handleHarvardKey: () => void;
|
|
14
|
+
export default handleHarvardKey;
|
|
@@ -0,0 +1,59 @@
|
|
|
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 (url) {
|
|
9
|
+
cy.log('Handling HarvardKey authentication');
|
|
10
|
+
// Get credentials from environment variables
|
|
11
|
+
var username = window.Cypress.env('HARVARD_USERNAME');
|
|
12
|
+
var password = window.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.visit(url);
|
|
20
|
+
// Get the Harvard login URL using originWithKaixa with auto-initialized functions
|
|
21
|
+
cy.origin('https://apps.cirrusidentity.com', function () {
|
|
22
|
+
Cypress.require('dceky');
|
|
23
|
+
return cy.navigateToHref({
|
|
24
|
+
item: '#idp_1001962798_button',
|
|
25
|
+
domain: 'https://apps.cirrusidentity.com'
|
|
26
|
+
});
|
|
27
|
+
}).then(function (fullUrl) {
|
|
28
|
+
// Navigate to the Harvard login page using originWithKaixa
|
|
29
|
+
cy.origin('https://harvard.idp.cirrusidentity.com', {
|
|
30
|
+
args: { username: username, password: password, fullUrl: fullUrl }
|
|
31
|
+
}, function (_a) {
|
|
32
|
+
var args = _a.args;
|
|
33
|
+
Cypress.require('dceky');
|
|
34
|
+
var username = args.username, password = args.password, fullUrl = args.fullUrl;
|
|
35
|
+
cy.on('uncaught:exception', function (e) {
|
|
36
|
+
// Ignore known HarvardKey errors
|
|
37
|
+
if (!e.message.includes('ready is not defined')) {
|
|
38
|
+
throw e;
|
|
39
|
+
}
|
|
40
|
+
return false;
|
|
41
|
+
});
|
|
42
|
+
cy.visit(fullUrl.toString());
|
|
43
|
+
// Wait for and fill in the login form using enhanced functions
|
|
44
|
+
cy.waitForElementVisible('#username');
|
|
45
|
+
cy.waitForElementVisible('#password');
|
|
46
|
+
// Add credentials using enhanced functions
|
|
47
|
+
cy.typeInto({ item: '#username', text: username });
|
|
48
|
+
cy.typeInto({ item: '#password', text: password });
|
|
49
|
+
// Submit the form using clickWithRetry
|
|
50
|
+
cy.clickWithRetry('input[type="submit"], button[type="submit"], .btn-primary');
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
/*----------------------------------------*/
|
|
56
|
+
/* --------------- Export --------------- */
|
|
57
|
+
/*----------------------------------------*/
|
|
58
|
+
exports.default = handleHarvardKey;
|
|
59
|
+
//# sourceMappingURL=handleHarvardKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleHarvardKey.js","sourceRoot":"","sources":["../../src/commands/handleHarvardKey.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAmBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,gBAAgB,GAAG;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,kBAAkB,EAAE,UAAC,GAAW;Q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AE,CAAC;wBAChD,MAAM,CAAC,CAAC;oBACV,CAAC;oBACD,OAAO,KAAK,CAAC;gBACf,CAAC,CAAC,CAAC;gBAEH,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;gBAE7B,+DAA+D;gBAC/D,EAAE,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;gBACtC,EAAE,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAC;gBAEtC,2CAA2C;gBAC3C,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;gBACnD,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;gBAEnD,uCAAuC;gBACvC,EAAE,CAAC,cAAc,CAAC,2DAA2D,CAAC,CAAC;YACjF,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 environment variables with the following properties:
|
|
7
|
+
* - {name}_ACCESS_TOKEN: Canvas access token for the user
|
|
8
|
+
* - {name}_USERNAME: Username (if no access token)
|
|
9
|
+
* - {name}_PASSWORD: Password (if using username)
|
|
10
|
+
* - {name}_IS_XID: Set to 'true' if using XID login
|
|
11
|
+
* - {name}_TYPE: User type ('student', 'ta', 'teacher') for local mode
|
|
12
|
+
* - {name}_SIM_INDEX: Simulator index for local mode
|
|
13
|
+
* @param name the name of the user (used as prefix for environment variables)
|
|
14
|
+
* @param courseId the Canvas ID of the course to launch from (uses COURSE_ID env var if not provided)
|
|
15
|
+
* @param appName the name of the app as it appears in the course's left-hand nav (uses APP_NAME env var if not provided)
|
|
16
|
+
* @example cy.launchAs('student1', 12345, 'My LTI App')
|
|
17
|
+
*/
|
|
18
|
+
launchAs(name: string, courseId?: number, appName?: string): Chainable<void>;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
declare const launchAs: () => void;
|
|
23
|
+
export default launchAs;
|
|
@@ -0,0 +1,65 @@
|
|
|
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, courseId, appName) {
|
|
9
|
+
cy.log("\uD83D\uDE80 Launch as ".concat(name));
|
|
10
|
+
// Get default values from environment variables if not provided
|
|
11
|
+
if (!courseId) {
|
|
12
|
+
var envCourseId = Cypress.env('COURSE_ID');
|
|
13
|
+
if (!envCourseId) {
|
|
14
|
+
throw new Error('courseId parameter is required or COURSE_ID environment variable must be set');
|
|
15
|
+
}
|
|
16
|
+
courseId = parseInt(envCourseId, 10);
|
|
17
|
+
}
|
|
18
|
+
if (!appName) {
|
|
19
|
+
appName = Cypress.env('APP_NAME');
|
|
20
|
+
if (!appName) {
|
|
21
|
+
throw new Error('appName parameter is required or APP_NAME environment variable must be set');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
// Check if this is a local launch
|
|
25
|
+
var isLocal = Cypress.env('LOCAL') === 'true';
|
|
26
|
+
if (isLocal) {
|
|
27
|
+
// Handle local simulator launch
|
|
28
|
+
var userType = Cypress.env("".concat(name, "_TYPE")) || 'teacher';
|
|
29
|
+
var simIndex = Cypress.env("".concat(name, "_SIM_INDEX")) || '0';
|
|
30
|
+
var simLaunchButtonId = "".concat(userType, "_").concat(simIndex, "-launch-button");
|
|
31
|
+
cy.log('Local mode: launching simulator');
|
|
32
|
+
cy.visit('https://localhost:8088/simulator');
|
|
33
|
+
// Handle potential SSL certificate issues
|
|
34
|
+
cy.get('body').then(function ($body) {
|
|
35
|
+
if ($body.find('.ssl').length > 0) {
|
|
36
|
+
cy.log('Handling SSL certificate issue');
|
|
37
|
+
cy.get('#details-button').click();
|
|
38
|
+
cy.get('#proceed-link').click();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
// Launch the app
|
|
42
|
+
cy.get("#".concat(simLaunchButtonId)).click();
|
|
43
|
+
// Check for authorization screen
|
|
44
|
+
cy.wait(1000);
|
|
45
|
+
cy.get('body').then(function ($body) {
|
|
46
|
+
if ($body.find('.authorize-button').length > 0) {
|
|
47
|
+
cy.get('.authorize-button').click();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
// Handle production launch with access token
|
|
53
|
+
var accessToken = Cypress.env("".concat(name, "_ACCESS_TOKEN"));
|
|
54
|
+
if (!accessToken) {
|
|
55
|
+
throw new Error("".concat(name, "_ACCESS_TOKEN environment variable is required for user \"").concat(name, "\""));
|
|
56
|
+
}
|
|
57
|
+
// Launch using the access token
|
|
58
|
+
cy.launchLTIUsingToken(accessToken, courseId, appName);
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
/*----------------------------------------*/
|
|
62
|
+
/* --------------- Export --------------- */
|
|
63
|
+
/*----------------------------------------*/
|
|
64
|
+
exports.default = launchAs;
|
|
65
|
+
//# sourceMappingURL=launchAs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launchAs.js","sourceRoot":"","sources":["../../src/commands/launchAs.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AA4BjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,QAAQ,GAAG;IACf,OAAO,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ress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Log into Canvas using an access token and launch an LTI app
|
|
6
|
+
* @param accessToken the user's Canvas access token
|
|
7
|
+
* @param courseId the Canvas ID of the course to launch from
|
|
8
|
+
* @param appName the name of the app as it appears in the course's left-hand nav
|
|
9
|
+
* @example cy.launchLTIUsingToken('your_access_token', 12345, 'My LTI App')
|
|
10
|
+
*/
|
|
11
|
+
launchLTIUsingToken(accessToken: string, courseId: number, appName: string): Chainable<void>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
declare const launchLTIUsingToken: () => void;
|
|
16
|
+
export default launchLTIUsingToken;
|
|
@@ -0,0 +1,57 @@
|
|
|
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, courseId, appName) {
|
|
9
|
+
cy.log("Launch LTI app \"".concat(appName, "\" in course ").concat(courseId, " using access token"));
|
|
10
|
+
// Get the external tools for the course
|
|
11
|
+
cy.visitCanvasGETEndpoint({
|
|
12
|
+
path: "/courses/".concat(courseId, "/external_tools"),
|
|
13
|
+
accessToken: accessToken
|
|
14
|
+
}).then(function (externalTools) {
|
|
15
|
+
cy.log("Found ".concat(externalTools.length, " external tools"));
|
|
16
|
+
// Find the external tool of interest
|
|
17
|
+
var toolId = 0;
|
|
18
|
+
for (var _i = 0, externalTools_1 = externalTools; _i < externalTools_1.length; _i++) {
|
|
19
|
+
var externalTool = externalTools_1[_i];
|
|
20
|
+
// Skip non-nav items
|
|
21
|
+
if (!externalTool.course_navigation || typeof externalTool.course_navigation !== 'object') {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
// Skip non-labeled items
|
|
25
|
+
if (!externalTool.course_navigation.text) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
// Check if this app matches the name
|
|
29
|
+
var thisAppName = externalTool.course_navigation.text.trim().toLowerCase();
|
|
30
|
+
if (thisAppName === appName.trim().toLowerCase()) {
|
|
31
|
+
toolId = externalTool.id;
|
|
32
|
+
cy.log("Found matching app: \"".concat(externalTool.course_navigation.text, "\" with ID ").concat(toolId));
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// Make sure we found the app
|
|
37
|
+
if (toolId === 0) {
|
|
38
|
+
throw new Error("Could not find any apps named \"".concat(appName, "\" in course ").concat(courseId));
|
|
39
|
+
}
|
|
40
|
+
// Get a sessionless launch URL
|
|
41
|
+
cy.visitCanvasGETEndpoint({
|
|
42
|
+
path: "/courses/".concat(courseId, "/external_tools/sessionless_launch?id=").concat(toolId),
|
|
43
|
+
accessToken: accessToken
|
|
44
|
+
}).then(function (sessionlessLaunchInfo) {
|
|
45
|
+
var launchURL = sessionlessLaunchInfo.url;
|
|
46
|
+
cy.log("Launching LTI app at: ".concat(launchURL));
|
|
47
|
+
// Launch the tool
|
|
48
|
+
cy.visit(launchURL);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
/*----------------------------------------*/
|
|
54
|
+
/* --------------- Export --------------- */
|
|
55
|
+
/*----------------------------------------*/
|
|
56
|
+
exports.default = launchLTIUsingToken;
|
|
57
|
+
//# sourceMappingURL=launchLTIUsingToken.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launchLTIUsingToken.js","sourceRoot":"","sources":["../../src/commands/launchLTIUsingToken.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAqBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,mBAAmB,GAAG;IAC1B,OAAO,CAAC,QAAQ,CAAC,GAAG,CA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AkC,OAAO,0BAAe,QAAQ,CAAE,CAAC,CAAC;YACtF,CAAC;YAED,+BAA+B;YAC/B,EAAE,CAAC,sBAAsB,CAAC;gBACxB,IAAI,EAAE,mBAAY,QAAQ,mDAAyC,MAAM,CAAE;gBAC3E,WAAW,EAAE,WAAW;aACzB,CAAC,CAAC,IAAI,CAAC,UAAC,qBAA0B;gBACjC,IAAM,SAAS,GAAG,qBAAqB,CAAC,GAAG,CAAC;gBAC5C,EAAE,CAAC,GAAG,CAAC,gCAAyB,SAAS,CAAE,CAAC,CAAC;gBAE7C,kBAAkB;gBAClB,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACtB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Navigate to href attribute of Harvard identity provider button
|
|
6
|
+
* @param opts object containing all arguments
|
|
7
|
+
* @param opts.item the CSS selector of interest
|
|
8
|
+
* @param opts.domain the domain of the page
|
|
9
|
+
* @returns The full URL constructed from the href
|
|
10
|
+
* @example cy.navigateToHref({ item: '#login-button', domain: 'https://example.com' })
|
|
11
|
+
*/
|
|
12
|
+
navigateToHref(opts: {
|
|
13
|
+
item: string;
|
|
14
|
+
domain: string;
|
|
15
|
+
}): Chainable<string>;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
declare const navigateToHref: () => void;
|
|
20
|
+
export default navigateToHref;
|
|
@@ -0,0 +1,23 @@
|
|
|
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 (opts) {
|
|
9
|
+
var item = opts.item, domain = opts.domain;
|
|
10
|
+
cy.waitForElementVisible(item);
|
|
11
|
+
return cy
|
|
12
|
+
.get(item)
|
|
13
|
+
.invoke('attr', 'href')
|
|
14
|
+
.then(function (href) {
|
|
15
|
+
return domain + href;
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
/*----------------------------------------*/
|
|
20
|
+
/* --------------- Export --------------- */
|
|
21
|
+
/*----------------------------------------*/
|
|
22
|
+
exports.default = navigateToHref;
|
|
23
|
+
//# sourceMappingURL=navigateToHref.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigateToHref.js","sourceRoot":"","sources":["../../src/commands/navigateToHref.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAsBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,cAAc,GAAG;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,gBAAgB,EAAE,UAAC,IAAsC;QACpE,IAAA,IAAI,GAAa,IAAI,KAAjB,EAAE,MAAM,GAAK,IAAI,OAAT,CAAU;QAE9B,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAC/B,OAAO,EAAE;aACN,GAAG,CAAC,IAAI,CAAC;aACT,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;aACtB,IAAI,CAAC,UAAC,IAAS;YACd,OAAO,MAAM,GAAG,IAAI,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Run a script on the page
|
|
6
|
+
* @param scriptLines the script to run in an anonymous function on the page.
|
|
7
|
+
* If multiple script arguments are included, each argument will be considered a
|
|
8
|
+
* new line of the script.
|
|
9
|
+
* @returns return value of the script
|
|
10
|
+
* @example cy.runScript('console.log("Hello");', 'return document.title;')
|
|
11
|
+
*/
|
|
12
|
+
runScript(...scriptLines: string[]): Chainable<any>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
declare const runScript: () => void;
|
|
17
|
+
export default runScript;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var runScript = function () {
|
|
8
|
+
Cypress.Commands.add('runScript', function () {
|
|
9
|
+
var scriptLines = [];
|
|
10
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
11
|
+
scriptLines[_i] = arguments[_i];
|
|
12
|
+
}
|
|
13
|
+
cy.log('Running script');
|
|
14
|
+
var fullScript = scriptLines.join('\n');
|
|
15
|
+
return cy.window().then(function (win) {
|
|
16
|
+
var result = win.eval(fullScript);
|
|
17
|
+
return cy.wrap(result);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
/*----------------------------------------*/
|
|
22
|
+
/* --------------- Export --------------- */
|
|
23
|
+
/*----------------------------------------*/
|
|
24
|
+
exports.default = runScript;
|
|
25
|
+
//# sourceMappingURL=runScript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runScript.js","sourceRoot":"","sources":["../../src/commands/runScript.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAsBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,SAAS,GAAG;IAChB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,EAAE;QAAC,qBAAwB;aAAxB,UAAwB,EAAxB,qBAAwB,EAAxB,IAAwB;YAAxB,gCAAwB;;QACzD,EAAE,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QACzB,IAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1C,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,UAAC,GAAQ;YAC/B,IAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACpC,OAAO,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Type text into an element. This function first removes the previous text in the element
|
|
6
|
+
* @param opts object containing all arguments
|
|
7
|
+
* @param opts.item the CSS selector of interest
|
|
8
|
+
* @param opts.text the text to type
|
|
9
|
+
* @param opts.pressEnter if true, after typing into the text field, simulate pressing enter
|
|
10
|
+
* @example cy.typeInto({ item: '#username', text: 'john_doe', pressEnter: false })
|
|
11
|
+
*/
|
|
12
|
+
typeInto(opts: {
|
|
13
|
+
item: string;
|
|
14
|
+
text: string;
|
|
15
|
+
pressEnter?: boolean;
|
|
16
|
+
}): Chainable<Element>;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
declare const typeInto: () => void;
|
|
21
|
+
export default typeInto;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var typeInto = function () {
|
|
8
|
+
Cypress.Commands.add('typeInto', function (opts) {
|
|
9
|
+
var item = opts.item, text = opts.text, pressEnter = opts.pressEnter;
|
|
10
|
+
cy.log("Type \"".concat(text, "\" into ").concat(item));
|
|
11
|
+
// Check if the text contains an enter key press
|
|
12
|
+
var enterAtEndOfText = text.charAt(text.length - 1) === '\n';
|
|
13
|
+
// Type the text without a trailing enter if there was one
|
|
14
|
+
var textWithoutTrailingEnter = enterAtEndOfText
|
|
15
|
+
? text.substring(0, text.length - 1)
|
|
16
|
+
: text;
|
|
17
|
+
cy.get(item).clear().type(textWithoutTrailingEnter);
|
|
18
|
+
// Press enter if explicitly requested or if text ended with newline
|
|
19
|
+
if (pressEnter || enterAtEndOfText) {
|
|
20
|
+
cy.get(item).type('{enter}');
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
/*----------------------------------------*/
|
|
25
|
+
/* --------------- Export --------------- */
|
|
26
|
+
/*----------------------------------------*/
|
|
27
|
+
exports.default = typeInto;
|
|
28
|
+
//# sourceMappingURL=typeInto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typeInto.js","sourceRoot":"","sources":["../../src/commands/typeInto.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AA0BjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,QAAQ,GAAG;IACf,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,UAAC,IAA0D;QAClF,IAAA,IAAI,GAAuB,IAAI,KAA3B,EAAE,IAAI,GAAiB,IAAI,KAArB,EAAE,UAAU,GAAK,IAAI,WAAT,CAAU;QACxC,EAAE,CAAC,GAAG,CAAC,iBAAS,IAAI,qBAAU,IAAI,CAAE,CAAC,CAAC;QAEtC,gDAAgD;QAChD,IAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC;QAE/D,0DAA0D;QAC1D,IAAM,wBAAwB,GAAG,gBAAgB;YAC/C,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;YACpC,CAAC,CAAC,IAAI,CAAC;QAET,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAEpD,oEAAoE;QACpE,IAAI,UAAU,IAAI,gBAAgB,EAAE,CAAC;YACnC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,QAAQ,CAAC"}
|