-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Closed as not planned
Labels
existing workaroundstage: needs investigatingSomeone from Cypress needs to look at thisSomeone from Cypress needs to look at thisstaleno activity on this issue for a long periodno activity on this issue for a long periodtopic: plugins ⚙️type: unexpected behaviorUser expected result, but got anotherUser expected result, but got another
Description
Current behavior:
If I create a task like:
(TS, we transpile to JS for Cypress)
const generateCMLicenseHandler = (args: any) => {
logger.log('args: ' + JSON.stringify(args));
const { mode, name, validUntil, evaluation }: { mode: AnalyticsMode, name: string, validUntil: Date, evaluation: boolean } = args;
logger.log(`generating license: mode: ${mode}, name: ${name}, valid until: ${validUntil} (${typeof validUntil}), eval: ${evaluation} (${typeof evaluation})`);
return new LicenseGenerator().generate(mode, name, validUntil, evaluation);
};
module.exports = {
'cm:generate-license': generateCMLicenseHandler
};
And call it like:
Cypress.Commands.add('uploadLicense', { prevSubject: true }, (subject, mode: AnalyticsMode, name: string, validUntil: Date, evaluation: boolean) => {
if (!subject) {
throw new Error('uploadLicense must be chained off your upload target!');
}
return cy.task('cm:generate-license', { mode, name, validUntil, evaluation })
.then((result: string) => cy.upload(
[{
fileContent: result,
fileName: 'license.lic',
mimeType: 'text/plain',
encoding: 'utf-8'
}],
{
force: true,
subjectType: 'drag-n-drop'
})
);
});
In Spec
licenseModal
.uploadZone()
.uploadLicense('Full', 'Cypress Testing Ltd', new Date(new Date().getFullYear() + 5, 0, 1, 0, 0, 0, 0), false);
I see this as the args object logged:
args: {"mode":"Full","name":"Cypress Testing Ltd","validUntil":"2024-01-01T00:00:00.000Z","evaluation":false}
generating license: mode: Full, name: Cypress Testing Ltd, valid until: 2024-01-01T00:00:00.000Z (string), eval: false (boolean)
Desired behavior:
The documentation at:
Implies it should be serialised and deserialised correctly.
See code above
Versions
Cypress 3.4.1
MacOS Mojava latest
TomaszG and omgitsedwin
Metadata
Metadata
Assignees
Labels
existing workaroundstage: needs investigatingSomeone from Cypress needs to look at thisSomeone from Cypress needs to look at thisstaleno activity on this issue for a long periodno activity on this issue for a long periodtopic: plugins ⚙️type: unexpected behaviorUser expected result, but got anotherUser expected result, but got another