Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

E2E: add post-verification on Cypress task that the request is successfully completed #3075

Merged
merged 1 commit into from
Jul 9, 2019

Conversation

saturninoabril
Copy link
Member

Summary

E2E: add post-verification on Cypress task that the request is successfully completed by wrapping those tasks into commands.

By doing so, Cypress awaits in a certain default period of time that the (http) request is indeed successful before actually doing/verifying next step. This prevents flakiness due to timing issue especially when dealing with network request.

Ticket Link

n/a

@saturninoabril saturninoabril added the 2: Dev Review Requires review by a core commiter label Jul 8, 2019
const baseUrl = Cypress.config('baseUrl');

cy.task('postMessageAs', {sender, message, channelId, rootId, createAt, baseUrl}).its('status').should('be.equal', 201);
});
Copy link
Member Author

Choose a reason for hiding this comment

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

@thekiiingbob I reverted this code which you've introduced before and then was removed by me. When I removed it before, for some reason, I've got some issue and I thought it's about Cypress task inside Cypress command. I think I'm wrong as I can't repro the issue when I reverted it now.

const baseUrl = Cypress.config('baseUrl');

cy.task('externalRequest', {baseUrl, user, method, path, data}).its('status').should('be.equal', 200);
});
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think these commands could be part of api_commands or ui_commands, and so I added those to new task_commands.js. Feel free to comment/recommend, especially the filename.

Copy link
Contributor

@thekiiingbob thekiiingbob 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 doing this, I like wrapping the tasks so we can tack on even just basic assertions (and for automatically waiting).

Copy link
Contributor

@bradjcoughlin bradjcoughlin left a comment

Choose a reason for hiding this comment

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

👍

@saturninoabril saturninoabril merged commit cddfb0b into mattermost:master Jul 9, 2019
@saturninoabril saturninoabril deleted the fix-e2e-9 branch July 9, 2019 18:53
@amyblais amyblais added Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation and removed 2: Dev Review Requires review by a core commiter labels Jul 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Changelog/Not Needed Does not require a changelog entry Docs/Not Needed Does not require documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants