diff --git a/android/build.gradle b/android/build.gradle index acc6df0be2..9b33fa59ab 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -11,7 +11,7 @@ buildscript { } dependencies { - classpath("com.android.tools.build:gradle:4.1.0") + classpath("com.android.tools.build:gradle:4.1.1") } } } diff --git a/e2e/Query/where.e2e.js b/e2e/Query/where.e2e.js index 82aa125013..ff4d9d3ff9 100644 --- a/e2e/Query/where.e2e.js +++ b/e2e/Query/where.e2e.js @@ -17,7 +17,7 @@ const COLLECTION = 'firestore'; const { wipe } = require('../helpers'); describe('firestore().collection().where()', () => { - before(() => wipe()); + beforeEach(async () => await wipe()); it('throws if fieldPath is invalid', () => { try { firebase @@ -339,9 +339,8 @@ describe('firestore().collection().where()', () => { }); }); - // FIXME flaky with semi-persistent data until emulator is working - xit('returns with in filter', async () => { - const colRef = firebase.firestore().collection(`${COLLECTION}/filter/in`); + it('returns with in filter', async () => { + const colRef = firebase.firestore().collection(`${COLLECTION}/filter/in${Date.now() + ''}`); await Promise.all([ colRef.add({ status: 'Ordered' }), @@ -359,9 +358,10 @@ describe('firestore().collection().where()', () => { }); }); - // FIXME flaky with semi-persistent data until emulator is working - xit('returns with array-contains-any filter', async () => { - const colRef = firebase.firestore().collection(`${COLLECTION}/filter/array-contains-any`); + it('returns with array-contains-any filter', async () => { + const colRef = firebase + .firestore() + .collection(`${COLLECTION}/filter/array-contains-any${Date.now() + ''}`); await Promise.all([ colRef.add({ category: ['Appliances', 'Housewares', 'Cooking'] }), @@ -375,9 +375,10 @@ describe('firestore().collection().where()', () => { snapshot.size.should.eql(3); // 2nd record should only be returned once }); - // FIXME flaky with semi-persistent data until emulator is working - xit('returns with a FieldPath', async () => { - const colRef = firebase.firestore().collection(`${COLLECTION}/filter/where-fieldpath`); + it('returns with a FieldPath', async () => { + const colRef = firebase + .firestore() + .collection(`${COLLECTION}/filter/where-fieldpath${Date.now() + ''}`); const fieldPath = new firebase.firestore.FieldPath('map', 'foo.bar@gmail.com'); await colRef.add({ @@ -412,9 +413,8 @@ describe('firestore().collection().where()', () => { } }); - // FIXME flaky with semi-persistent data until emulator is working - xit('should correctly query integer values with in operator', async () => { - const ref = firebase.firestore().collection(COLLECTION); + it('should correctly query integer values with in operator', async () => { + const ref = firebase.firestore().collection(`${COLLECTION}/filter/int-in${Date.now() + ''}`); await ref.add({ status: 1 }); @@ -427,9 +427,10 @@ describe('firestore().collection().where()', () => { items.length.should.equal(1); }); - // FIXME flaky with semi-persistent data until emulator is working - xit('should correctly query integer values with array-contains operator', async () => { - const ref = firebase.firestore().collection(COLLECTION); + it('should correctly query integer values with array-contains operator', async () => { + const ref = firebase + .firestore() + .collection(`${COLLECTION}/filter/int-array-contains${Date.now() + ''}`); await ref.add({ status: [1, 2, 3] }); @@ -442,9 +443,8 @@ describe('firestore().collection().where()', () => { items.length.should.equal(1); }); - // FIXME flaky with semi-persistent data until emulator is working - xit("should correctly retrieve data when using 'not-in' operator", async () => { - const ref = firebase.firestore().collection(COLLECTION); + it("should correctly retrieve data when using 'not-in' operator", async () => { + const ref = firebase.firestore().collection(`${COLLECTION}/filter/not-in${Date.now() + ''}`); await Promise.all([ref.add({ notIn: 'here' }), ref.add({ notIn: 'now' })]); @@ -519,9 +519,10 @@ describe('firestore().collection().where()', () => { } }); - // FIXME flaky with semi-persistent data until emulator is working - xit("should correctly retrieve data when using '!=' operator", async () => { - const ref = firebase.firestore().collection(COLLECTION); + it("should correctly retrieve data when using '!=' operator", async () => { + const ref = firebase + .firestore() + .collection(`${COLLECTION}/filter/bang-equals${Date.now() + ''}`); await Promise.all([ref.add({ notEqual: 'here' }), ref.add({ notEqual: 'now' })]); @@ -578,7 +579,9 @@ describe('firestore().collection().where()', () => { }); it('should handle where clause after sort by', async () => { - const ref = firebase.firestore().collection(`${COLLECTION}/filter/sort-by-where`); + const ref = firebase + .firestore() + .collection(`${COLLECTION}/filter/sort-by-where${Date.now() + ''}`); await ref.add({ status: 1 }); await ref.add({ status: 2 }); diff --git a/e2e/QuerySnapshot.e2e.js b/e2e/QuerySnapshot.e2e.js index a8fce2b5f0..9995184161 100644 --- a/e2e/QuerySnapshot.e2e.js +++ b/e2e/QuerySnapshot.e2e.js @@ -210,6 +210,7 @@ describe('firestore.QuerySnapshot', () => { snapshot.forEach.should.be.Function(); class Foo {} snapshot.forEach(callback, Foo); + await Utils.spyToBeCalledOnceAsync(callback, 20000); callback.should.be.calledOnce(); callback.firstCall.thisValue.should.eql(Foo); }); diff --git a/e2e/helpers.js b/e2e/helpers.js index 9a7d0a5289..0b328c69cd 100644 --- a/e2e/helpers.js +++ b/e2e/helpers.js @@ -22,6 +22,10 @@ const http = require('http'); exports.wipe = async function wipe(debug = false) { const deleteOptions = { method: 'DELETE', + headers: { + // Undocumented, but necessary - from Emulator UI network requests + Authorization: 'Bearer owner', + }, port: 8080, host: getE2eEmulatorHost(), path: '/emulator/v1/projects/' + getE2eTestProject() + '/databases/(default)/documents', @@ -31,7 +35,7 @@ exports.wipe = async function wipe(debug = false) { if (debug) { console.time('wipe'); } - await new Promise((resolve, reject) => { + return await new Promise((resolve, reject) => { const req = http.request(deleteOptions); req.on('error', error => reject(error)); @@ -45,5 +49,6 @@ exports.wipe = async function wipe(debug = false) { }); } catch (e) { console.error('Unable to wipe firestore:', e); + throw e; } };