我想保留/保留所有规格文件中的登录信息,而不是一次又一次地为每个文件登录:我发现多个测试的解决方案是一个文件,但我需要多个规格文件的多个测试的解决方案
Save local storage across tests to avoid re-authenticationSet local storage in Cypresshttps://www.npmjs.com/package/cypress-localstorage-commands
Save local storage across tests to avoid re-authentication
Set local storage in Cypress
https://www.npmjs.com/package/cypress-localstorage-commands
这些是具有多个测试的单个文件的解决方案,但我需要多个文件的解决方案
cypress-localstorage-commands包即使在不同的测试文件之间也保留localStorage,这是其默认行为。如其文档中所述,它还提供了clearLocalStorageSnapshot命令,以在需要时清除测试文件之间的localStorage。
clearLocalStorageSnapshot