dceky 1.0.5-beta.ky-declarations.13 → 1.0.5
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/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/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/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/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,45 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import { spawn } from 'child_process';
|
|
3
|
+
|
|
4
|
+
// Import helpers
|
|
5
|
+
import getRootPath from './getRootPath';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Run Cypress in visible/interactive mode with a profile
|
|
9
|
+
* @author Yuen Ler Chow
|
|
10
|
+
* @param profileName - The profile name to use
|
|
11
|
+
* @returns Promise that resolves when Cypress closes
|
|
12
|
+
*/
|
|
13
|
+
const runCypressVisible = (profileName: string): Promise<void> => {
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
const root = getRootPath();
|
|
16
|
+
const env = {
|
|
17
|
+
...process.env,
|
|
18
|
+
CYPRESS_PROFILE: profileName,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
console.log(`\n🚀 Launching Cypress in interactive mode with profile: ${profileName}`);
|
|
22
|
+
console.log(` CYPRESS_PROFILE=${profileName}\n`);
|
|
23
|
+
|
|
24
|
+
const cypressProcess = spawn('npx', ['cypress', 'open'], {
|
|
25
|
+
cwd: root,
|
|
26
|
+
env,
|
|
27
|
+
stdio: 'inherit',
|
|
28
|
+
shell: true,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
cypressProcess.on('close', (code) => {
|
|
32
|
+
if (code === 0) {
|
|
33
|
+
resolve();
|
|
34
|
+
} else {
|
|
35
|
+
reject(new Error(`Cypress exited with code ${code}`));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
cypressProcess.on('error', (error) => {
|
|
40
|
+
reject(error);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default runCypressVisible;
|
package/start/index.ts
CHANGED
|
@@ -17,9 +17,11 @@ import findProfilesByNames from './helpers/findProfilesByNames';
|
|
|
17
17
|
import validateBrowsers from './helpers/validateBrowsers';
|
|
18
18
|
import extractArgValue from './helpers/extractArgValue';
|
|
19
19
|
import getRootPath from './helpers/getRootPath';
|
|
20
|
+
import executeCypress from './helpers/executeCypress';
|
|
20
21
|
|
|
21
22
|
// Import constants
|
|
22
23
|
import AVAILABLE_BROWSERS from './constants/AVAILABLE_BROWSERS';
|
|
24
|
+
import DEFAULT_THREADS_PER_COMBO from './constants/DEFAULT_THREADS_PER_COMBO';
|
|
23
25
|
|
|
24
26
|
// Get the project directory
|
|
25
27
|
const pwd = getRootPath();
|
|
@@ -86,6 +88,20 @@ const headlessFlagValue = extractArgValue(args, '--headless');
|
|
|
86
88
|
const hasHeadlessFlag = headlessFlagValue !== undefined;
|
|
87
89
|
isHeadless = !!(envHeadlessRaw && envHeadlessRaw.toLowerCase() !== 'false') || hasHeadlessFlag;
|
|
88
90
|
|
|
91
|
+
// Check for THREADS_PER_COMBO (env var or CLI arg)
|
|
92
|
+
const envThreadsRaw = process.env.THREADS_PER_COMBO;
|
|
93
|
+
const argThreadsRaw = extractArgValue(args, '--threadsPerCombo');
|
|
94
|
+
const threadsRaw = envThreadsRaw || argThreadsRaw;
|
|
95
|
+
let threadsPerCombo: number | undefined;
|
|
96
|
+
if (threadsRaw) {
|
|
97
|
+
const parsed = Number.parseInt(threadsRaw, 10);
|
|
98
|
+
if (!Number.isNaN(parsed) && parsed > 0) {
|
|
99
|
+
threadsPerCombo = parsed;
|
|
100
|
+
} else {
|
|
101
|
+
console.warn(`⚠️ Invalid THREADS_PER_COMBO value: "${threadsRaw}". Using default (${DEFAULT_THREADS_PER_COMBO}).`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
89
105
|
// If headless wasn't specified, ask the user to choose
|
|
90
106
|
if (!envHeadlessRaw && !hasHeadlessFlag) {
|
|
91
107
|
const choices = showChooser({
|
|
@@ -157,8 +173,10 @@ if (
|
|
|
157
173
|
selectedProfiles = choices.map((choice) => { return profiles[choice.index]; });
|
|
158
174
|
}
|
|
159
175
|
|
|
160
|
-
// Execute
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
176
|
+
// Execute Cypress with selected configuration
|
|
177
|
+
executeCypress({
|
|
178
|
+
selectedProfiles,
|
|
179
|
+
selectedBrowsers,
|
|
180
|
+
isHeadless,
|
|
181
|
+
threadsPerCombo,
|
|
182
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mochawesome reporter configuration
|
|
3
|
+
* @author Yuen Ler Chow
|
|
4
|
+
*/
|
|
5
|
+
type MochawesomeReporterConfig = {
|
|
6
|
+
// The reporter(s) to enable (e.g., "mochawesome")
|
|
7
|
+
reporterEnabled: string;
|
|
8
|
+
// Options for the mochawesome reporter
|
|
9
|
+
mochawesomeReporterOptions: {
|
|
10
|
+
// Directory where report files will be saved
|
|
11
|
+
reportDir: string;
|
|
12
|
+
// Filename pattern for report files (supports [name] placeholder)
|
|
13
|
+
reportFilename: string;
|
|
14
|
+
// Whether to overwrite existing report files
|
|
15
|
+
overwrite: boolean;
|
|
16
|
+
// Whether to generate HTML reports
|
|
17
|
+
html: boolean;
|
|
18
|
+
// Whether to generate JSON reports
|
|
19
|
+
json: boolean;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default MochawesomeReporterConfig;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profile configuration
|
|
3
|
+
* @author Yuen Ler Chow
|
|
4
|
+
*/
|
|
5
|
+
type Profile = {
|
|
6
|
+
// The filename of the profile (e.g., "prod.Profile.ts")
|
|
7
|
+
file: string;
|
|
8
|
+
// The name of the profile extracted from the filename (e.g., "prod")
|
|
9
|
+
profileName: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default Profile;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Information about a generated report
|
|
3
|
+
* @author Yuen Ler Chow
|
|
4
|
+
*/
|
|
5
|
+
type ReportInfo = {
|
|
6
|
+
// The name of the profile (e.g., "prod", "stage")
|
|
7
|
+
profileName: string;
|
|
8
|
+
// The browser used (e.g., "chrome", "edge")
|
|
9
|
+
browser: string;
|
|
10
|
+
// Path to the generated HTML report file
|
|
11
|
+
reportPath: string;
|
|
12
|
+
// True if the test run was successful
|
|
13
|
+
success: boolean;
|
|
14
|
+
// Human-readable timestamp of when the report was generated
|
|
15
|
+
timestamp: string;
|
|
16
|
+
// Total number of tests in the report
|
|
17
|
+
totalTests?: number;
|
|
18
|
+
// Number of tests that passed
|
|
19
|
+
passedTests?: number;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default ReportInfo;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result from a Cypress headless run
|
|
3
|
+
* @author Yuen Ler Chow
|
|
4
|
+
*/
|
|
5
|
+
type RunResult = {
|
|
6
|
+
// The name of the profile used for this run (e.g., "prod", "stage")
|
|
7
|
+
profileName: string;
|
|
8
|
+
// The browser used for this run (e.g., "chrome", "edge")
|
|
9
|
+
browser: string;
|
|
10
|
+
// Whether the test run completed successfully (all tests passed and report generated)
|
|
11
|
+
success: boolean;
|
|
12
|
+
// The output directory for this specific profile+browser combination
|
|
13
|
+
outputDir: string;
|
|
14
|
+
// Path to the generated HTML report file, undefined if report generation failed
|
|
15
|
+
reportPath?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default RunResult;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Information about a screenshot captured during a Cypress test run,
|
|
3
|
+
* used for linking screenshots in the report homepage
|
|
4
|
+
* @author Yuen Ler Chow
|
|
5
|
+
*/
|
|
6
|
+
type ScreenshotInfo = {
|
|
7
|
+
// Relative URL path to the screenshot file from the report homepage
|
|
8
|
+
href: string;
|
|
9
|
+
// Display name for the screenshot (typically the relative file path)
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default ScreenshotInfo;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import ReportInfo from './ReportInfo';
|
|
2
|
+
import ScreenshotInfo from './ScreenshotInfo';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Extended version of ReportInfo with additional computed fields
|
|
6
|
+
* needed for rendering the EJS report homepage template
|
|
7
|
+
* @author Yuen Ler Chow
|
|
8
|
+
*/
|
|
9
|
+
type TemplateReportInfo = ReportInfo & {
|
|
10
|
+
// Relative URL path to the HTML report file, or null if report doesn't exist
|
|
11
|
+
relativeReportPath: string | null;
|
|
12
|
+
// List of screenshots captured during this test run
|
|
13
|
+
screenshots: ScreenshotInfo[];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default TemplateReportInfo;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/// <reference types="cypress" />
|
|
2
|
-
|
|
3
|
-
/*----------------------------------------*/
|
|
4
|
-
/* ---------------- Type ---------------- */
|
|
5
|
-
/*----------------------------------------*/
|
|
6
|
-
|
|
7
|
-
declare global {
|
|
8
|
-
namespace Cypress {
|
|
9
|
-
interface Chainable {
|
|
10
|
-
/**
|
|
11
|
-
* Makes a GET request to Canvas API endpoint
|
|
12
|
-
* @author Yuen Ler Chow
|
|
13
|
-
* @param opts object containing all arguments
|
|
14
|
-
* @param opts.path The API path (e.g., '/courses', '/users/self')
|
|
15
|
-
* @param opts.accessToken The Canvas access token
|
|
16
|
-
* @return Cypress chainable containing the Canvas API response body
|
|
17
|
-
*/
|
|
18
|
-
visitCanvasGETEndpoint(
|
|
19
|
-
opts: {
|
|
20
|
-
path: string,
|
|
21
|
-
accessToken: string,
|
|
22
|
-
}
|
|
23
|
-
): Chainable<any>;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/*----------------------------------------*/
|
|
29
|
-
/* --------------- Command -------------- */
|
|
30
|
-
/*----------------------------------------*/
|
|
31
|
-
|
|
32
|
-
const visitCanvasGETEndpoint = () => {
|
|
33
|
-
Cypress.Commands.add(
|
|
34
|
-
'visitCanvasGETEndpoint',
|
|
35
|
-
(
|
|
36
|
-
opts: {
|
|
37
|
-
path: string,
|
|
38
|
-
accessToken: string,
|
|
39
|
-
},
|
|
40
|
-
) => {
|
|
41
|
-
cy.log('Visiting Canvas GET endpoint');
|
|
42
|
-
const { path, accessToken } = opts;
|
|
43
|
-
|
|
44
|
-
cy.log(`Canvas API: ${path}`);
|
|
45
|
-
return cy.request({
|
|
46
|
-
method: 'GET',
|
|
47
|
-
url: `https://canvas.harvard.edu/api/v1${path}`,
|
|
48
|
-
qs: {
|
|
49
|
-
per_page: 200,
|
|
50
|
-
access_token: accessToken,
|
|
51
|
-
},
|
|
52
|
-
}).its('body');
|
|
53
|
-
},
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/*----------------------------------------*/
|
|
58
|
-
/* --------------- Export --------------- */
|
|
59
|
-
/*----------------------------------------*/
|
|
60
|
-
|
|
61
|
-
export default visitCanvasGETEndpoint;
|