-
Notifications
You must be signed in to change notification settings - Fork 1
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
Expand transaction data file download feature #120
Draft
Cruikshanks
wants to merge
15
commits into
main
Choose a base branch
from
add-generate-data-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
These will be needed to access the data export files in the s3 bucket.
The selector for the alert is not the same as the one used for the alert that appears at the top of the page after certain actions. So, we add a new control to the `ExportDataPage` and use that instead. Note - We also reduce the amount of text we're checking against. The text often has newlines embedded that are not immediately visible from the UI which can catch you unawares when testing. As we just want to check the state of the page i.e. that it's reflecting no file has been generated we can simplify the matching by checking for something that still confirms this is the case.
Because we have to authenticate to run the job it unfortunately plays with the current session. This is because it authenticates anew on the assumption we have not authenticated.
Completely forgot we have an additional argument we can use to tell the job command not to authenticate when it runs. We added this specifically for this situation; where we are already logged in and need to run the job. However, this does leave us on the job results page which is why we need to return to the home page before we can then select the regime from the menu.
We are now at the point that we can download the data export file, which confirms the TCM generated the file when the data export job was run.
Have got it to the point that we download the file and save it locally. But it doesn't work. The file we are downloading is a gzip file and what the S3download command is doing is streaming the data as a string. If we save that to a file any attempts to open it raises a 'unsupported format' error. Because the cypress tests are run in the browser it has limited access to the file system. You must use it's `writeFile()` method which expects a string. So, I'm starting to lean towards using the https://www.npmjs.com/package/cypress-downloadfile to get hold of it instead.
This adds support for a `cy.downloadFile()` to the project. It also means we can download the data export in the same way as if we had clicked the download button. This means we mimic better what a user would do and we avoid the whole issue of managing the data stream from AWS S3 into a format that corecctly copies the file in gzip format.
With this new task we can now unzip the transaction data file.
We update our step to not only download the file but unzip it as well.
We now have a step that confirms the transaction data file contains the data we expect. It's a cursory check; the number of lines are as expected and each is for a reference that links to the current regime. But for the purposes of this feature and to confirm the transaction data file export is working this should suffice.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://eaflood.atlassian.net/browse/CMEA-299
In this change, we make use of the new test endpoint
/jobs/data
to expand the existing transaction file data export feature to include checking you can download the file and that its contents are as expected once the job has run.