How do I persist an SFTP and/or database connection for the duration of my test run? #30211
Unanswered
Ixluxi
asked this question in
Questions and Help
Replies: 1 comment
-
Possible additional context: I sometimes get this message "Global close listener: close event raised". The actual task that is primarily causing me this headache is:
As you can see, I tried to avoid loops (https://docs.cypress.io/guides/core-concepts/introduction-to-cypress - 'Avoid loops' section) by implementing recursion. But perhaps I'm not entirely doing this for the delete command. I'd prefer to delete all .csv files in each directory without having to know their file names but I guess if this is causing the issue then I'll need to adjust my approach to know which files I'm trying to delete... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
My test suite makes a lot of calls to an FTP server (using ssh2-sftp-client) and database (using mysql2). Each time, a new connection is being created and then closed when the work for each call is done.
E.g. (task)
This damaging performance. One of our developers said "There will probably be a cost for initialising, handshakes, that you might be paying multiple times".
Ideally, then, I'm looking to create 1 ftp connection and 1 database connection to be used for the entire test run to avoid this overhead.
Is this possible?
I tried to implement this by creating a variable in the config file and in the before:run, creating the connection, and in the after:run, closing it. Then in my various tasks, that variable is called to attempt to invoke, let's say, for ftp, the .put/.delete commands etc. However, I get an error stating that no such method exists on the variable.
I will continue Googling but I hope you can help!
Beta Was this translation helpful? Give feedback.
All reactions