mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Merge branch 'master' of github.com:Human-Connection/Human-Connection into 3054-add-e2e-tests-image-uploader
This commit is contained in:
commit
ee3a85f70f
@ -967,7 +967,6 @@ const languages = ['de', 'en', 'es', 'fr', 'it', 'pt', 'pl']
|
|||||||
[...Array(4).keys()].map(() =>
|
[...Array(4).keys()].map(() =>
|
||||||
Factory.build(
|
Factory.build(
|
||||||
'comment',
|
'comment',
|
||||||
4,
|
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
author: jennyRostock,
|
author: jennyRostock,
|
||||||
|
|||||||
@ -42,10 +42,12 @@ Given('I am logged in with a {string} role', role => {
|
|||||||
.first("User", {
|
.first("User", {
|
||||||
name: `${role} is my name`,
|
name: `${role} is my name`,
|
||||||
})
|
})
|
||||||
.then(async user => {
|
.then(user => {
|
||||||
const userJson = await user.toJson()
|
return new Cypress.Promise((resolve, reject) => {
|
||||||
cy.login(userJson)
|
return user.toJson().then((user) => resolve(user))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
.then(user => cy.login(user))
|
||||||
})
|
})
|
||||||
|
|
||||||
When('I click on "Report Post" from the content menu of the post', () => {
|
When('I click on "Report Post" from the content menu of the post', () => {
|
||||||
|
|||||||
@ -39,10 +39,12 @@ Given("I am logged in", () => {
|
|||||||
.first("User", {
|
.first("User", {
|
||||||
name: narratorParams.name
|
name: narratorParams.name
|
||||||
})
|
})
|
||||||
.then(async user => {
|
.then(user => {
|
||||||
const userJson = await user.toJson()
|
return new Cypress.Promise((resolve, reject) => {
|
||||||
cy.login(userJson)
|
return user.toJson().then((user) => resolve(user))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
.then(user => cy.login(user))
|
||||||
});
|
});
|
||||||
|
|
||||||
Given("I log in as {string}", name => {
|
Given("I log in as {string}", name => {
|
||||||
@ -51,10 +53,12 @@ Given("I log in as {string}", name => {
|
|||||||
.first("User", {
|
.first("User", {
|
||||||
name
|
name
|
||||||
})
|
})
|
||||||
.then(async user => {
|
.then(user => {
|
||||||
const userJson = await user.toJson()
|
return new Cypress.Promise((resolve, reject) => {
|
||||||
cy.login(userJson)
|
return user.toJson().then((user) => resolve(user))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
.then(user => cy.login(user))
|
||||||
})
|
})
|
||||||
|
|
||||||
Given("the {string} user searches for {string}", (_, postTitle) => {
|
Given("the {string} user searches for {string}", (_, postTitle) => {
|
||||||
@ -63,10 +67,12 @@ Given("the {string} user searches for {string}", (_, postTitle) => {
|
|||||||
.first("User", {
|
.first("User", {
|
||||||
id: "annoying-user"
|
id: "annoying-user"
|
||||||
})
|
})
|
||||||
.then(async user => {
|
.then(user => {
|
||||||
const userJson = await user.toJson()
|
return new Cypress.Promise((resolve, reject) => {
|
||||||
cy.login(userJson)
|
return user.toJson().then((user) => resolve(user))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
.then(user => cy.login(user))
|
||||||
cy.get(".searchable-input .ds-select-search")
|
cy.get(".searchable-input .ds-select-search")
|
||||||
.focus()
|
.focus()
|
||||||
.type(postTitle);
|
.type(postTitle);
|
||||||
@ -143,10 +149,12 @@ When("a blocked user visits the post page of one of my authored posts", () => {
|
|||||||
.first("User", {
|
.first("User", {
|
||||||
name: 'Harassing User'
|
name: 'Harassing User'
|
||||||
})
|
})
|
||||||
.then(async user => {
|
.then(user => {
|
||||||
const userJson = await user.toJson()
|
return new Cypress.Promise((resolve, reject) => {
|
||||||
cy.login(userJson)
|
return user.toJson().then((user) => resolve(user))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
.then(user => cy.login(user))
|
||||||
cy.openPage('post/previously-created-post')
|
cy.openPage('post/previously-created-post')
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -355,10 +363,12 @@ Given("I am logged in with these credentials:", table => {
|
|||||||
.first("User", {
|
.first("User", {
|
||||||
name: loginCredentials.email,
|
name: loginCredentials.email,
|
||||||
})
|
})
|
||||||
.then(async user => {
|
.then(user => {
|
||||||
const userJson = await user.toJson()
|
return new Cypress.Promise((resolve, reject) => {
|
||||||
cy.login(userJson)
|
return user.toJson().then((user) => resolve(user))
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
.then(user => cy.login(user))
|
||||||
});
|
});
|
||||||
|
|
||||||
When("I fill the password form with:", table => {
|
When("I fill the password form with:", table => {
|
||||||
|
|||||||
@ -25,14 +25,17 @@ const switchLang = name => {
|
|||||||
cy.contains(".locale-menu-popover a", name).click();
|
cy.contains(".locale-menu-popover a", name).click();
|
||||||
};
|
};
|
||||||
|
|
||||||
const authenticatedHeaders = async (variables) => {
|
const authenticatedHeaders = (variables) => {
|
||||||
const mutation = gql`
|
const mutation = gql`
|
||||||
mutation($email: String!, $password: String!) {
|
mutation($email: String!, $password: String!) {
|
||||||
login(email: $email, password: $password)
|
login(email: $email, password: $password)
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
const response = await request(config.GRAPHQL_URI, mutation, variables)
|
return new Cypress.Promise((resolve, reject) => {
|
||||||
return { authorization: `Bearer ${response.login}` }
|
request(config.GRAPHQL_URI, mutation, variables).then((response) => {
|
||||||
|
resolve({ authorization: `Bearer ${response.login}` })
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
Cypress.Commands.add("switchLanguage", (name, force) => {
|
Cypress.Commands.add("switchLanguage", (name, force) => {
|
||||||
@ -81,20 +84,22 @@ Cypress.Commands.add("openPage", page => {
|
|||||||
|
|
||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
'authenticateAs',
|
'authenticateAs',
|
||||||
async ({email, password}) => {
|
({email, password}) => {
|
||||||
const headers = await authenticatedHeaders({ email, password })
|
return new Cypress.Promise((resolve, reject) => {
|
||||||
return new GraphQLClient(config.GRAPHQL_URI, { headers })
|
authenticatedHeaders({ email, password }).then((headers) => {
|
||||||
}
|
resolve(new GraphQLClient(config.GRAPHQL_URI, { headers }))
|
||||||
)
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
'mutate',
|
'mutate',
|
||||||
{ prevSubject: true },
|
{ prevSubject: true },
|
||||||
async (graphQLClient, mutation, variables) => {
|
(graphQLClient, mutation, variables) => {
|
||||||
await graphQLClient.request(mutation, variables)
|
return new Cypress.Promise((resolve, reject) => {
|
||||||
return graphQLClient
|
graphQLClient.request(mutation, variables).then(() => resolve(graphQLClient))
|
||||||
}
|
})
|
||||||
)
|
})
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|||||||
@ -8,9 +8,7 @@ const neo4jConfigs = {
|
|||||||
}
|
}
|
||||||
const neodeInstance = getNeode(neo4jConfigs)
|
const neodeInstance = getNeode(neo4jConfigs)
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(() => cleanDatabase())
|
||||||
await cleanDatabase()
|
|
||||||
})
|
|
||||||
|
|
||||||
Cypress.Commands.add('neode', () => {
|
Cypress.Commands.add('neode', () => {
|
||||||
return neodeInstance
|
return neodeInstance
|
||||||
@ -19,14 +17,14 @@ Cypress.Commands.add('neode', () => {
|
|||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
'first',
|
'first',
|
||||||
{ prevSubject: true },
|
{ prevSubject: true },
|
||||||
async (neode, model, properties) => {
|
(neode, model, properties) => {
|
||||||
return neode.first(model, properties)
|
return neode.first(model, properties)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
'relateTo',
|
'relateTo',
|
||||||
{ prevSubject: true },
|
{ prevSubject: true },
|
||||||
async (node, otherNode, relationship) => {
|
(node, otherNode, relationship) => {
|
||||||
return node.relateTo(otherNode, relationship)
|
return node.relateTo(otherNode, relationship)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -36,9 +34,10 @@ Cypress.Commands.add('factory', () => Factory)
|
|||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
'build',
|
'build',
|
||||||
{ prevSubject: true },
|
{ prevSubject: true },
|
||||||
async (factory, name, atrributes, options) => {
|
(factory, name, atrributes, options) => {
|
||||||
await factory.build(name, atrributes, options)
|
return new Cypress.Promise((resolve, reject) => {
|
||||||
return factory
|
return factory.build(name, atrributes, options).then(() => resolve(factory))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -2,3 +2,5 @@ MAPBOX_TOKEN="pk.eyJ1IjoiaHVtYW4tY29ubmVjdGlvbiIsImEiOiJjajl0cnBubGoweTVlM3VwZ2l
|
|||||||
SENTRY_DSN_WEBAPP=
|
SENTRY_DSN_WEBAPP=
|
||||||
COMMIT=
|
COMMIT=
|
||||||
PUBLIC_REGISTRATION=false
|
PUBLIC_REGISTRATION=false
|
||||||
|
WEBSOCKETS_URI=ws://localhost:3000/api/graphql
|
||||||
|
GRAPHQL_URI=http://localhost:4000/
|
||||||
|
|||||||
@ -4,7 +4,13 @@ import dotenv from 'dotenv'
|
|||||||
dotenv.config() // we want to synchronize @nuxt-dotenv and nuxt-env
|
dotenv.config() // we want to synchronize @nuxt-dotenv and nuxt-env
|
||||||
|
|
||||||
const pkg = require('./package')
|
const pkg = require('./package')
|
||||||
export const envWhitelist = ['NODE_ENV', 'MAPBOX_TOKEN', 'PUBLIC_REGISTRATION']
|
export const envWhitelist = [
|
||||||
|
'NODE_ENV',
|
||||||
|
'MAPBOX_TOKEN',
|
||||||
|
'PUBLIC_REGISTRATION',
|
||||||
|
'WEBSOCKETS_URI',
|
||||||
|
'GRAPHQL_URI',
|
||||||
|
]
|
||||||
const dev = process.env.NODE_ENV !== 'production'
|
const dev = process.env.NODE_ENV !== 'production'
|
||||||
|
|
||||||
const styleguidePath = '../styleguide'
|
const styleguidePath = '../styleguide'
|
||||||
|
|||||||
@ -5,11 +5,12 @@ const fragmentMatcher = new IntrospectionFragmentMatcher({
|
|||||||
introspectionQueryResultData,
|
introspectionQueryResultData,
|
||||||
})
|
})
|
||||||
|
|
||||||
export default ({ app }) => {
|
export default ({ req, nuxtState }) => {
|
||||||
const backendUrl = process.env.GRAPHQL_URI || 'http://localhost:4000'
|
const { env } = req || nuxtState
|
||||||
|
const backendUrl = env.GRAPHQL_URI || 'http://localhost:4000'
|
||||||
|
|
||||||
return {
|
return {
|
||||||
wsEndpoint: process.env.WEBSOCKETS_URI || 'ws://localhost:4000/graphql',
|
wsEndpoint: env.WEBSOCKETS_URI || 'ws://localhost:4000/graphql',
|
||||||
httpEndpoint: process.server ? backendUrl : '/api',
|
httpEndpoint: process.server ? backendUrl : '/api',
|
||||||
httpLinkOptions: {
|
httpLinkOptions: {
|
||||||
credentials: 'same-origin',
|
credentials: 'same-origin',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user