dceky 1.0.5-beta.ky-declarations.13 → 1.0.6
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/README.md +45 -29
- package/lib/commands/assertDoesNotHaveClass.d.ts +18 -0
- package/lib/commands/assertDoesNotHaveClass.js +17 -0
- package/lib/commands/assertDoesNotHaveClass.js.map +1 -0
- package/lib/commands/assertHasClass.d.ts +18 -0
- package/lib/commands/assertHasClass.js +17 -0
- package/lib/commands/assertHasClass.js.map +1 -0
- package/lib/commands/assertNumElements.d.ts +18 -0
- package/lib/commands/assertNumElements.js +17 -0
- package/lib/commands/assertNumElements.js.map +1 -0
- package/lib/commands/clickWithRetry.d.ts +19 -0
- package/lib/commands/clickWithRetry.js +29 -0
- package/lib/commands/clickWithRetry.js.map +1 -0
- package/lib/commands/genTextOfLength.d.ts +20 -0
- package/lib/commands/genTextOfLength.js +20 -0
- package/lib/commands/genTextOfLength.js.map +1 -0
- package/lib/commands/getAttribute.d.ts +20 -0
- package/lib/commands/getAttribute.js +22 -0
- package/lib/commands/getAttribute.js.map +1 -0
- package/lib/commands/getClassName.d.ts +15 -0
- package/lib/commands/getClassName.js +21 -0
- package/lib/commands/getClassName.js.map +1 -0
- package/lib/commands/getCurrentDateInfo.d.ts +21 -0
- package/lib/commands/getCurrentDateInfo.js +25 -0
- package/lib/commands/getCurrentDateInfo.js.map +1 -0
- package/lib/commands/getId.d.ts +15 -0
- package/lib/commands/getId.js +21 -0
- package/lib/commands/getId.js.map +1 -0
- package/lib/commands/getNumElements.d.ts +14 -0
- package/lib/commands/getNumElements.js +19 -0
- package/lib/commands/getNumElements.js.map +1 -0
- package/lib/commands/getSpecialChars.d.ts +14 -0
- package/lib/commands/getSpecialChars.js +16 -0
- package/lib/commands/getSpecialChars.js.map +1 -0
- package/lib/commands/getTitle.d.ts +13 -0
- package/lib/commands/getTitle.js +20 -0
- package/lib/commands/getTitle.js.map +1 -0
- package/lib/commands/handleHarvardKey.d.ts +18 -0
- package/lib/commands/handleHarvardKey.js +56 -0
- package/lib/commands/handleHarvardKey.js.map +1 -0
- 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 +20 -0
- package/lib/commands/launchAs.js +60 -0
- package/lib/commands/launchAs.js.map +1 -0
- package/lib/commands/launchLTIUsingToken.d.ts +19 -0
- package/lib/commands/launchLTIUsingToken.js +74 -0
- package/lib/commands/launchLTIUsingToken.js.map +1 -0
- package/lib/commands/listSelectLabels.d.ts +15 -0
- package/lib/commands/listSelectLabels.js +24 -0
- package/lib/commands/listSelectLabels.js.map +1 -0
- package/lib/commands/listSelectValues.d.ts +15 -0
- package/lib/commands/listSelectValues.js +26 -0
- package/lib/commands/listSelectValues.js.map +1 -0
- package/lib/commands/navigateToHref.d.ts +19 -0
- package/lib/commands/navigateToHref.js +23 -0
- package/lib/commands/navigateToHref.js.map +1 -0
- package/lib/commands/padWithZeros.d.ts +20 -0
- package/lib/commands/padWithZeros.js +24 -0
- package/lib/commands/padWithZeros.js.map +1 -0
- package/lib/commands/runScript.d.ts +16 -0
- package/lib/commands/runScript.js +25 -0
- package/lib/commands/runScript.js.map +1 -0
- package/lib/commands/typeInto.d.ts +20 -0
- package/lib/commands/typeInto.js +28 -0
- package/lib/commands/typeInto.js.map +1 -0
- package/lib/commands/uniquify.d.ts +15 -0
- package/lib/commands/uniquify.js +25 -0
- package/lib/commands/uniquify.js.map +1 -0
- package/lib/commands/visitCanvasEndpoint.d.ts +27 -0
- package/lib/commands/visitCanvasEndpoint.js +35 -0
- package/lib/commands/visitCanvasEndpoint.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/waitForAtLeastOneElementPresent.d.ts +23 -0
- package/lib/commands/waitForAtLeastOneElementPresent.js +27 -0
- package/lib/commands/waitForAtLeastOneElementPresent.js.map +1 -0
- package/lib/commands/waitForElementVisible.d.ts +14 -0
- package/lib/commands/waitForElementVisible.js +20 -0
- package/lib/commands/waitForElementVisible.js.map +1 -0
- package/lib/index.js.map +1 -0
- package/lib/init.d.ts +6 -0
- package/lib/init.js +69 -0
- package/lib/init.js.map +1 -0
- package/lib/setup/checkRequiredFiles/index.js +7 -0
- package/lib/setup/checkRequiredFiles/index.js.map +1 -1
- package/lib/src/commands/extractDataFromClass.d.ts +7 -4
- package/lib/src/commands/extractDataFromClass.js +2 -1
- package/lib/src/commands/extractDataFromClass.js.map +1 -1
- package/lib/src/commands/extractDataFromClassByContents.d.ts +9 -5
- package/lib/src/commands/extractDataFromClassByContents.js +2 -1
- package/lib/src/commands/extractDataFromClassByContents.js.map +1 -1
- package/lib/src/commands/genTextOfLength.d.ts +20 -0
- package/lib/src/commands/genTextOfLength.js +20 -0
- package/lib/src/commands/genTextOfLength.js.map +1 -0
- package/lib/src/commands/getAttribute.d.ts +20 -0
- package/lib/src/commands/getAttribute.js +22 -0
- package/lib/src/commands/getAttribute.js.map +1 -0
- package/lib/src/commands/getClassName.d.ts +15 -0
- package/lib/src/commands/getClassName.js +21 -0
- package/lib/src/commands/getClassName.js.map +1 -0
- package/lib/src/commands/getCurrentDateInfo.d.ts +21 -0
- package/lib/src/commands/getCurrentDateInfo.js +25 -0
- package/lib/src/commands/getCurrentDateInfo.js.map +1 -0
- package/lib/src/commands/getId.d.ts +15 -0
- package/lib/src/commands/getId.js +21 -0
- package/lib/src/commands/getId.js.map +1 -0
- package/lib/src/commands/getJSON.d.ts +0 -1
- package/lib/src/commands/getJSON.js +1 -4
- package/lib/src/commands/getJSON.js.map +1 -1
- package/lib/src/commands/getSpecialChars.d.ts +14 -0
- package/lib/src/commands/getSpecialChars.js +16 -0
- package/lib/src/commands/getSpecialChars.js.map +1 -0
- package/lib/src/commands/getTitle.d.ts +13 -0
- package/lib/src/commands/getTitle.js +20 -0
- package/lib/src/commands/getTitle.js.map +1 -0
- package/lib/src/commands/index.js +29 -5
- package/lib/src/commands/index.js.map +1 -1
- package/lib/src/commands/launchLTIUsingToken.js +12 -4
- package/lib/src/commands/launchLTIUsingToken.js.map +1 -1
- package/lib/src/commands/listSelectLabels.d.ts +15 -0
- package/lib/src/commands/listSelectLabels.js +24 -0
- package/lib/src/commands/listSelectLabels.js.map +1 -0
- package/lib/src/commands/listSelectValues.d.ts +15 -0
- package/lib/src/commands/listSelectValues.js +27 -0
- package/lib/src/commands/listSelectValues.js.map +1 -0
- package/lib/src/commands/padWithZeros.d.ts +20 -0
- package/lib/src/commands/padWithZeros.js +24 -0
- package/lib/src/commands/padWithZeros.js.map +1 -0
- package/lib/src/commands/uniquify.d.ts +15 -0
- package/lib/src/commands/uniquify.js +26 -0
- package/lib/src/commands/uniquify.js.map +1 -0
- package/lib/src/commands/visitCanvasEndpoint.d.ts +26 -0
- package/lib/src/commands/visitCanvasEndpoint.js +36 -0
- package/lib/src/commands/visitCanvasEndpoint.js.map +1 -0
- package/lib/src/commands/waitForAtLeastOneElementPresent.d.ts +23 -0
- package/lib/src/commands/waitForAtLeastOneElementPresent.js +28 -0
- package/lib/src/commands/waitForAtLeastOneElementPresent.js.map +1 -0
- package/lib/src/genConfiguration/index.js +21 -3
- package/lib/src/genConfiguration/index.js.map +1 -1
- package/lib/src/init.js +28 -2
- package/lib/src/init.js.map +1 -1
- package/lib/start/constants/DEFAULT_THREADS_PER_COMBO.d.ts +6 -0
- package/lib/start/constants/DEFAULT_THREADS_PER_COMBO.js +9 -0
- package/lib/start/constants/DEFAULT_THREADS_PER_COMBO.js.map +1 -0
- package/lib/start/helpers/collectPngFiles.d.ts +9 -0
- package/lib/start/helpers/collectPngFiles.js +31 -0
- package/lib/start/helpers/collectPngFiles.js.map +1 -0
- package/lib/start/helpers/executeAllHeadlessCombinations.d.ts +15 -0
- package/lib/start/helpers/executeAllHeadlessCombinations.js +116 -0
- package/lib/start/helpers/executeAllHeadlessCombinations.js.map +1 -0
- package/lib/start/helpers/executeCypress.d.ts +17 -0
- package/lib/start/helpers/executeCypress.js +103 -0
- package/lib/start/helpers/executeCypress.js.map +1 -0
- package/lib/start/helpers/generateHtmlReport.d.ts +14 -0
- package/lib/start/helpers/generateHtmlReport.js +54 -0
- package/lib/start/helpers/generateHtmlReport.js.map +1 -0
- package/lib/start/helpers/generateReportHomepage.d.ts +9 -0
- package/lib/start/helpers/generateReportHomepage.js +142 -0
- package/lib/start/helpers/generateReportHomepage.js.map +1 -0
- package/lib/start/helpers/generateReporterConfig.d.ts +17 -0
- package/lib/start/helpers/generateReporterConfig.js +32 -0
- package/lib/start/helpers/generateReporterConfig.js.map +1 -0
- package/lib/start/helpers/getDateLabeledDir.d.ts +7 -0
- package/lib/start/helpers/getDateLabeledDir.js +38 -0
- package/lib/start/helpers/getDateLabeledDir.js.map +1 -0
- package/lib/start/helpers/mergeAllReportsAndGenerateHtml.d.ts +11 -0
- package/lib/start/helpers/mergeAllReportsAndGenerateHtml.js +121 -0
- package/lib/start/helpers/mergeAllReportsAndGenerateHtml.js.map +1 -0
- package/lib/start/helpers/mergeReports.d.ts +14 -0
- package/lib/start/helpers/mergeReports.js +63 -0
- package/lib/start/helpers/mergeReports.js.map +1 -0
- package/lib/start/helpers/reportHomepage.ejs +272 -0
- package/lib/start/helpers/runCypressHeadless.d.ts +18 -0
- package/lib/start/helpers/runCypressHeadless.js +138 -0
- package/lib/start/helpers/runCypressHeadless.js.map +1 -0
- package/lib/start/helpers/runCypressVisible.d.ts +8 -0
- package/lib/start/helpers/runCypressVisible.js +53 -0
- package/lib/start/helpers/runCypressVisible.js.map +1 -0
- package/lib/start/index.js +23 -5
- package/lib/start/index.js.map +1 -1
- package/lib/start/types/MochawesomeReporterConfig.d.ts +15 -0
- package/lib/start/types/MochawesomeReporterConfig.js +3 -0
- package/lib/start/types/MochawesomeReporterConfig.js.map +1 -0
- package/lib/start/types/Profile.d.ts +9 -0
- package/lib/start/types/Profile.js +3 -0
- package/lib/start/types/Profile.js.map +1 -0
- package/lib/start/types/ReportInfo.d.ts +14 -0
- package/lib/start/types/ReportInfo.js +3 -0
- package/lib/start/types/ReportInfo.js.map +1 -0
- package/lib/start/types/RunResult.d.ts +12 -0
- package/lib/start/types/RunResult.js +3 -0
- package/lib/start/types/RunResult.js.map +1 -0
- package/lib/start/types/ScreenshotInfo.d.ts +10 -0
- package/lib/start/types/ScreenshotInfo.js +3 -0
- package/lib/start/types/ScreenshotInfo.js.map +1 -0
- package/lib/start/types/TemplateReportInfo.d.ts +12 -0
- package/lib/start/types/TemplateReportInfo.js +3 -0
- package/lib/start/types/TemplateReportInfo.js.map +1 -0
- package/package.json +10 -8
- package/setup/checkRequiredFiles/index.ts +7 -0
- package/src/commands/extractDataFromClass.ts +17 -6
- package/src/commands/extractDataFromClassByContents.ts +21 -8
- package/src/commands/genTextOfLength.ts +54 -0
- package/src/commands/getAttribute.ts +58 -0
- package/src/commands/getClassName.ts +44 -0
- package/src/commands/getCurrentDateInfo.ts +57 -0
- package/src/commands/getId.ts +44 -0
- package/src/commands/getJSON.ts +0 -4
- package/src/commands/getSpecialChars.ts +34 -0
- package/src/commands/getTitle.ts +39 -0
- package/src/commands/index.ts +29 -5
- package/src/commands/launchLTIUsingToken.ts +12 -4
- package/src/commands/listSelectLabels.ts +47 -0
- package/src/commands/listSelectValues.ts +50 -0
- package/src/commands/padWithZeros.ts +53 -0
- package/src/commands/uniquify.ts +49 -0
- package/src/commands/visitCanvasEndpoint.ts +75 -0
- package/src/commands/waitForAtLeastOneElementPresent.ts +64 -0
- package/src/genConfiguration/index.ts +20 -2
- package/start/constants/DEFAULT_THREADS_PER_COMBO.ts +7 -0
- package/start/helpers/collectPngFiles.ts +25 -0
- package/start/helpers/executeAllHeadlessCombinations.ts +92 -0
- package/start/helpers/executeCypress.ts +66 -0
- package/start/helpers/generateHtmlReport.ts +71 -0
- package/start/helpers/generateReportHomepage.ts +148 -0
- package/start/helpers/generateReporterConfig.ts +39 -0
- package/start/helpers/getDateLabeledDir.ts +43 -0
- package/start/helpers/mergeAllReportsAndGenerateHtml.ts +150 -0
- package/start/helpers/mergeReports.ts +82 -0
- package/start/helpers/reportHomepage.ejs +272 -0
- package/start/helpers/runCypressHeadless.ts +164 -0
- package/start/helpers/runCypressVisible.ts +45 -0
- package/start/index.ts +23 -5
- package/start/types/MochawesomeReporterConfig.ts +23 -0
- package/start/types/Profile.ts +12 -0
- package/start/types/ReportInfo.ts +22 -0
- package/start/types/RunResult.ts +18 -0
- package/start/types/ScreenshotInfo.ts +13 -0
- package/start/types/TemplateReportInfo.ts +16 -0
- package/src/commands/visitCanvasGETEndpoint.ts +0 -61
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Handle a HarvardKey login page for a user
|
|
6
|
+
* @param opts object containing all arguments
|
|
7
|
+
* @param opts.url the URL to visit for HarvardKey authentication
|
|
8
|
+
* @param opts.name the name of the user environment variable
|
|
9
|
+
*/
|
|
10
|
+
handleHarvardKey(opts: {
|
|
11
|
+
url: string;
|
|
12
|
+
name: string;
|
|
13
|
+
}): Chainable<void>;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
declare const handleHarvardKey: () => void;
|
|
18
|
+
export default handleHarvardKey;
|
|
@@ -0,0 +1,56 @@
|
|
|
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 (opts) {
|
|
9
|
+
var url = opts.url, name = opts.name;
|
|
10
|
+
cy.log('Handling HarvardKey authentication');
|
|
11
|
+
var userInfo = Cypress.env(name);
|
|
12
|
+
if (userInfo == null) {
|
|
13
|
+
throw new Error("Could not find ".concat(name, " in environment variables"));
|
|
14
|
+
}
|
|
15
|
+
var username = userInfo.username;
|
|
16
|
+
var password = userInfo.password;
|
|
17
|
+
cy.visit(url);
|
|
18
|
+
// Get the Harvard login URL using originWithKaixa with auto-initialized functions
|
|
19
|
+
cy.origin('https://apps.cirrusidentity.com', function () {
|
|
20
|
+
Cypress.require('dceky');
|
|
21
|
+
return cy.navigateToHref({
|
|
22
|
+
item: '#idp_1001962798_button',
|
|
23
|
+
domain: 'https://apps.cirrusidentity.com'
|
|
24
|
+
});
|
|
25
|
+
}).then(function (fullUrl) {
|
|
26
|
+
// Navigate to the Harvard login page using originWithKaixa
|
|
27
|
+
cy.origin('https://harvard.idp.cirrusidentity.com', {
|
|
28
|
+
args: { username: username, password: password, fullUrl: fullUrl }
|
|
29
|
+
}, function (args) {
|
|
30
|
+
Cypress.require('dceky');
|
|
31
|
+
var username = args.username, password = args.password, fullUrl = args.fullUrl;
|
|
32
|
+
cy.on('uncaught:exception', function (e) {
|
|
33
|
+
// Ignore known HarvardKey errors
|
|
34
|
+
if (!e.message.includes('ready is not defined')) {
|
|
35
|
+
throw e;
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
});
|
|
39
|
+
cy.visit(fullUrl.toString());
|
|
40
|
+
// Wait for and fill in the login form using enhanced functions
|
|
41
|
+
cy.waitForElementVisible('#username');
|
|
42
|
+
cy.waitForElementVisible('#password');
|
|
43
|
+
// Add credentials using enhanced functions
|
|
44
|
+
cy.typeInto({ item: '#username', text: username });
|
|
45
|
+
cy.typeInto({ item: '#password', text: password });
|
|
46
|
+
// Submit the form using clickWithRetry
|
|
47
|
+
cy.clickWithRetry('input[type="submit"], button[type="submit"], .btn-primary');
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
/*----------------------------------------*/
|
|
53
|
+
/* --------------- Export --------------- */
|
|
54
|
+
/*----------------------------------------*/
|
|
55
|
+
exports.default = handleHarvardKey;
|
|
56
|
+
//# sourceMappingURL=handleHarvardKey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleHarvardKey.js","sourceRoot":"","sources":["../../src/commands/handleHarvardKey.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAyBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,gBAAgB,GAAG;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,kBAAkB,EAClB,UACE,IAGC;QAEK,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,GAAG,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,yBAAkB,IAAI,8BAA2B,CAAC,CAAC;QACrE,CAAC;QAED,IAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;QACnC,IAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC;QAEnC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAEd,kFAAkF;QAClF,EAAE,CAAC,MAAM,CAAC,iCAAiC,EAAE;YAC3C,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAEzB,OAAO,EAAE,CAAC,cAAc,CAAC;gBACtB,IAAI,EAAE,wBAAwB;gBAC9B,MAAM,EAAE,iCAAiC;aACzC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC,IAAI,CAAC,UAAC,OAAY;YACnB,2DAA2D;YAC3D,EAAE,CAAC,MAAM,CAAC,wCAAwC,EAAE;gBAClD,IAAI,EAAE,EAAE,QAAQ,UAAA,EAAE,QAAQ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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,iBAAiB,GAAG;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,mBAAmB,EAAE,UAAC,GAAW;QACpD,EAAE,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;QAEnE,6CAA6C;QAC7C,IAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QACjD,IAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAEjD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACtE,CAAC;QAED,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACtE,CAAC;QAED,EAAE,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC;QACpE,EAAE,CAAC,GAAG,CAAC,YAAY,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CA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C,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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
* @param name the name of the user environment variable
|
|
11
|
+
* @param opts object containing all arguments
|
|
12
|
+
* @param opts.courseId the Canvas ID of the course to launch from
|
|
13
|
+
* @param opts.appName the name of the app as it appears in the course's left-hand nav
|
|
14
|
+
*/
|
|
15
|
+
launchAs(name: string, courseId?: number, appName?: string): Chainable<void>;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
declare const launchAs: () => void;
|
|
20
|
+
export default launchAs;
|
|
@@ -0,0 +1,60 @@
|
|
|
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 default values from environment variables if not provided
|
|
12
|
+
if (!courseId) {
|
|
13
|
+
var envCourseId = Cypress.env('COURSE_ID');
|
|
14
|
+
if (!envCourseId) {
|
|
15
|
+
throw new Error('courseId parameter is required or COURSE_ID environment variable must be set');
|
|
16
|
+
}
|
|
17
|
+
courseId = Number.parseInt(envCourseId, 10);
|
|
18
|
+
}
|
|
19
|
+
if (!appName) {
|
|
20
|
+
appName = Cypress.env('APP_NAME');
|
|
21
|
+
if (!appName) {
|
|
22
|
+
throw new Error('appName parameter is required or APP_NAME environment variable must be set');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
// Check if this is a local launch
|
|
26
|
+
var isLocal = Cypress.env('LOCAL') === 'true';
|
|
27
|
+
if (isLocal) {
|
|
28
|
+
// Handle local simulator launch
|
|
29
|
+
var userType = Cypress.env("".concat(name, "_TYPE")) || 'teacher';
|
|
30
|
+
var simIndex = Cypress.env("".concat(name, "_SIM_INDEX")) || '0';
|
|
31
|
+
var simLaunchButtonId = "".concat(userType, "_").concat(simIndex, "-launch-button");
|
|
32
|
+
cy.log('Local mode: launching simulator');
|
|
33
|
+
cy.visit('https://localhost:8088/simulator');
|
|
34
|
+
// Handle potential SSL certificate issues
|
|
35
|
+
cy.get('body').then(function ($body) {
|
|
36
|
+
if ($body.find('.ssl').length > 0) {
|
|
37
|
+
cy.log('Handling SSL certificate issue');
|
|
38
|
+
cy.get('#details-button').click();
|
|
39
|
+
cy.get('#proceed-link').click();
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
// Launch the app
|
|
43
|
+
cy.get("#".concat(simLaunchButtonId)).click();
|
|
44
|
+
cy.get('.authorize-button', { timeout: 1000 }).click();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// Handle production launch with access token
|
|
48
|
+
var accessToken = Cypress.env("".concat(name, "_ACCESS_TOKEN"));
|
|
49
|
+
if (!accessToken) {
|
|
50
|
+
throw new Error("".concat(name, "_ACCESS_TOKEN environment variable is required for user \"").concat(name, "\""));
|
|
51
|
+
}
|
|
52
|
+
// Launch using the access token
|
|
53
|
+
cy.launchLTIUsingToken(accessToken, courseId, appName);
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
/*----------------------------------------*/
|
|
57
|
+
/* --------------- Export --------------- */
|
|
58
|
+
/*----------------------------------------*/
|
|
59
|
+
exports.default = launchAs;
|
|
60
|
+
//# sourceMappingURL=launchAs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launchAs.js","sourceRoot":"","sources":["../../src/commands/launchAs.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AA+BjC,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;QAEF,IAAA,QAAQ,GAAc,IAAI,SAAlB,EAAE,OAAO,GAAK,IAAI,QAAT,CAAU;QAEjC,gEAAgE;QAChE,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,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;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,CAAC,WAAI,iBAAiB,CAAE,CAAC,CAAC,KAAK,EAAE,CAAC;YAExC,EAAE,CAAC,GAAG,CAAC,mBAAmB,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;YAEvD,OAAO;QACT,CAAC;QAED,6CAA6C;QAC7C,IAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;QAEzC,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,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
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 opts object containing all arguments
|
|
8
|
+
* @param opts.courseId the Canvas ID of the course to launch from
|
|
9
|
+
* @param opts.appName the name of the app as it appears in the course's left-hand nav
|
|
10
|
+
*/
|
|
11
|
+
launchLTIUsingToken(accessToken: string, opts?: {
|
|
12
|
+
courseId?: number;
|
|
13
|
+
appName?: string;
|
|
14
|
+
}): Chainable<void>;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
declare const launchLTIUsingToken: () => void;
|
|
19
|
+
export default launchLTIUsingToken;
|
|
@@ -0,0 +1,74 @@
|
|
|
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 = parseInt(envCourseId, 10);
|
|
17
|
+
}
|
|
18
|
+
if (!appName) {
|
|
19
|
+
appName = Cypress.env('appName');
|
|
20
|
+
if (!appName) {
|
|
21
|
+
throw new Error('Could not find appName in environment variables');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
cy.log("Launch LTI app \"".concat(appName, "\" in course ").concat(courseId, " using access token"));
|
|
25
|
+
// Get the external tools for the course
|
|
26
|
+
cy.visitCanvasEndpoint({
|
|
27
|
+
method: 'GET',
|
|
28
|
+
path: "/courses/".concat(courseId, "/external_tools"),
|
|
29
|
+
accessToken: accessToken
|
|
30
|
+
}).then(function (externalTools) {
|
|
31
|
+
cy.log("Found ".concat(externalTools.length, " external tools"));
|
|
32
|
+
// Find the external tool of interest
|
|
33
|
+
var toolId = 0;
|
|
34
|
+
for (var _i = 0, externalTools_1 = externalTools; _i < externalTools_1.length; _i++) {
|
|
35
|
+
var externalTool = externalTools_1[_i];
|
|
36
|
+
// Skip non-nav items
|
|
37
|
+
if (!externalTool.course_navigation || typeof externalTool.course_navigation !== 'object') {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
// Skip non-labeled items
|
|
41
|
+
if (!externalTool.course_navigation.text) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
// Check if this app matches the name
|
|
45
|
+
var thisAppName = externalTool.course_navigation.text.trim().toLowerCase();
|
|
46
|
+
if (thisAppName === appName.trim().toLowerCase()) {
|
|
47
|
+
toolId = externalTool.id;
|
|
48
|
+
cy.log("Found matching app: \"".concat(externalTool.course_navigation.text, "\" with ID ").concat(toolId));
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Make sure we found the app
|
|
53
|
+
if (toolId === 0) {
|
|
54
|
+
throw new Error("Could not find any apps named \"".concat(appName, "\" in course ").concat(courseId));
|
|
55
|
+
}
|
|
56
|
+
// Get a sessionless launch URL
|
|
57
|
+
cy.visitCanvasEndpoint({
|
|
58
|
+
method: 'GET',
|
|
59
|
+
path: "/courses/".concat(courseId, "/external_tools/sessionless_launch?id=").concat(toolId),
|
|
60
|
+
accessToken: accessToken
|
|
61
|
+
}).then(function (sessionlessLaunchInfo) {
|
|
62
|
+
var launchURL = sessionlessLaunchInfo.url;
|
|
63
|
+
cy.log("Launching LTI app at: ".concat(launchURL));
|
|
64
|
+
// Launch the tool
|
|
65
|
+
cy.visit(launchURL);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
/*----------------------------------------*/
|
|
71
|
+
/* --------------- Export --------------- */
|
|
72
|
+
/*----------------------------------------*/
|
|
73
|
+
exports.default = launchLTIUsingToken;
|
|
74
|
+
//# sourceMappingURL=launchLTIUsingToken.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launchLTIUsingToken.js","sourceRoot":"","sources":["../../src/commands/launchLTIUsingToken.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AA6BjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,mBAAmB,GAAG;IAC1B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,qBAAqB,EACrB,UACE,WAAmB,EACnB,IAGM;QAHN,qBAAA,EAAA,SAGM;QAEF,IAAA,QAAQ,GAAc,IAAI,SAAlB,EAAE,OAAO,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;gBAED,0DAA0D;gBAC1D,IAAM,WAAW,GAAG,YAAY,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;gBAC7E,IAAI,WAAW,KAAK,OAAO,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;oBACjD,SAAS;gBACX,CAAC;gBAED,MAAM,GAAG,YAAY,CAAC,EAAE,CAAC;gBACzB,EAAE,CAAC,GAAG,CAAC,gCAAwB,YAAY,CAAC,iBAAiB,CAAC,IAAI,wBAAa,MAAM,CAAE,CAAC,CAAC;gBACzF,MAAM;YACR,CAAC;YAED,6BAA6B;YAC7B,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,0CAAkC,OAAO,0BAAe,QAAQ,CAAE,CAAC,CAAC;YACtF,CAAC;YAED,+BAA+B;YAC/B,EAAE,CAAC,mBAAmB,CAAC;gBACrB,MAAM,EAAE,KAAK;gBACb,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,15 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Get the labels of all the options within a select element
|
|
6
|
+
* @author Allison Zhang
|
|
7
|
+
* @param selector the CSS selector of the select element
|
|
8
|
+
* @returns an array of strings representing the labels of the options
|
|
9
|
+
*/
|
|
10
|
+
listSelectLabels(selector: string): Chainable<String[]>;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
declare const listSelectLabels: () => void;
|
|
15
|
+
export default listSelectLabels;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var listSelectLabels = function () {
|
|
8
|
+
Cypress.Commands.add('listSelectLabels', function (selector) {
|
|
9
|
+
var labels = [];
|
|
10
|
+
return (cy
|
|
11
|
+
.get(selector + ' option')
|
|
12
|
+
.each(function (option) {
|
|
13
|
+
labels.push(option.attr('label') || option.text());
|
|
14
|
+
})
|
|
15
|
+
.then(function () {
|
|
16
|
+
return labels;
|
|
17
|
+
}));
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
/*----------------------------------------*/
|
|
21
|
+
/* --------------- Export --------------- */
|
|
22
|
+
/*----------------------------------------*/
|
|
23
|
+
exports.default = listSelectLabels;
|
|
24
|
+
//# sourceMappingURL=listSelectLabels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listSelectLabels.js","sourceRoot":"","sources":["../../src/commands/listSelectLabels.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAsBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,gBAAgB,GAAG;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,kBAAkB,EAAE,UAAC,QAAgB;QACxD,IAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,OAAO,CACL,EAAE;aACC,GAAG,CAAC,QAAQ,GAAG,SAAS,CAAC;aACzB,IAAI,CAAC,UAAC,MAAM;YACX,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QACrD,CAAC,CAAC;aACD,IAAI,CAAC;YACJ,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CACL,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Get the values of all the options within a select element
|
|
6
|
+
* @author Allison Zhang
|
|
7
|
+
* @param selector the CSS selector of the select element
|
|
8
|
+
* @returns an array of strings representing the values of the options
|
|
9
|
+
*/
|
|
10
|
+
listSelectValues(selector: string): Chainable<String[]>;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
declare const listSelectValues: () => void;
|
|
15
|
+
export default listSelectValues;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var listSelectValues = function () {
|
|
8
|
+
Cypress.Commands.add('listSelectValues', function (selector) {
|
|
9
|
+
var vals = [];
|
|
10
|
+
return (cy
|
|
11
|
+
.get(selector + ' option')
|
|
12
|
+
.each(function (option) {
|
|
13
|
+
cy.wrap(option).invoke('attr', 'value').then(function (value) {
|
|
14
|
+
vals.push(value || option.text());
|
|
15
|
+
});
|
|
16
|
+
})
|
|
17
|
+
.then(function () {
|
|
18
|
+
return vals;
|
|
19
|
+
}));
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
/*----------------------------------------*/
|
|
23
|
+
/* --------------- Export --------------- */
|
|
24
|
+
/*----------------------------------------*/
|
|
25
|
+
exports.default = listSelectValues;
|
|
26
|
+
//# sourceMappingURL=listSelectValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listSelectValues.js","sourceRoot":"","sources":["../../src/commands/listSelectValues.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAsBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,gBAAgB,GAAG;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,kBAAkB,EAAE,UAAC,QAAgB;QACxD,IAAM,IAAI,GAAa,EAAE,CAAC;QAC1B,OAAO,CACL,EAAE;aACC,GAAG,CAAC,QAAQ,GAAG,SAAS,CAAC;aACzB,IAAI,CAAC,UAAC,MAAM;YACX,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,UAAC,KAAK;gBACjD,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YACpC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;aACD,IAAI,CAAC;YACJ,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CACL,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
*/
|
|
11
|
+
navigateToHref(opts: {
|
|
12
|
+
item: string;
|
|
13
|
+
domain: string;
|
|
14
|
+
}): Chainable<string>;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
declare const navigateToHref: () => void;
|
|
19
|
+
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;;AA0BjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,cAAc,GAAG;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,gBAAgB,EAChB,UACE,IAGC;QAEK,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,20 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
namespace Cypress {
|
|
3
|
+
interface Chainable {
|
|
4
|
+
/**
|
|
5
|
+
* Pads a number with leading zeros to a user-defined length.
|
|
6
|
+
* @author Allison Zhang
|
|
7
|
+
* @param opts options object
|
|
8
|
+
* @param opts.length the desired total length of the output string, must be larger than the length of the number
|
|
9
|
+
* @param opts.number the number to be padded with leading zeros
|
|
10
|
+
* @returns padded string with leading zeros
|
|
11
|
+
*/
|
|
12
|
+
padWithZeros(opts: {
|
|
13
|
+
length: number;
|
|
14
|
+
number: number;
|
|
15
|
+
}): Chainable<string>;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
declare const padWithZeros: () => void;
|
|
20
|
+
export default padWithZeros;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
/*----------------------------------------*/
|
|
5
|
+
/* --------------- Command -------------- */
|
|
6
|
+
/*----------------------------------------*/
|
|
7
|
+
var padWithZeros = function () {
|
|
8
|
+
Cypress.Commands.add('padWithZeros', function (opts) {
|
|
9
|
+
var length = opts.length, number = opts.number;
|
|
10
|
+
return (cy
|
|
11
|
+
.then(function () {
|
|
12
|
+
var numberString = number.toString();
|
|
13
|
+
while (numberString.length < length) {
|
|
14
|
+
numberString = '0' + numberString;
|
|
15
|
+
}
|
|
16
|
+
return numberString;
|
|
17
|
+
}));
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
/*----------------------------------------*/
|
|
21
|
+
/* --------------- Export --------------- */
|
|
22
|
+
/*----------------------------------------*/
|
|
23
|
+
exports.default = padWithZeros;
|
|
24
|
+
//# sourceMappingURL=padWithZeros.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"padWithZeros.js","sourceRoot":"","sources":["../../src/commands/padWithZeros.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAyBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,YAAY,GAAG;IACnB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,cAAc,EAAE,UAAC,IAAwC;QAE1E,IAAA,MAAM,GAEJ,IAAI,OAFA,EACN,MAAM,GACJ,IAAI,OADA,CACC;QACT,OAAO,CACL,EAAE;aACC,IAAI,CAAC;YACJ,IAAI,YAAY,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;YACrC,OAAO,YAAY,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;gBACpC,YAAY,GAAG,GAAG,GAAG,YAAY,CAAC;YACpC,CAAC;YACD,OAAO,YAAY,CAAC;QACtB,CAAC,CAAC,CACL,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
*/
|
|
11
|
+
runScript(...scriptLines: string[]): Chainable<any>;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
declare const runScript: () => void;
|
|
16
|
+
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;;AAqBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,SAAS,GAAG;IAChB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,WAAW,EACX;QACE,qBAAwB;aAAxB,UAAwB,EAAxB,qBAAwB,EAAxB,IAAwB;YAAxB,gCAAwB;;QAE1B,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"}
|