Skip to content
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

[Storage] Download file test #2220

Merged
merged 12 commits into from
Jul 18, 2022
Merged

Conversation

juans-chainsafe
Copy link
Contributor

closes #2205

@juans-chainsafe juans-chainsafe added the Type: Maintenance Added to issues and PRs when a change is for repository maintenance , such as CI or linter changes. label Jul 11, 2022
@juans-chainsafe juans-chainsafe self-assigned this Jul 11, 2022
@juans-chainsafe juans-chainsafe linked an issue Jul 11, 2022 that may be closed by this pull request
@render
Copy link

render bot commented Jul 11, 2022

@render
Copy link

render bot commented Jul 11, 2022

@render
Copy link

render bot commented Jul 11, 2022

Copy link
Contributor

@FSM1 FSM1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm 🥇

@@ -143,7 +144,6 @@ describe("Bucket management", () => {
bucketsPage.bucketItemName().eq(0).should("have.text", chainSafeBucketName)
bucketsPage.bucketItemName().eq(1).should("have.text", ipfsBucketName)
})

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was accidental

// upload a file and store file content
navigationMenu.bucketsNavButton().click()

bucketsPage.createBucket(chainSafeBucketName, "chainsafe")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something for the future / separate ticket perhaps but when we need to create buckets as requisites for tests (but we're not testing bucket creation itself) it would probably be better to expand the apiTestHelper to add this ability. This way we can create the bucket programmatically and have it there at the beginning of the test which would be more efficient than setting it up in the UI.

Our FE developers would be best able to advise on the feasibility of doing this but I think it should be possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I can try to do this now, sounds fun

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its definitely doable. Shout if you have any issues @juans-chainsafe

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @FSM1 ! I just pushed the changes, I did it based on how we create folder in Files using the apiTestHelper @asnaith

cy.wait("@downloadRequest").should((download) => {
expect(download.response).to.have.property("statusCode", 200)
})
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done! 🤩

asnaith
asnaith previously approved these changes Jul 11, 2022
@asnaith asnaith dismissed their stale review July 12, 2022 16:55

Additional changes coming for apiTestHelper

navigationMenu.cidsNavButton().click()
navigationMenu.bucketsNavButton().click()
bucketsPage.awaitBucketRefresh()
bucketsPage.bucketItemRow().should("have.length", 1)
Copy link
Member

@asnaith asnaith Jul 12, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The navigation clicks that move away and then back to the buckets page are just to ensure that the UI is updated after creating the required buckets via the api, so I don't think we should be doing this before resolve()?

We should also catch any errors that happen during bucket creation so that we know where the problem is if/when it occurs. Otherwise, the problem would be obscured and it will result in a failure of the next test step (which it shouldn't have got to) and this could cause confusion when debugging failing tests.

If we do this, we can then we can omit bucketsPage.bucketItemRow().should("have.length", 1) which I think makes sense, we shouldn't be using assertions outside of the test layer and this would also fail if more than one bucket was created anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right that should be after the resolve, buuut we need that because we are using the api to create the bucket, so the UI is not updated with that bucket without refreshing the page (I change the go to cids and then go to buckets, with a cy.refresh() I think has more sence).

Added as well the try and catch logic and removed the validation

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. We have seen "detached from DOM" issues when using cy.reload() in the past but if it's working reliably here then that's fine with me :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will take a look at that, and if happens, I will go to the original implementation of going to cids and then bucket page

@@ -186,11 +183,10 @@ describe("Bucket management", () => {
const folderName = `folder ${Date.now()}`
const newFolderName = `new folder name ${Date.now()}`

cy.web3Login({ deleteFpsBuckets: true })
cy.web3Login({ deleteFpsBuckets: true, createFpsBuckets: [{ name: chainsafeBucketName, type: "chainsafe" }] })
navigationMenu.bucketsNavButton().click()

// create a new bucket and go inside the bucket
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment can be removed now as the bucket is already created by this point

@asnaith asnaith requested a review from FSM1 July 14, 2022 00:29
Copy link
Member

@asnaith asnaith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @juans-chainsafe!

I think it would be a good idea to get a second review from @FSM1 on this before merging because these apiTestHelper changes arrived after the original approval.

@FSM1
Copy link
Contributor

FSM1 commented Jul 18, 2022

Thanks for this @juans-chainsafe!

I think it would be a good idea to get a second review from @FSM1 on this before merging because these apiTestHelper changes arrived after the original approval.

Checked through the bucket creation code and it looks good to me. Happy with this being merged @juans-chainsafe @asnaith

@juans-chainsafe juans-chainsafe merged commit 3c8487b into dev Jul 18, 2022
@juans-chainsafe juans-chainsafe deleted the mnt/add-download-file-test-2205 branch July 18, 2022 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Maintenance Added to issues and PRs when a change is for repository maintenance , such as CI or linter changes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Storage] Add download file test
3 participants