Skip to content

Commit

Permalink
v0.10.0 (#89)
Browse files Browse the repository at this point in the history
* feat(login): add support for passing UID - #14 
* feat(types): update type of `login` function to include optional `uid` param - #14 
* feat(tests): add tests for emulator support - #73 
* chore(deps): update [firebase-tools-extra version](https://github.com/prescottprue/firebase-tools-extra/releases/tag/v0.5.0) for custom token generation used in new `login` functionality - #73
  • Loading branch information
prescottprue authored Feb 12, 2020
1 parent f0885e8 commit d3cd1dc
Show file tree
Hide file tree
Showing 14 changed files with 652 additions and 396 deletions.
7 changes: 4 additions & 3 deletions examples/basic/cypress/integration/Projects.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ describe('Projects View', () => {
describe('when authenticated', () => {
before(() => {
// Login using custom token
cy.login();
cy.log('Calling login')
cy.login(Cypress.env('TEST_UID'));
// TODO: Use cy.setRtdb() to set projects created by authed user
cy.callFirestore('add', 'projects', { name: 'project 1'})
cy.callRtdb('set', 'projects/asdf123', { name: 'project 1'})
// cy.callFirestore('add', 'projects', { name: 'project 1'})
// cy.callRtdb('set', 'projects/asdf123', { name: 'project 1'})
// Go to home page
cy.visit('/');
});
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
const cypressFirebasePlugin = require('cypress-firebase').plugin
const { extendWithFirebaseConfig } = require('cypress-firebase')

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
return cypressFirebasePlugin(config)
return extendWithFirebaseConfig(config)
}
10 changes: 6 additions & 4 deletions examples/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
"version": "0.1.0",
"scripts": {
"start": "react-scripts start",
"emulate": "cross-env REACT_APP_USE_DB_EMULATORS=true yarn start",
"build": "react-scripts build",
"eject": "react-scripts eject",
"build:testConfig": "cypress-firebase createTestEnvFile",
"test": "npm run build:testConfig && cross-env CYPRESS_baseUrl=http://localhost:3000 cypress run",
"test:ui": "npm run build:testConfig && cross-env CYPRESS_baseUrl=http://localhost:3000 cypress open"
"test:ui": "npm run build:testConfig && cross-env CYPRESS_baseUrl=http://localhost:3000 cypress open",
"test:emulate": "npm run build:testConfig && cross-env CYPRESS_baseUrl=http://localhost:3000 cypress open"
},
"dependencies": {
"firebase": "^7.8.0",
Expand All @@ -17,11 +19,11 @@
},
"devDependencies": {
"cross-env": "^5.2.0",
"cypress": "^3.8.3",
"cypress": "^4.0.1",
"cypress-firebase": "*",
"eslint-plugin-cypress": "^2.0.1",
"react-scripts": "3.3.1",
"firebase-tools": "^7.12.1"
"firebase-tools": "^7.12.1",
"react-scripts": "3.3.1"
},
"eslintConfig": {
"extends": "react-app"
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/src/initFirebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function getFirebaseInstance(initialState, history) {

// Initialize firebase instance if it doesn't already exist
if (!firebaseInstance) {
const shouldUseEmulator = window.Cypress || window.location.hostname === 'localhost'
const shouldUseEmulator = process.env.REACT_APP_USE_DB_EMULATORS

if (shouldUseEmulator) { // or window.location.hostname === 'localhost' if you want
console.log('Using RTDB emulator')
Expand Down
Loading

0 comments on commit d3cd1dc

Please sign in to comment.