From c8abdd53d07ac1b32dfb5782dc0fe504ea2d7885 Mon Sep 17 00:00:00 2001 From: Salakar Date: Sun, 16 Sep 2018 17:58:01 +0100 Subject: [PATCH] [tests][auth] ensure signed out state before each auth test --- tests/e2e/auth/auth.e2e.js | 2 +- tests/e2e/auth/emailLink.e2e.js | 7 +++++++ tests/e2e/auth/provider.e2e.js | 7 +++++++ tests/e2e/auth/user.e2e.js | 7 +++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/e2e/auth/auth.e2e.js b/tests/e2e/auth/auth.e2e.js index 47298e4c..87675cdf 100644 --- a/tests/e2e/auth/auth.e2e.js +++ b/tests/e2e/auth/auth.e2e.js @@ -2,7 +2,7 @@ describe('auth()', () => { beforeEach(async () => { if (firebase.auth().currentUser) { await firebase.auth().signOut(); - await sleep(25); + await sleep(50); } }); diff --git a/tests/e2e/auth/emailLink.e2e.js b/tests/e2e/auth/emailLink.e2e.js index 7b4980b3..294cc76b 100644 --- a/tests/e2e/auth/emailLink.e2e.js +++ b/tests/e2e/auth/emailLink.e2e.js @@ -1,4 +1,11 @@ describe('auth() -> emailLink Provider', () => { + beforeEach(async () => { + if (firebase.auth().currentUser) { + await firebase.auth().signOut(); + await sleep(50); + } + }); + describe('sendSignInLinkToEmail', () => { it('should send email', async () => { const random = randomString(12, '#aA'); diff --git a/tests/e2e/auth/provider.e2e.js b/tests/e2e/auth/provider.e2e.js index d98b2e6a..f8c6bd16 100644 --- a/tests/e2e/auth/provider.e2e.js +++ b/tests/e2e/auth/provider.e2e.js @@ -1,4 +1,11 @@ describe('auth() -> Providers', () => { + beforeEach(async () => { + if (firebase.auth().currentUser) { + await firebase.auth().signOut(); + await sleep(50); + } + }); + describe('EmailAuthProvider', () => { describe('constructor', () => { it('should throw an unsupported error', () => { diff --git a/tests/e2e/auth/user.e2e.js b/tests/e2e/auth/user.e2e.js index 3ff39919..4af59efb 100644 --- a/tests/e2e/auth/user.e2e.js +++ b/tests/e2e/auth/user.e2e.js @@ -1,4 +1,11 @@ describe('auth().currentUser', () => { + beforeEach(async () => { + if (firebase.auth().currentUser) { + await firebase.auth().signOut(); + await sleep(50); + } + }); + describe('getIdToken()', () => { it('should return a token', async () => { const random = randomString(12, '#aA');