-
Notifications
You must be signed in to change notification settings - Fork 675
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
Provide API to dump and restore state #3286
Comments
Hi @link89
|
Hi @miherlosev The API I want to have should be able to dump all data will be persisted in browser, includes:
As a developer, I think a simple and clean API can be applied to more scenarios (potentially). Here is some examples. Suppose we have following API: Scenario 1: reach verify point directly if dumped data existed// Pseudocode, statefile can be replaced by S3 or db
if (fileExists('statefile')) {
await t.restore('statefile');
} else {
// start to prepare scenario before reach test point
// ... a lot of steps ...
// end of prepare
writeFile(await t.dumpState(), 'statefile');
}
assert(...) We only need to run this case once, which will save a lot of time when every case is triggered 100+ times everyday. Scenario 2: what can be done by Role can also implement using these API// Pseudocode
// user1's context
await login(user1)
await sendMessageTo(user2, 'hello world')
// switch to user2's context
const state1 = await t.dumpState()
await t.resetState()
await login(user2)
// assertion
await shouldReceivedMessage('hello world').from(user1)
await sendMessageTo(user1, 'hello world')
// switch back to user1's context
const state2 = await t.dumpState()
await t.restore(state1)
// assertion
await shouldReceivedMessage('hello world').from(user2) |
Thank you for the detailed explanation. I've marked this issue as a suggestion. |
Any update? |
Once we get any results, we will post them here. |
Just going to bump this as this as this is something that's hampered our use of TestCafe since it's hard to make it work nicely with Firebase auth |
This issue has been automatically marked as stale because it has not had any activity for a long period. It will be closed and archived if no further activity occurs. However, we may return to this issue in the future. If it still affects you or you have any additional information regarding it, please leave a comment and we will keep it open. |
We're closing this issue after a prolonged period of inactivity. If it still affects you, please add a comment to this issue with up-to-date information. Thank you. |
Can we re-open this issue please ? This is one of @miherlosev suggestions for working with firebase #4939 (comment) I am unable to get a TestCafe + Firebase + Browserstack flow working (testcafe not supporting signInWithPopup with cloud browsers, and firebase not working with signInWithRedirect if removing indexedDB) . This issue could have been an alternative to get something working. |
The case with supporting Firebase for Role is described in a separate issue – #2420. The enhancement described in this issue is very abstract. Also, there are no other cases when it's necessary. So, this issue can be closed. |
What is your Test Scenario?
In order to save time in test execution, we may try to reuse state cross different tests.
Testcafe have provided a feature name "Role". But this feature is just for login scenarios.
I hope that we could have some low level API to dump and restore states.
What are you suggesting?
My suggestions is testcafe should provide two API: dumpState, restoreState
When I calling
const state: String = await t.dumpState()
, testcafe should collect necessary information and serialize it.Then when I need to using the state dumped by other tests, I just need to call
await t.restoreState(state)
. And testcafe should restore browser to the point thatawait t.dumpState()
is called.This design will provide enough flexibility for developer to using the state in their test cases. For example, when I using testcafe for integration testing, I can even persist state to database so that I can share state cross run!
The text was updated successfully, but these errors were encountered: