-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add script to test CDN bundle #216
Conversation
67abbad
to
8b7bfe2
Compare
1b41236
to
3a256d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great start @lawrence-forooghian , however I think we could be using more of playwright features. I feel the way the test is setup, we are using it more as browser driver instead of test runner. I tried to do some refactoring in #218. Have a look and let's chat about this on Monday.
```ts | ||
const client = new Ably.Realtime.Promise({ key: "<API-key>", clientId: "<client-ID>" }); | ||
const spaces = new Spaces(client); | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should add this also to the docs/usage.md
document as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, done.
@@ -0,0 +1,3 @@ | |||
[submodule "test/ably-common"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need some instructions in place so folks know to run git submodules (and install chromium
) before running this test locally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, have added a section to CONTRIBUTING.md
.
a3adcfb
to
fc26b7a
Compare
3a256d6
to
b34eb75
Compare
Oh, that's cool — I didn't know that functionality existed in Playwright. I'll take a look at your linked PR and try and update this PR in line with it. |
b6ccef2
to
be251c8
Compare
@dpiatek as mentioned above, MMB-339 is currently causing CI to intermittently fail on this branch, meaning we can't merge it yet. How would you like to proceed with this? I was previously told not to investigate that issue until you'd had a chance to read it. |
Let's bring it into the sprint and try to investigate. I wonder if it could be a sandbox issue? |
Cool, have brought it into the sprint. |
be251c8
to
1e640bc
Compare
1e640bc
to
03b6022
Compare
c8d9e25
to
803416d
Compare
When used via the CDN, ably-js exposes itself through a global `Ably` object.
I am going to introduce a submodule and want to make use of a .prettierignore file to tell Prettier to ignore it. However, we are already overriding the --ignore-path flag to tell it to ignore the files described by .gitignore. Prettier 3 ignores the files described by .gitignore by default. This means that we can now remove our usage of --ignore-path and it’ll ignore the files described by .gitignore _and_ .prettierignore.
Add a `test:cdn_bundle` NPM script and run it in CI. This script tests the bundle that the `.github/workflows/cdn.yml` workflow will upload to the CDN, by checking that, when this bundle is imported by a web page, it gives access to a working Spaces client. The approach (using Playwright and a local web server powered by Express) is based heavily on that used by the `test:playwright` NPM script in ably-js at commit 83b4516. I then incorporated Dom’s suggestion of using Playwright’s built-in test-running functionality, taking code from his draft PR #218.
03b6022
to
e3a2f4d
Compare
Add a
test:cdn_bundle
NPM script and run it in CI. This script tests the bundle that the.github/workflows/cdn.yml
workflow will upload to the CDN, by checking that, when this bundle is imported by a web page, it gives access to a working Spaces client.The approach (using Playwright and a local web server powered by Express) is based heavily on that used by the
test:playwright
NPM script in ably-js. I think we’ll also be able to reuse some of this when we come to implement MMB-218 (integration tests).