-
Notifications
You must be signed in to change notification settings - Fork 17
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
Testing without deploying #1
Comments
Not that I know of, one way I tested my notifications is to trigger a manual ServiceWorker update in the Google Chrome developer tools in the Application -> ServiceWorkers tab. Not sure if I changed something here as I don't seem to be able to reproduce this in one of my Apps. |
@topaxi I tried to reproduce just like you said, but not works. |
is there a way we can at least have automated tests for this? |
Assuming you use #3 - I test this in a few applications with an acceptance test. Something like: import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import { t } from 'ember-intl/test-support';
import page from '../pages/index';
import config from 'ember-get-config';
module('Acceptance | new build notification', function(hooks) {
setupApplicationTest(hooks);
hooks.beforeEach(function () {
config.environment = 'staging';
window.isUpdateAvailable = new Promise((resolve) => {
resolve(true);
});
});
hooks.afterEach(function () {
config.environment = 'test';
window.isUpdateAvailable = null;
});
test('new build renders when update is available', async function(assert) {
await visit('/');
assert.equal(currentURL(), '/login');
assert.ok(page.build.isVisible, 'see new build notification');
assert.equal(
page.build.text,
t('components.new-build-notifier.text'),
'notification has correct text'
);
assert.ok(page.build.action.isVisible, 'see action to reload');
assert.equal(
page.build.action.text,
t('components.new-build-notifier.action'),
'action button has correct text'
);
});
}); Note that I only enable this notification in |
What I do for an ad-hoc testing locally is to:
This is easier when you set a smaller polling interval in the component with |
Is there a simple way to test this notification without deploying?
The text was updated successfully, but these errors were encountered: