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

[WIP] Improved the collections test code #428

Closed

Conversation

ccheraa
Copy link
Member

@ccheraa ccheraa commented Jun 4, 2021

  • Removed unnecessary nesting, and extra Cypress calls.
  • Added spies for collection related api calls.

@cla-bot cla-bot bot added the cla-signed label Jun 4, 2021
@duncdrum duncdrum self-requested a review June 4, 2021 20:36
Copy link
Contributor

@duncdrum duncdrum left a comment

Choose a reason for hiding this comment

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

Something went wrong with the merging / rebasing it seems. I very much like the additions to the collections test, and will cherry-pick 47f368e into my next PR. I have a better solution to the OS specific keyboard short cuts in duncdrum@599610d instead of mashing three keys conditionally run the appropriate two key combo

@duncdrum duncdrum mentioned this pull request Jun 4, 2021
@ccheraa ccheraa force-pushed the tests-rewrite branch 2 times, most recently from 5fac551 to 2199463 Compare June 9, 2021 14:13
@ccheraa ccheraa changed the title Improved the collections test code [WIP] Improved the collections test code Jun 14, 2021
@ccheraa
Copy link
Member Author

ccheraa commented Jun 14, 2021

The collections and documents specs now work individually without problems.
But if they are run alongside the other specs, sometimes, a test in one of them fails, even though the state of the db of those specs two specs is completely isolated from the other specs.

@duncdrum
Copy link
Contributor

initial run:

"before all" hook for "should display creation options":
     CypressError: The following error originated from your test code, not from Cypress. It was caused by an unhandled promise rejection.

  > 

When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.

Because this error occurred during a `before all` hook we are skipping the remaining tests in the current suite: `working with tree view`
  Error: The following error originated from your test code, not from Cypress. It was caused by an unhandled promise rejection.
  
    > 
  
  When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
  Error

Screenshot 2021-06-14 at 11 36 31

Screenshot 2021-06-14 at 11 36 45

@duncdrum duncdrum self-requested a review June 14, 2021 11:06
Copy link
Contributor

@duncdrum duncdrum left a comment

Choose a reason for hiding this comment

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

Have you tried running these on your Linux dev server (i.e. dv) ?
I can't get them to run at all. We are now establishing connections in two different ways within the same hook, that is bound to be flaky. The ApI connection stuff, happens without a matching test assertion, which explains the error message, The docs have some example code that on point. Let's clean those hooks up a bit see #400

There are a number of places where we can reuse existing test artifacts, lets.

})
after(() => {
// delete the test colelction
new Cypress.Promise(resolve => FSApi.remove(connection, '/db/test', true).then(resolve).catch(resolve))
Copy link
Contributor

Choose a reason for hiding this comment

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

The before and after hooks of the document spec are better, please match them here.

// (DP): end workaround for #413
cy.get('[node-id$=test]')
.click()
.prev().should('not.have.class', 'fa-spin')
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we testing spin here, multiple times ?

Copy link
Member Author

Choose a reason for hiding this comment

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

This here is to make sure the node is done loading
I added the wait because it turned out that the spin disappears before the rest of the tree is rendered (the nodes are not rendered all at once), so the wait is to give React enough time to update the dom

.should('not.exist')
it('should move a collection', () => {
const dataTransfer = new DataTransfer();
cy.get('[node-id$="test\\/col1"]')
Copy link
Contributor

Choose a reason for hiding this comment

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

another good place to reuse existing test or system artifacts instead of creating our own.

Copy link
Member Author

Choose a reason for hiding this comment

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

We need to create dataTransfer object for two tests only, so I thought it would be overkill to create it under beforeAll, and we shouldn't create in before because it shouldn't be reused.

Copy link
Contributor

Choose a reason for hiding this comment

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

my point wasn't about the before hooks but about the collections which have been created from earlier test cases, lets re-use whats already been generated and tested.


it('should not move a collection to one of its sub-collections', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

duplicate test case?

@@ -1321,7 +1321,9 @@ export class FSCore {
node.uri = name;
}
node.nodeName = this.getName(name);;
delete(this.dict[node.nodeId]);
Copy link
Contributor

Choose a reason for hiding this comment

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

please link open issues related to the fix from the commit message, if there isn't an open issue already create a new one

@ccheraa
Copy link
Member Author

ccheraa commented Jun 16, 2021

This fixes #433

adamretter and others added 17 commits June 17, 2021 09:49
Bumps [cypress](https://github.com/cypress-io/cypress) from 7.6.0 to 8.0.0.
- [Release notes](https://github.com/cypress-io/cypress/releases)
- [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js)
- [Commits](cypress-io/cypress@v7.6.0...v8.0.0)

---
updated-dependencies:
- dependency-name: cypress
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
…m_and_yarn/cypress-8.0.0

chore(deps-dev): bump cypress from 7.6.0 to 8.0.0
@ccheraa
Copy link
Member Author

ccheraa commented Jul 23, 2021

Moved to PR #459

@ccheraa ccheraa closed this Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants