dceky 1.0.22 → 1.0.24
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/cypress/e2e/profile-test.cy.ts +1 -1
- package/lib/src/commands/handleHarvardKey.d.ts +1 -1
- package/lib/src/commands/handleHarvardKey.js +37 -35
- package/lib/src/commands/handleHarvardKey.js.map +1 -1
- package/lib/src/commands/index.js +6 -4
- package/lib/src/commands/index.js.map +1 -1
- package/lib/src/commands/launchAs.js +70 -68
- package/lib/src/commands/launchAs.js.map +1 -1
- package/lib/src/commands/logIntoPorta.d.ts +22 -0
- package/lib/src/commands/logIntoPorta.js +127 -0
- package/lib/src/commands/logIntoPorta.js.map +1 -0
- package/package.json +2 -2
- package/src/commands/handleHarvardKey.ts +41 -38
- package/src/commands/launchAs.ts +90 -88
- package/src/commands/logIntoPorta.ts +65 -61
- package/lib/commands/assertDoesNotHaveClass.d.ts +0 -18
- package/lib/commands/assertDoesNotHaveClass.js +0 -17
- package/lib/commands/assertDoesNotHaveClass.js.map +0 -1
- package/lib/commands/assertHasClass.d.ts +0 -18
- package/lib/commands/assertHasClass.js +0 -17
- package/lib/commands/assertHasClass.js.map +0 -1
- package/lib/commands/assertNumElements.d.ts +0 -18
- package/lib/commands/assertNumElements.js +0 -17
- package/lib/commands/assertNumElements.js.map +0 -1
- package/lib/commands/clickWithRetry.d.ts +0 -19
- package/lib/commands/clickWithRetry.js +0 -29
- package/lib/commands/clickWithRetry.js.map +0 -1
- package/lib/commands/genTextOfLength.d.ts +0 -20
- package/lib/commands/genTextOfLength.js +0 -20
- package/lib/commands/genTextOfLength.js.map +0 -1
- package/lib/commands/getAttribute.d.ts +0 -20
- package/lib/commands/getAttribute.js +0 -22
- package/lib/commands/getAttribute.js.map +0 -1
- package/lib/commands/getClassName.d.ts +0 -15
- package/lib/commands/getClassName.js +0 -21
- package/lib/commands/getClassName.js.map +0 -1
- package/lib/commands/getCurrentDateInfo.d.ts +0 -21
- package/lib/commands/getCurrentDateInfo.js +0 -25
- package/lib/commands/getCurrentDateInfo.js.map +0 -1
- package/lib/commands/getId.d.ts +0 -15
- package/lib/commands/getId.js +0 -21
- package/lib/commands/getId.js.map +0 -1
- package/lib/commands/getNumElements.d.ts +0 -14
- package/lib/commands/getNumElements.js +0 -19
- package/lib/commands/getNumElements.js.map +0 -1
- package/lib/commands/getSpecialChars.d.ts +0 -14
- package/lib/commands/getSpecialChars.js +0 -16
- package/lib/commands/getSpecialChars.js.map +0 -1
- package/lib/commands/getTitle.d.ts +0 -13
- package/lib/commands/getTitle.js +0 -20
- package/lib/commands/getTitle.js.map +0 -1
- package/lib/commands/handleHarvardKey.d.ts +0 -18
- package/lib/commands/handleHarvardKey.js +0 -56
- package/lib/commands/handleHarvardKey.js.map +0 -1
- package/lib/commands/handleHarvardKey2.d.ts +0 -14
- package/lib/commands/handleHarvardKey2.js +0 -88
- package/lib/commands/handleHarvardKey2.js.map +0 -1
- package/lib/commands/launchAs.d.ts +0 -20
- package/lib/commands/launchAs.js +0 -60
- package/lib/commands/launchAs.js.map +0 -1
- package/lib/commands/launchLTIUsingToken.d.ts +0 -19
- package/lib/commands/launchLTIUsingToken.js +0 -74
- package/lib/commands/launchLTIUsingToken.js.map +0 -1
- package/lib/commands/listSelectLabels.d.ts +0 -15
- package/lib/commands/listSelectLabels.js +0 -24
- package/lib/commands/listSelectLabels.js.map +0 -1
- package/lib/commands/listSelectValues.d.ts +0 -15
- package/lib/commands/listSelectValues.js +0 -26
- package/lib/commands/listSelectValues.js.map +0 -1
- package/lib/commands/navigateToHref.d.ts +0 -19
- package/lib/commands/navigateToHref.js +0 -23
- package/lib/commands/navigateToHref.js.map +0 -1
- package/lib/commands/padWithZeros.d.ts +0 -20
- package/lib/commands/padWithZeros.js +0 -24
- package/lib/commands/padWithZeros.js.map +0 -1
- package/lib/commands/runScript.d.ts +0 -16
- package/lib/commands/runScript.js +0 -25
- package/lib/commands/runScript.js.map +0 -1
- package/lib/commands/typeInto.d.ts +0 -20
- package/lib/commands/typeInto.js +0 -28
- package/lib/commands/typeInto.js.map +0 -1
- package/lib/commands/uniquify.d.ts +0 -15
- package/lib/commands/uniquify.js +0 -25
- package/lib/commands/uniquify.js.map +0 -1
- package/lib/commands/visitCanvasEndpoint.d.ts +0 -27
- package/lib/commands/visitCanvasEndpoint.js +0 -35
- package/lib/commands/visitCanvasEndpoint.js.map +0 -1
- package/lib/commands/visitCanvasGETEndpoint.d.ts +0 -20
- package/lib/commands/visitCanvasGETEndpoint.js +0 -26
- package/lib/commands/visitCanvasGETEndpoint.js.map +0 -1
- package/lib/commands/waitForAtLeastOneElementPresent.d.ts +0 -23
- package/lib/commands/waitForAtLeastOneElementPresent.js +0 -27
- package/lib/commands/waitForAtLeastOneElementPresent.js.map +0 -1
- package/lib/commands/waitForElementVisible.d.ts +0 -14
- package/lib/commands/waitForElementVisible.js +0 -20
- package/lib/commands/waitForElementVisible.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/init.d.ts +0 -6
- package/lib/init.js +0 -69
- package/lib/init.js.map +0 -1
- package/lib/postinstall/helpers/exec.d.ts +0 -8
- package/lib/postinstall/helpers/exec.js +0 -18
- package/lib/postinstall/helpers/exec.js.map +0 -1
- package/lib/setup/checkRequiredFiles.d.ts +0 -6
- package/lib/setup/checkRequiredFiles.js +0 -60
- package/lib/setup/checkRequiredFiles.js.map +0 -1
- package/lib/setup/genEmptyGlobalFile.d.ts +0 -7
- package/lib/setup/genEmptyGlobalFile.js +0 -41
- package/lib/setup/genEmptyGlobalFile.js.map +0 -1
- package/lib/src/commands/launchLTIUsingToken.d.ts +0 -21
- package/lib/src/commands/launchLTIUsingToken.js +0 -76
- package/lib/src/commands/launchLTIUsingToken.js.map +0 -1
- package/lib/src/commands/visitCanvasGETEndpoint.d.ts +0 -20
- package/lib/src/commands/visitCanvasGETEndpoint.js +0 -26
- package/lib/src/commands/visitCanvasGETEndpoint.js.map +0 -1
- package/lib/src/init.d.ts +0 -6
- package/lib/src/init.js +0 -71
- package/lib/src/init.js.map +0 -1
- package/lib/src/node.d.ts +0 -2
- package/lib/src/node.js +0 -10
- package/lib/src/node.js.map +0 -1
package/src/commands/launchAs.ts
CHANGED
|
@@ -58,7 +58,7 @@ const launchAs = () => {
|
|
|
58
58
|
|
|
59
59
|
// Get courseId from environment variables if not provided
|
|
60
60
|
if (!courseId) {
|
|
61
|
-
const envCourseId = Cypress.
|
|
61
|
+
const envCourseId = Cypress.expose('courseId');
|
|
62
62
|
if (!envCourseId) {
|
|
63
63
|
throw new Error('Could not find courseId in environment variables');
|
|
64
64
|
}
|
|
@@ -66,102 +66,104 @@ const launchAs = () => {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
// Get appName from environment variables if not provided
|
|
69
|
-
appName = appName || Cypress.
|
|
69
|
+
appName = appName || Cypress.expose('appName');
|
|
70
70
|
if (!appName) {
|
|
71
71
|
throw new Error('Could not find appName in environment variables');
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// Get user accessToken from environment variables
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
// List external tools in the course
|
|
85
|
-
return (
|
|
86
|
-
cy
|
|
87
|
-
.request({
|
|
88
|
-
method: 'GET',
|
|
89
|
-
url: `https://canvas.harvard.edu/api/v1/courses/${courseId}/external_tools`,
|
|
90
|
-
body: {
|
|
91
|
-
per_page: 200,
|
|
92
|
-
access_token: accessToken,
|
|
93
|
-
},
|
|
94
|
-
})
|
|
95
|
-
.then((response) => {
|
|
96
|
-
// Extract tools from the body
|
|
97
|
-
const externalTools = response.body;
|
|
98
|
-
|
|
99
|
-
// Find the external tool of interest
|
|
100
|
-
const matchingTool = externalTools.find((externalTool: any) => {
|
|
101
|
-
// Skip non-nav items
|
|
102
|
-
if (
|
|
103
|
-
// No nav
|
|
104
|
-
!externalTool.course_navigation
|
|
105
|
-
// No nav information
|
|
106
|
-
|| typeof externalTool.course_navigation !== 'object'
|
|
107
|
-
) {
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
75
|
+
cy.env([name]).then((environment) => {
|
|
76
|
+
const userInfo = environment[name];
|
|
77
|
+
if (!userInfo) {
|
|
78
|
+
throw new Error(`Could not find ${name} in environment variables`);
|
|
79
|
+
}
|
|
80
|
+
const { accessToken } = userInfo;
|
|
81
|
+
if (!accessToken) {
|
|
82
|
+
throw new Error(`Could not find accessToken for ${name} in environment variables`);
|
|
83
|
+
}
|
|
110
84
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
85
|
+
// List external tools in the course
|
|
86
|
+
return (
|
|
87
|
+
cy
|
|
88
|
+
.request({
|
|
89
|
+
method: 'GET',
|
|
90
|
+
url: `https://canvas.harvard.edu/api/v1/courses/${courseId}/external_tools`,
|
|
91
|
+
body: {
|
|
92
|
+
per_page: 200,
|
|
93
|
+
access_token: accessToken,
|
|
94
|
+
},
|
|
95
|
+
})
|
|
96
|
+
.then((response) => {
|
|
97
|
+
// Extract tools from the body
|
|
98
|
+
const externalTools = response.body;
|
|
99
|
+
|
|
100
|
+
// Find the external tool of interest
|
|
101
|
+
const matchingTool = externalTools.find((externalTool: any) => {
|
|
102
|
+
// Skip non-nav items
|
|
103
|
+
if (
|
|
104
|
+
// No nav
|
|
105
|
+
!externalTool.course_navigation
|
|
106
|
+
// No nav information
|
|
107
|
+
|| typeof externalTool.course_navigation !== 'object'
|
|
108
|
+
) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Skip non-labeled items
|
|
113
|
+
if (!externalTool.course_navigation.text) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Skip if the app name does not match the expected name
|
|
118
|
+
const thisAppName = (
|
|
119
|
+
externalTool
|
|
120
|
+
.course_navigation
|
|
121
|
+
.text
|
|
122
|
+
.trim()
|
|
123
|
+
.toLowerCase()
|
|
124
|
+
);
|
|
125
|
+
return thisAppName === appName.trim().toLowerCase();
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// Make sure we found the app
|
|
129
|
+
if (!matchingTool) {
|
|
130
|
+
throw new Error(`Could not find any apps named "${appName}" in course ${courseId}`);
|
|
114
131
|
}
|
|
115
132
|
|
|
116
|
-
//
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
133
|
+
// Get the toolId for the matching tool
|
|
134
|
+
const toolId = matchingTool?.id || 0;
|
|
135
|
+
return cy.wrap(toolId);
|
|
136
|
+
})
|
|
137
|
+
.then((toolId) => {
|
|
138
|
+
// Request sessionless launch URL
|
|
139
|
+
return (
|
|
140
|
+
cy
|
|
141
|
+
.request({
|
|
142
|
+
method: 'GET',
|
|
143
|
+
url: `https://canvas.harvard.edu/api/v1/courses/${courseId}/external_tools/sessionless_launch?id=${toolId}`,
|
|
144
|
+
body: {
|
|
145
|
+
per_page: 200,
|
|
146
|
+
access_token: accessToken,
|
|
147
|
+
},
|
|
148
|
+
})
|
|
149
|
+
.its('body')
|
|
123
150
|
);
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
.request({
|
|
141
|
-
method: 'GET',
|
|
142
|
-
url: `https://canvas.harvard.edu/api/v1/courses/${courseId}/external_tools/sessionless_launch?id=${toolId}`,
|
|
143
|
-
body: {
|
|
144
|
-
per_page: 200,
|
|
145
|
-
access_token: accessToken,
|
|
146
|
-
},
|
|
147
|
-
})
|
|
148
|
-
.its('body')
|
|
149
|
-
);
|
|
150
|
-
})
|
|
151
|
-
.then((sessionlessLaunchInfo) => {
|
|
152
|
-
cy.on('uncaught:exception', (e: Error) => {
|
|
153
|
-
// Ignore known LTI launch errors
|
|
154
|
-
if (!e.message.includes('postMessage')) {
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
return false;
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
// Launch via the sessionless launch URL
|
|
161
|
-
const launchURL = sessionlessLaunchInfo.url;
|
|
162
|
-
cy.visit(launchURL);
|
|
163
|
-
})
|
|
164
|
-
);
|
|
151
|
+
})
|
|
152
|
+
.then((sessionlessLaunchInfo) => {
|
|
153
|
+
cy.on('uncaught:exception', (e: Error) => {
|
|
154
|
+
// Ignore known LTI launch errors
|
|
155
|
+
if (!e.message.includes('postMessage')) {
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
return false;
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
// Launch via the sessionless launch URL
|
|
162
|
+
const launchURL = sessionlessLaunchInfo.url;
|
|
163
|
+
cy.visit(launchURL);
|
|
164
|
+
})
|
|
165
|
+
);
|
|
166
|
+
});
|
|
165
167
|
},
|
|
166
168
|
);
|
|
167
169
|
};
|
|
@@ -20,7 +20,7 @@ declare global {
|
|
|
20
20
|
* @param name the name of the user environment variable
|
|
21
21
|
* @return Cypress chainable (void) - performs authentication flow, no return value
|
|
22
22
|
*/
|
|
23
|
-
|
|
23
|
+
logIntoPorta(
|
|
24
24
|
name: string,
|
|
25
25
|
): Chainable<void>;
|
|
26
26
|
}
|
|
@@ -65,92 +65,96 @@ const getFormData = (html: string, formSelector = 'form') => {
|
|
|
65
65
|
/* --------------- Command -------------- */
|
|
66
66
|
/*----------------------------------------*/
|
|
67
67
|
|
|
68
|
-
const
|
|
68
|
+
const logIntoPorta = () => {
|
|
69
69
|
Cypress.Commands.add(
|
|
70
|
-
'
|
|
70
|
+
'logIntoPorta',
|
|
71
71
|
(
|
|
72
72
|
name: string,
|
|
73
73
|
) => {
|
|
74
74
|
cy.log('🔓 Handling HarvardKey authentication via API');
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
// Request 1: GET Cirrus Identity discovery page
|
|
90
|
-
cy.request({
|
|
91
|
-
url: LOGIN_PAGE,
|
|
92
|
-
followRedirect: true,
|
|
93
|
-
failOnStatusCode: false,
|
|
94
|
-
headers: htmlHeaders,
|
|
95
|
-
}).then((discoveryRes) => {
|
|
96
|
-
// Parse discovery page for HarvardKey IdP button href
|
|
97
|
-
const btnMatch = discoveryRes.body.match(
|
|
98
|
-
new RegExp(`href=["']([^"']+)["'][^>]*id=["']${HARVARDKEY_IDP_BUTTON_ID}["']`),
|
|
99
|
-
);
|
|
100
|
-
if (!btnMatch) {
|
|
101
|
-
throw new Error('Could not find HarvardKey IdP button link on discovery page');
|
|
76
|
+
// Get user credentials from environment variables
|
|
77
|
+
cy.env([name]).then((environment) => {
|
|
78
|
+
const userInfo = environment[name];
|
|
79
|
+
|
|
80
|
+
if (!userInfo) {
|
|
81
|
+
throw new Error(`Could not find ${name} in environment variables`);
|
|
82
|
+
}
|
|
83
|
+
const { username, password } = userInfo;
|
|
84
|
+
|
|
85
|
+
// Check if username and password are set
|
|
86
|
+
if (!username || !password) {
|
|
87
|
+
throw new Error(`Credential "${name}" is missing username and/or password`);
|
|
102
88
|
}
|
|
103
89
|
|
|
104
|
-
const
|
|
90
|
+
const htmlHeaders = { accept: 'text/html' };
|
|
105
91
|
|
|
106
|
-
// Request
|
|
92
|
+
// Request 1: GET Cirrus Identity discovery page
|
|
107
93
|
cy.request({
|
|
108
|
-
url:
|
|
94
|
+
url: LOGIN_PAGE,
|
|
109
95
|
followRedirect: true,
|
|
110
96
|
failOnStatusCode: false,
|
|
111
97
|
headers: htmlHeaders,
|
|
112
|
-
}).then((
|
|
113
|
-
// Parse
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
throw new Error('Could not find login form action on HarvardKey page');
|
|
98
|
+
}).then((discoveryRes) => {
|
|
99
|
+
// Parse discovery page for HarvardKey IdP button href
|
|
100
|
+
const btnMatch = discoveryRes.body.match(
|
|
101
|
+
new RegExp(`href=["']([^"']+)["'][^>]*id=["']${HARVARDKEY_IDP_BUTTON_ID}["']`),
|
|
102
|
+
);
|
|
103
|
+
if (!btnMatch) {
|
|
104
|
+
throw new Error('Could not find HarvardKey IdP button link on discovery page');
|
|
120
105
|
}
|
|
121
106
|
|
|
122
|
-
|
|
107
|
+
const idpUrl = `${IDP_BASE_URL}${btnMatch[1]}`;
|
|
108
|
+
|
|
109
|
+
// Request 2: GET HarvardKey IdP login page
|
|
123
110
|
cy.request({
|
|
124
|
-
|
|
125
|
-
url: loginFormUrl,
|
|
126
|
-
form: true,
|
|
111
|
+
url: idpUrl,
|
|
127
112
|
followRedirect: true,
|
|
128
113
|
failOnStatusCode: false,
|
|
129
114
|
headers: htmlHeaders,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
username,
|
|
133
|
-
password,
|
|
134
|
-
},
|
|
135
|
-
}).then((authRes) => {
|
|
136
|
-
// Parse SAML form from login response
|
|
115
|
+
}).then((loginPageRes) => {
|
|
116
|
+
// Parse login form action and hidden fields
|
|
137
117
|
const {
|
|
138
|
-
action:
|
|
139
|
-
fields:
|
|
140
|
-
} = getFormData(
|
|
141
|
-
if (!
|
|
142
|
-
throw new Error('Could not find
|
|
118
|
+
action: loginFormUrl,
|
|
119
|
+
fields: loginHiddenFields,
|
|
120
|
+
} = getFormData(loginPageRes.body);
|
|
121
|
+
if (!loginFormUrl) {
|
|
122
|
+
throw new Error('Could not find login form action on HarvardKey page');
|
|
143
123
|
}
|
|
144
124
|
|
|
145
|
-
// Request
|
|
146
|
-
|
|
125
|
+
// Request 3: POST credentials to HarvardKey login form
|
|
126
|
+
cy.request({
|
|
147
127
|
method: 'POST',
|
|
148
|
-
url:
|
|
128
|
+
url: loginFormUrl,
|
|
149
129
|
form: true,
|
|
150
130
|
followRedirect: true,
|
|
151
131
|
failOnStatusCode: false,
|
|
152
132
|
headers: htmlHeaders,
|
|
153
|
-
body:
|
|
133
|
+
body: {
|
|
134
|
+
...loginHiddenFields,
|
|
135
|
+
username,
|
|
136
|
+
password,
|
|
137
|
+
},
|
|
138
|
+
}).then((authRes) => {
|
|
139
|
+
// Parse SAML form from login response
|
|
140
|
+
const {
|
|
141
|
+
action: samlFormUrl,
|
|
142
|
+
fields: samlHiddenFields,
|
|
143
|
+
} = getFormData(authRes.body, 'form[action*="saml2-acs"]');
|
|
144
|
+
if (!samlFormUrl) {
|
|
145
|
+
throw new Error('Could not find SAML form in login response');
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Request 4: POST SAML assertion to ACS
|
|
149
|
+
return cy.request({
|
|
150
|
+
method: 'POST',
|
|
151
|
+
url: samlFormUrl,
|
|
152
|
+
form: true,
|
|
153
|
+
followRedirect: true,
|
|
154
|
+
failOnStatusCode: false,
|
|
155
|
+
headers: htmlHeaders,
|
|
156
|
+
body: samlHiddenFields,
|
|
157
|
+
});
|
|
154
158
|
});
|
|
155
159
|
});
|
|
156
160
|
});
|
|
@@ -163,4 +167,4 @@ const loginToPorta = () => {
|
|
|
163
167
|
/* --------------- Export --------------- */
|
|
164
168
|
/*----------------------------------------*/
|
|
165
169
|
|
|
166
|
-
export default
|
|
170
|
+
export default logIntoPorta;
|
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
*/
|
|
10
|
-
assertDoesNotHaveClass(opts: {
|
|
11
|
-
item: string;
|
|
12
|
-
className: string;
|
|
13
|
-
}): Chainable<JQuery<HTMLElement>>;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
declare const assertDoesNotHaveClass: () => void;
|
|
18
|
-
export default assertDoesNotHaveClass;
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assertDoesNotHaveClass.js","sourceRoot":"","sources":["../../src/commands/assertDoesNotHaveClass.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAuBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,sBAAsB,GAAG;IAC7B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,wBAAwB,EACxB,UACE,IAGC;QAEH,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"}
|
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
*/
|
|
10
|
-
assertHasClass(opts: {
|
|
11
|
-
item: string;
|
|
12
|
-
className: string;
|
|
13
|
-
}): Chainable<JQuery<HTMLElement>>;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
declare const assertHasClass: () => void;
|
|
18
|
-
export default assertHasClass;
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assertHasClass.js","sourceRoot":"","sources":["../../src/commands/assertHasClass.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAuBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,cAAc,GAAG;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,gBAAgB,EAChB,UACE,IAGC;QAEH,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"}
|
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
*/
|
|
10
|
-
assertNumElements(opts: {
|
|
11
|
-
item: string;
|
|
12
|
-
num: number;
|
|
13
|
-
}): Chainable<Element>;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
declare const assertNumElements: () => void;
|
|
18
|
-
export default assertNumElements;
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assertNumElements.js","sourceRoot":"","sources":["../../src/commands/assertNumElements.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAyBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,iBAAiB,GAAG;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,mBAAmB,EACnB,UACE,IAGC;QAEH,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"}
|
|
@@ -1,19 +0,0 @@
|
|
|
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 opts object containing all arguments
|
|
8
|
-
* @param opts.timeoutSec the number of seconds to wait before timing out (default: 10)
|
|
9
|
-
* @param opts.dontScrollTo if true, do not scroll to the element (default: false)
|
|
10
|
-
*/
|
|
11
|
-
clickWithRetry(item: string, opts?: {
|
|
12
|
-
timeoutSec?: number;
|
|
13
|
-
dontScrollTo?: boolean;
|
|
14
|
-
}): Chainable<JQuery<HTMLElement>>;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
declare const clickWithRetry: () => void;
|
|
19
|
-
export default clickWithRetry;
|
|
@@ -1,29 +0,0 @@
|
|
|
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, opts) {
|
|
9
|
-
if (opts === void 0) { opts = {}; }
|
|
10
|
-
var timeoutSec = opts.timeoutSec, dontScrollTo = opts.dontScrollTo;
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clickWithRetry.js","sourceRoot":"","sources":["../../src/commands/clickWithRetry.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AA2BjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,cAAc,GAAG;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAClB,gBAAgB,EAChB,UACE,IAAY,EACZ,IAGM;QAHN,qBAAA,EAAA,SAGM;QAEA,IAAA,UAAU,GAAmB,IAAI,WAAvB,EAAE,YAAY,GAAK,IAAI,aAAT,CAAU;QAE1C,EAAE,CAAC,GAAG,CAAC,gBAAS,IAAI,CAAE,CAAC,CAAC;QAExB,8DAA8D;QAC9D,EAAE,CAAC,qBAAqB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAE3C,kDAAkD;QAClD,IAAI,YAAY,EAAE,CAAC;YACjB,OAAO,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;QAC9B,CAAC;aAAM,CAAC;YACN,0DAA0D;YAC1D,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;YAC9B,OAAO,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,cAAc,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
namespace Cypress {
|
|
3
|
-
interface Chainable {
|
|
4
|
-
/**
|
|
5
|
-
* Generate a string of specified length for Cypress tests
|
|
6
|
-
* @author Gardenia Liu, Allison Zhang
|
|
7
|
-
* @param opts options object
|
|
8
|
-
* @param opts.length the desired length of the string
|
|
9
|
-
* @param opts.text optional text to repeat to form the string; defaults to '123456789x' if not provided
|
|
10
|
-
* @returns a string of the specified length, if the length is not a multiple of the text length, it is truncated
|
|
11
|
-
*/
|
|
12
|
-
genTextOfLength(opts: {
|
|
13
|
-
length: number;
|
|
14
|
-
text?: string;
|
|
15
|
-
}): Chainable<string>;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
declare const genTextOfLength: () => void;
|
|
20
|
-
export default genTextOfLength;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/// <reference types="cypress" />
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
/*----------------------------------------*/
|
|
5
|
-
/* --------------- Command -------------- */
|
|
6
|
-
/*----------------------------------------*/
|
|
7
|
-
var genTextOfLength = function () {
|
|
8
|
-
Cypress.Commands.add('genTextOfLength', function (opts) {
|
|
9
|
-
var length = opts.length, text = opts.text;
|
|
10
|
-
var textToUse = text || '123456789x';
|
|
11
|
-
var lengthOfTextToUse = Math.ceil(length / textToUse.length);
|
|
12
|
-
var result = textToUse.repeat(lengthOfTextToUse).substring(0, length);
|
|
13
|
-
return cy.wrap(result);
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
/*----------------------------------------*/
|
|
17
|
-
/* --------------- Export --------------- */
|
|
18
|
-
/*----------------------------------------*/
|
|
19
|
-
exports.default = genTextOfLength;
|
|
20
|
-
//# sourceMappingURL=genTextOfLength.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"genTextOfLength.js","sourceRoot":"","sources":["../../src/commands/genTextOfLength.ts"],"names":[],"mappings":";AAAA,iCAAiC;;AAyBjC,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,IAAM,eAAe,GAAG;IACtB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,iBAAiB,EAAE,UAAC,IAAuC;QAE5E,IAAA,MAAM,GAEJ,IAAI,OAFA,EACN,IAAI,GACF,IAAI,KADF,CACG;QACT,IAAM,SAAS,GAAG,IAAI,IAAI,YAAY,CAAC;QACvC,IAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;QAC/D,IAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QACxE,OAAO,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC,CAAA;AAED,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,eAAe,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
namespace Cypress {
|
|
3
|
-
interface Chainable {
|
|
4
|
-
/**
|
|
5
|
-
* Get the attribute of an element
|
|
6
|
-
* @author Allison Zhang
|
|
7
|
-
* @param opts options object
|
|
8
|
-
* @param opts.selector the CSS selector of the element
|
|
9
|
-
* @param opts.attribute the attribute to retrieve
|
|
10
|
-
* @returns the attribute of the element
|
|
11
|
-
*/
|
|
12
|
-
getAttribute(opts: {
|
|
13
|
-
selector: string;
|
|
14
|
-
attribute: string;
|
|
15
|
-
}): Chainable<string>;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
declare const getAttribute: () => void;
|
|
20
|
-
export default getAttribute;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/// <reference types="cypress" />
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
/*----------------------------------------*/
|
|
5
|
-
/* --------------- Command -------------- */
|
|
6
|
-
/*----------------------------------------*/
|
|
7
|
-
var getAttribute = function () {
|
|
8
|
-
Cypress.Commands.add('getAttribute', function (opts) {
|
|
9
|
-
var selector = opts.selector, attribute = opts.attribute;
|
|
10
|
-
return (cy
|
|
11
|
-
.get(selector)
|
|
12
|
-
.invoke('attr', attribute)
|
|
13
|
-
.then(function (attr) {
|
|
14
|
-
return attr;
|
|
15
|
-
}));
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
/*----------------------------------------*/
|
|
19
|
-
/* --------------- Export --------------- */
|
|
20
|
-
/*----------------------------------------*/
|
|
21
|
-
exports.default = getAttribute;
|
|
22
|
-
//# sourceMappingURL=getAttribute.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getAttribute.js","sourceRoot":"","sources":["../../src/commands/getAttribute.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,IAA6C;QAE/E,IAAA,QAAQ,GAEN,IAAI,SAFE,EACR,SAAS,GACP,IAAI,UADG,CACF;QACT,OAAO,CACL,EAAE;aACC,GAAG,CAAC,QAAQ,CAAC;aACb,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC;aACzB,IAAI,CAAC,UAAC,IAAI;YACT,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CACL,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,4CAA4C;AAC5C,4CAA4C;AAC5C,4CAA4C;AAE5C,kBAAe,YAAY,CAAC"}
|