Skip to content

Commit

Permalink
Penumbra: Improve cross-browser testing (#246)
Browse files Browse the repository at this point in the history
* More stable browserstack versions

* Standardize build string

* Explicit Yarn version, move secrets into karma run

* [ci:run]

* log level -> >=warn in CI

* Use HTTPS proto for karma testing, so  is defined

* export karma cert from JS

* Comment out cert issue for now

* skip if crypto.subtle is missing

* enable video

* Skip ziphash test

* Drop firefox until we fix #249
  • Loading branch information
bencmbrook authored Feb 14, 2023
1 parent fd22a4a commit f9fd3b9
Show file tree
Hide file tree
Showing 10 changed files with 911 additions and 824 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: ci
on: push

env:
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}

jobs:
build-and-upload-artifacts:
runs-on: ubuntu-latest
Expand All @@ -22,6 +18,9 @@ jobs:
run-karma:
runs-on: ubuntu-latest
env:
BROWSERSTACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
Expand Down
823 changes: 823 additions & 0 deletions .yarn/releases/yarn-3.3.1.cjs

Large diffs are not rendered by default.

768 changes: 0 additions & 768 deletions .yarn/releases/yarn-sources.cjs

This file was deleted.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ plugins:
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: "@yarnpkg/plugin-typescript"

yarnPath: .yarn/releases/yarn-sources.cjs
yarnPath: .yarn/releases/yarn-3.3.1.cjs
13 changes: 13 additions & 0 deletions karma-certificate.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

61 changes: 34 additions & 27 deletions karma.browserstack.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
// Karma configuration
const { short } = require('git-rev-sync');
const getGlobalConfig = require('./karma.global');
const packageJson = require('./package.json');

