Skip to content

Commit

Permalink
[bare-expo][test-suite] Add support for expo-notifications test on web
Browse files Browse the repository at this point in the history
vapidPublicKey generated in the exponentjs Firebase project
  • Loading branch information
sjchmiela committed Dec 20, 2019
1 parent 29572c7 commit 91ac9d7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions apps/bare-expo/app.json
Expand Up @@ -15,6 +15,10 @@
"include": ["test-suite", "bare-expo"]
}
}
},
"notification": {
"serviceWorkerPath": "/expo-service-worker.js",
"vapidPublicKey": "BNHvR05XkY5LH9GdN0GreLx2wZnK9IwNJGVmo3jujIkFni4of26E3U3fnt9nUrZfM7h0omdIHKM0eshkzTSFOWQ"
}
}
}
12 changes: 10 additions & 2 deletions apps/bare-expo/e2e/TestSuite-test.web.js
@@ -1,4 +1,4 @@
/* global page */
/* global page, browser */
import { setDefaultOptions } from 'expect-puppeteer';

import config from '../jest-puppeteer.config';
Expand All @@ -16,9 +16,12 @@ const TESTS = [
'Contacts',
'Random',
'Crypto',
// Overridding permissions doesn't work in headless mode
// see https://github.com/puppeteer/puppeteer/issues/3279
!config.launch.headless && 'expo-notifications',
// 'Haptics',
// 'SecureStore',
];
].filter(t => t);

// This is how long we allocate for the actual tests to be run after the test screen has mounted.
const MIN_TIME = 50000;
Expand All @@ -28,6 +31,11 @@ setDefaultOptions({
timeout: MIN_TIME * 1.5,
});

beforeAll(async () => {
const context = browser.defaultBrowserContext();
await context.overridePermissions(config.url, ['notifications']);
});

function matchID(id, ...props) {
return expect(page).toMatchElement(`div[data-testid="${id}"]`, ...props);
}
Expand Down
3 changes: 2 additions & 1 deletion apps/test-suite/TestUtils.js
Expand Up @@ -68,7 +68,8 @@ export function getTestModules() {
modules.push(
require('./tests/Contacts'),
// require('./tests/SVG'),
require('./tests/Localization')
require('./tests/Localization'),
optionalRequire('./tests/NewNotifications')
);

if (browserSupportsWebGL()) {
Expand Down

0 comments on commit 91ac9d7

Please sign in to comment.