Skip to content

Commit

Permalink
fix imports in e2e files
Browse files Browse the repository at this point in the history
  • Loading branch information
exaby73 authored and mikehardy committed Sep 4, 2023
1 parent 9fc6e53 commit b19749c
Showing 1 changed file with 29 additions and 14 deletions.
43 changes: 29 additions & 14 deletions packages/in-app-messaging/e2e/fiam.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,31 +93,40 @@ describe('inAppMessaging()', function () {

describe('modular', function () {
describe('setAutomaticDataCollectionEnabled()', function () {
const {
getInAppMessaging,
setAutomaticDataCollectionEnabled,
isAutomaticDataCollectionEnabled,
} = inAppMessagingModular;
const inAppMessaging = getInAppMessaging();

// These depend on `tests/firebase.json` having `in_app_messaging_auto_collection_enabled` set to false the first time
// The setting is persisted across restarts, reset to false after for local runs where prefs are sticky
afterEach(async function () {
await setAutomaticDataCollectionEnabled(inAppMessaging, false);
});

it('true', async function () {
const {
getInAppMessaging,
setAutomaticDataCollectionEnabled,
isAutomaticDataCollectionEnabled,
} = inAppMessagingModular;
const inAppMessaging = getInAppMessaging();

should.equal(isAutomaticDataCollectionEnabled(inAppMessaging), false);
await setAutomaticDataCollectionEnabled(inAppMessaging, true);
should.equal(isAutomaticDataCollectionEnabled(inAppMessaging), true);
});

it('false', async function () {
const {
getInAppMessaging,
setAutomaticDataCollectionEnabled,
isAutomaticDataCollectionEnabled,
} = inAppMessagingModular;
const inAppMessaging = getInAppMessaging();

await setAutomaticDataCollectionEnabled(inAppMessaging, false);
should.equal(isAutomaticDataCollectionEnabled(inAppMessaging), false);
});

it('errors if not boolean', async function () {
const { setAutomaticDataCollectionEnabled } = inAppMessagingModular;

try {
setAutomaticDataCollectionEnabled();
return Promise.reject(new Error('Did not throw'));
Expand All @@ -129,18 +138,22 @@ describe('inAppMessaging()', function () {
});

xdescribe('setMessagesDisplaySuppressed()', function () {
const { getInAppMessaging, setMessagesDisplaySuppressed, isMessagesDisplaySuppressed } =
inAppMessagingModular;
const inAppMessaging = getInAppMessaging();

it('false', async function () {
const { getInAppMessaging, setMessagesDisplaySuppressed, isMessagesDisplaySuppressed } =
inAppMessagingModular;
const inAppMessaging = getInAppMessaging();

should.equal(isMessagesDisplaySuppressed(inAppMessaging), false);
await setMessagesDisplaySuppressed(inAppMessaging, false);
should.equal(isMessagesDisplaySuppressed(inAppMessaging), false);
await Utils.sleep(2000);
});

it('true', async function () {
const { getInAppMessaging, setMessagesDisplaySuppressed, isMessagesDisplaySuppressed } =
inAppMessagingModular;
const inAppMessaging = getInAppMessaging();

await device.launchApp();
await setMessagesDisplaySuppressed(inAppMessaging, true);
should.equal(isMessagesDisplaySuppressed(inAppMessaging), true);
Expand All @@ -151,6 +164,8 @@ describe('inAppMessaging()', function () {
});

it('errors if not boolean', async function () {
const { setMessagesDisplaySuppressed } = inAppMessagingModular;

try {
setMessagesDisplaySuppressed();
return Promise.reject(new Error('Did not throw'));
Expand All @@ -162,10 +177,10 @@ describe('inAppMessaging()', function () {
});

xdescribe('triggerEvent()', function () {
const { getInAppMessaging, triggerEvent } = inAppMessagingModular;
const inAppMessaging = getInAppMessaging();

it('no exceptions thrown', async function () {
const { getInAppMessaging, triggerEvent } = inAppMessagingModular;
const inAppMessaging = getInAppMessaging();

await device.launchApp();
await triggerEvent(inAppMessaging, 'eventName');
});
Expand Down

0 comments on commit b19749c

Please sign in to comment.