-
Notifications
You must be signed in to change notification settings - Fork 3.3k
chore: create infrastructure to support backend function in cy.prompt #31803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
698b608
308fa25
085754e
f1296d3
81de355
e7365c3
4020676
633c14c
d3d6def
4408bbf
ac5407b
629bd10
80e0146
b9de91d
c50e7d7
fccf329
342dd99
d1a1186
0df5fb4
f90abcd
ad3c467
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -764,7 +764,7 @@ class $Cypress { | |
} | ||
} | ||
|
||
backend (eventName, ...args) { | ||
private baseBackendRequestHandler (emitEventName: string, eventName, ...args) { | ||
return new Promise((resolve, reject) => { | ||
const fn = function (reply) { | ||
const e = reply.error | ||
|
@@ -787,10 +787,18 @@ class $Cypress { | |
return resolve(reply.response) | ||
} | ||
|
||
return this.emit('backend:request', eventName, ...args, fn) | ||
return this.emit(emitEventName, eventName, ...args, fn) | ||
}) | ||
} | ||
|
||
backend (eventName, ...args) { | ||
return this.baseBackendRequestHandler('backend:request', eventName, ...args) | ||
} | ||
|
||
promptBackend (eventName, ...args) { | ||
return this.baseBackendRequestHandler('prompt:backend:request', eventName, ...args) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm curious we'd want to introduce so many places in the app where this could diverge vs bundling this logic up in a cloud call that handles what to do as well as telling the app if it should continue with non-cloud logic
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @emilyrohrbough makes a good point. Do we know if this is mostly for the experiment to iterate faster with plans to move it later to something a bit more stable There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a good point and I've refactored it a bit to minimize what is necessary on the app providing hooks to be more flexible in the cloud |
||
} | ||
|
||
automation (eventName, ...args) { | ||
// wrap action in promise | ||
return new Promise((resolve, reject) => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also took this opportunity to remove these types. We won't officially add them until we are ready to release the experiment