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

Convert sticker end-to-end tests to Cypress #8807

Merged
merged 3 commits into from
Jun 10, 2022
Merged

Conversation

turt2live
Copy link
Member

@turt2live turt2live commented Jun 9, 2022

Reference materials:

Ideally we'd be able to use cy.origin() to jump into the iframe, but it's explicitly not supported. Instead we disable web security as instructed by cypress because it's our only reasonable option here. Thankfully, disabling web security doesn't appear to remove the crypto libraries from the browser so we can still function in that respect.

Rationale for why we can't just serve the sticker picker off the app domain is included in the code.


Please thumbs-up cypress-io/cypress#136 if you don't mind 😇


element-web notes: None
Fixes element-hq/element-web#22450


This change is marked as an internal change (Task), so will not be included in the changelog.

Reference materials:
* https://www.cypress.io/blog/2020/02/12/working-with-iframes-in-cypress/
* cypress-io/cypress#136
* https://docs.cypress.io/api/commands/origin#Other-limitations

Ideally we'd be able to use `cy.origin()` to jump into the iframe, but it's explicitly not supported. Instead we disable web security as instructed by cypress because it's our only reasonable option here. Thankfully, disabling web security doesn't appear to remove the crypto libraries from the browser so we can still function in that respect.

Rationale for why we can't just serve the sticker picker off the app domain is included in the code.
@turt2live turt2live added the T-Task Refactoring, enabling or disabling functionality, other engineering tasks label Jun 9, 2022
@turt2live turt2live marked this pull request as ready for review June 9, 2022 22:21
@turt2live turt2live requested a review from a team as a code owner June 9, 2022 22:21
Copy link
Contributor

@weeman1337 weeman1337 left a comment

Choose a reason for hiding this comment

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

The test ran locally without issues. LGTM 👍

@@ -7,5 +7,6 @@
"retries": {
"runMode": 2,
"openMode": 0
}
},
"chromeWebSecurity": false
Copy link
Member

Choose a reason for hiding this comment

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

The tests should also be runnable in firefox, do they work there?

Copy link
Member Author

Choose a reason for hiding this comment

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

How does one run them in Firefox? (Should we be enabling that in CI?)

Copy link
Member

Choose a reason for hiding this comment

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

test:cypress:open then pick your favourite installed Firefox version in the dropdown in the top right
Yeah ideally we'd run CI on Firefox & Chrome & Electron, but Electron doesn't work properly in CI for some reason

Copy link
Member Author

Choose a reason for hiding this comment

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

image

it even says it won't :D

FF is the only one with the warning though:

image

the tests also just don't run at all in FF:
image

bug: element-hq/element-web#22524

@turt2live turt2live merged commit 4171c00 into develop Jun 10, 2022
@turt2live turt2live deleted the travis/sticker-tests branch June 10, 2022 15:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Task Refactoring, enabling or disabling functionality, other engineering tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move stickers test over to Cypress
3 participants