module.exports = (config) => {
/**
* @see https://www.browserstack.com/automate/capabilities
*/
const customLaunchers = {
bs_chrome_pc: {
bs_chrome_mac: {
base: 'BrowserStack',
browser: 'Chrome',
browser_version: '85',
os: 'Windows',
os_version: '10',
device: null,
real_mobile: null,
browser_version: '104.0',
os: 'OS X',
os_version: 'Big Sur',
},
bs_firefox_pc: {
bs_safari_mac: {
base: 'BrowserStack',
browser: 'Firefox',
browser_version: '80',
os: 'Windows',
os_version: '10',
device: null,
real_mobile: null,
browser: 'Safari',
browser_version: '15.6',
os: 'OS X',
os_version: 'Monterey',
},
/**
* TODO: https://github.com/transcend-io/penumbra/issues/164
* Uncomment this entry once BrowserStack supports Safari 14.
* In the meantime Safari can be tested locally through `yarn start:demo`.
*/
// bs_safari_mac: {
// TODO: https://github.com/transcend-io/penumbra/issues/249
// bs_firefox_pc: {
// base: 'BrowserStack',
// browser: 'Safari',
// browser_version: '14',
// os: 'OS X',
// os_version: 'Catalina',
// device: null,
// real_mobile: null,
// browser: 'Firefox',
// browser_version: '102.0',
// os: 'Windows',
// os_version: '10',
// },
bs_edge_pc: {
base: 'BrowserStack',
browser: 'Edge',
browser_version: '108.0',
os: 'Windows',
os_version: '11',
},
};

const globalConfig = getGlobalConfig(config);
Expand All @@ -52,8 +53,14 @@ module.exports = (config) => {
browserStack: {
username: 'benjaminbrook3',
project: 'Penumbra',
video: false,
build: process.env.TRAVIS_BUILD_NUMBER || short(), // process.env.CIRCLE_BUILD_NUM
video: true,
build: `penumbra@${packageJson.version} - ${short()} - ${
process.env.GITHUB_RUN_ID ? `CI: ${process.env.GITHUB_RUN_ID}` : 'Local'
}`,
// TODO - https://github.com/transcend-io/penumbra/issues/249
// // A secure context must be used for `crypto.subtle` to be defined
// acceptInsecureCerts: 'true',
// acceptSslCerts: 'true',
},

// define browsers
Expand Down
13 changes: 11 additions & 2 deletions karma.global.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const webpackConfig = require('./webpack.prod.js');
// const { serverCrt, serverKey } = require('./karma-certificate');

module.exports = (config) => ({
// base path that will be used to resolve all patterns (eg. files, exclude)
Expand Down Expand Up @@ -57,6 +58,14 @@ module.exports = (config) => ({
reporters: [{ type: 'lcov' }],
},

// TODO - https://github.com/transcend-io/penumbra/issues/249
// // Create a secure context so `crypto.subtle` is defined
// httpsServerOptions: {
// key: Buffer.from(serverKey, 'base64').toString('utf-8'),
// cert: Buffer.from(serverCrt, 'base64').toString('utf-8'),
// },
// protocol: 'https:',

// web server port
port: 9876,

Expand All @@ -65,7 +74,7 @@ module.exports = (config) => ({

// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
logLevel: process.env.CI ? config.LOG_WARN : config.LOG_INFO,

// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
Expand All @@ -76,5 +85,5 @@ module.exports = (config) => ({

// Concurrency level
// how many browser should be started simultaneous
concurrency: 1,
concurrency: 5,
});
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@transcend-io/penumbra",
"version": "5.3.2",
"version": "5.3.3",
"description": "Crypto streams for the browser.",
"main": "dist/main.penumbra.js",
"types": "ts-build/src/index.d.ts",
Expand Down Expand Up @@ -113,5 +113,6 @@
"webpack-cli": "^3.3.12",
"webpack-merge": "^5.8.0",
"worker-plugin": "^5.0.1"
}
},
"packageManager": "[email protected]"
}
3 changes: 2 additions & 1 deletion src/tests/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ test('penumbra.encrypt() & penumbra.decrypt()', async (t) => {
t.end();
});

test('penumbra.saveZip({ saveBuffer: true }) - getBuffer(), getSize() and auto-renaming', async (t) => {
// TODO: https://github.com/transcend-io/penumbra/issues/250
test.skip('penumbra.saveZip({ saveBuffer: true }) - getBuffer(), getSize() and auto-renaming', async (t) => {
const expectedReferenceHashes = [
'318e197f7df584c339ec6d06490eb9cb3cdbb41c218809690d39d70d79dff48f',
'6cbf553053fcfe8b6c5e17313ef4383fcef4bc0cf3df48c904ed5e7b05af04a6',
Expand Down
40 changes: 21 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Manual changes might be lost - proceed with caution!

__metadata:
version: 5
version: 6
cacheKey: 8

"@ampproject/remapping@npm:^2.1.0":
Expand Down Expand Up @@ -2821,6 +2821,15 @@ __metadata:
languageName: node
linkType: hard

"acorn@npm:^8.5.0":
version: 8.8.1
resolution: "acorn@npm:8.8.1"
bin:
acorn: bin/acorn
checksum: 4079b67283b94935157698831967642f24a075c52ce3feaaaafe095776dfbe15d86a1b33b1e53860fc0d062ed6c83f4284a5c87c85b9ad51853a01173da6097f
languageName: node
linkType: hard

"acorn@npm:^8.7.1":
version: 8.7.1
resolution: "acorn@npm:8.7.1"
Expand Down Expand Up @@ -3773,17 +3782,10 @@ __metadata:
languageName: node
linkType: hard

"caniuse-lite@npm:^1.0.30001312":
version: 1.0.30001312
resolution: "caniuse-lite@npm:1.0.30001312"
checksum: 753fb9ea1e02e999430b323a71b5acab5120f3b5fc0161b01669f54a3ef5c5296240b6ae9b79b12a3742e3aed216aa9ee3d5398a23c16d08625ccd376b79545d
languageName: node
linkType: hard

"caniuse-lite@npm:^1.0.30001349":
version: 1.0.30001349
resolution: "caniuse-lite@npm:1.0.30001349"
checksum: 0095fcbb7ca4ef76227f5c3788c3cdbad3c52a25825c577371ffa73a44d74ff43fc5a849e5fa37c8b4c6237bb5272777085e1f674f9f86fde9aed85201d26f07
"caniuse-lite@npm:^1.0.30001312, caniuse-lite@npm:^1.0.30001349":
version: 1.0.30001445
resolution: "caniuse-lite@npm:1.0.30001445"
checksum: f98ca67829c3c52af5af0a62b8510432b2ad9594437d24ad460a6eb1a23d93e7a31631b1f550fbbe482ad05c467aa00da710a41699eb13d1f246d7db4147ab79
languageName: node
linkType: hard

Expand Down Expand Up @@ -5772,7 +5774,7 @@ __metadata:

"fsevents@patch:fsevents@^1.2.7#~builtin<compat/fsevents>":
version: 1.2.13
resolution: "fsevents@patch:fsevents@npm%3A1.2.13#~builtin<compat/fsevents>::version=1.2.13&hash=18f3a7"
resolution: "fsevents@patch:fsevents@npm%3A1.2.13#~builtin<compat/fsevents>::version=1.2.13&hash=d11327"
dependencies:
bindings: ^1.5.0
nan: ^2.12.1
Expand All @@ -5782,7 +5784,7 @@ __metadata:

"fsevents@patch:fsevents@~2.3.2#~builtin<compat/fsevents>":
version: 2.3.2
resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=18f3a7"
resolution: "fsevents@patch:fsevents@npm%3A2.3.2#~builtin<compat/fsevents>::version=2.3.2&hash=df0bf1"
dependencies:
node-gyp: latest
conditions: os=darwin
Expand Down Expand Up @@ -9515,7 +9517,7 @@ __metadata:

"resolve@patch:resolve@^1.1.6#~builtin<compat/resolve>, resolve@patch:resolve@^1.3.2#~builtin<compat/resolve>":
version: 1.18.1
resolution: "resolve@patch:resolve@npm%3A1.18.1#~builtin<compat/resolve>::version=1.18.1&hash=07638b"
resolution: "resolve@patch:resolve@npm%3A1.18.1#~builtin<compat/resolve>::version=1.18.1&hash=c3c19d"
dependencies:
is-core-module: ^2.0.0
path-parse: ^1.0.6
Expand All @@ -9525,7 +9527,7 @@ __metadata:

"resolve@patch:resolve@^1.14.2#~builtin<compat/resolve>, resolve@patch:resolve@^1.18.1#~builtin<compat/resolve>, resolve@patch:resolve@^1.20.0#~builtin<compat/resolve>, resolve@patch:resolve@^1.22.0#~builtin<compat/resolve>":
version: 1.22.0
resolution: "resolve@patch:resolve@npm%3A1.22.0#~builtin<compat/resolve>::version=1.22.0&hash=07638b"
resolution: "resolve@patch:resolve@npm%3A1.22.0#~builtin<compat/resolve>::version=1.22.0&hash=c3c19d"
dependencies:
is-core-module: ^2.8.1
path-parse: ^1.0.7
Expand All @@ -9538,7 +9540,7 @@ __metadata:

"resolve@patch:resolve@^2.0.0-next.3#~builtin<compat/resolve>":
version: 2.0.0-next.3
resolution: "resolve@patch:resolve@npm%3A2.0.0-next.3#~builtin<compat/resolve>::version=2.0.0-next.3&hash=07638b"
resolution: "resolve@patch:resolve@npm%3A2.0.0-next.3#~builtin<compat/resolve>::version=2.0.0-next.3&hash=c3c19d"
dependencies:
is-core-module: ^2.2.0
path-parse: ^1.0.6
Expand Down Expand Up @@ -10864,11 +10866,11 @@ __metadata:

"typescript@patch:typescript@^4.7.3#~builtin<compat/typescript>":
version: 4.7.3
resolution: "typescript@patch:typescript@npm%3A4.7.3#~builtin<compat/typescript>::version=4.7.3&hash=ddd1e8"
resolution: "typescript@patch:typescript@npm%3A4.7.3#~builtin<compat/typescript>::version=4.7.3&hash=65a307"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 8257ce7ecbbf9416da60045a76a99d473698ca9e973fa0ddab7137cacb1587255431176cbbcc801a650938c4dc8109ab88355774829a714fabe56a53a2fe4524
checksum: 137d18a77f52254a284960b16ab53d0619f57b69b5d585804b8413f798a1175ce3e774fb95e6a101868577aafe357d8fcfc9171f0dc9fc0c210e9ae59d107cc0
languageName: node
linkType: hard

Expand Down

1 comment on commit f9fd3b9

@vercel
Copy link

@vercel vercel bot commented on f9fd3b9 Feb 14, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.