mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
fix .env loading
This commit is contained in:
parent
00c615d796
commit
38c3fc1397
@ -1,3 +1,4 @@
|
||||
const dotenv = require('dotenv')
|
||||
const { defineConfig } = require("cypress");
|
||||
const browserify = require("@badeball/cypress-cucumber-preprocessor/browserify");
|
||||
const { addCucumberPreprocessorPlugin } = require("@badeball/cypress-cucumber-preprocessor");
|
||||
@ -30,6 +31,9 @@ async function setupNodeEvents(on, config) {
|
||||
return config;
|
||||
}
|
||||
|
||||
// Import backend .env (smart)?
|
||||
const { parsed } = dotenv.config({ path: '../backend/.env' })
|
||||
|
||||
module.exports = defineConfig({
|
||||
e2e: {
|
||||
projectId: "qa7fe2",
|
||||
@ -59,4 +63,5 @@ module.exports = defineConfig({
|
||||
video: false,
|
||||
setupNodeEvents,
|
||||
},
|
||||
env: parsed
|
||||
});
|
||||
@ -15,7 +15,7 @@
|
||||
/* globals Cypress cy */
|
||||
import "cypress-file-upload";
|
||||
import { GraphQLClient, request } from 'graphql-request'
|
||||
import config from '../../backend/src/config'
|
||||
import CONFIG from '../../backend/src/config'
|
||||
|
||||
const authenticatedHeaders = (variables) => {
|
||||
const mutation = `
|
||||
@ -24,7 +24,7 @@ const authenticatedHeaders = (variables) => {
|
||||
}
|
||||
`
|
||||
return new Cypress.Promise((resolve, reject) => {
|
||||
request(config.GRAPHQL_URI, mutation, variables).then((response) => {
|
||||
request(CONFIG.GRAPHQL_URI, mutation, variables).then((response) => {
|
||||
resolve({ authorization: `Bearer ${response.login}` })
|
||||
})
|
||||
})
|
||||
@ -40,7 +40,7 @@ Cypress.Commands.add(
|
||||
({email, password}) => {
|
||||
return new Cypress.Promise((resolve, reject) => {
|
||||
authenticatedHeaders({ email, password }).then((headers) => {
|
||||
resolve(new GraphQLClient(config.GRAPHQL_URI, { headers }))
|
||||
resolve(new GraphQLClient(CONFIG.GRAPHQL_URI, { headers }))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user