mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
Adaptation of Cypress tests, first attempt
This commit is contained in:
parent
c09e9a0149
commit
f28ff69f3a
@ -24,7 +24,7 @@ type User {
|
|||||||
createdAt: String
|
createdAt: String
|
||||||
updatedAt: String
|
updatedAt: String
|
||||||
|
|
||||||
termsAndConditionsAgreedVersion: String!
|
termsAndConditionsAgreedVersion: String
|
||||||
|
|
||||||
notifications(read: Boolean): [Notification]! @relation(name: "NOTIFIED", direction: "IN")
|
notifications(read: Boolean): [Notification]! @relation(name: "NOTIFIED", direction: "IN")
|
||||||
|
|
||||||
|
|||||||
@ -3,4 +3,4 @@
|
|||||||
"NEO4J_URI": "bolt://localhost:7687",
|
"NEO4J_URI": "bolt://localhost:7687",
|
||||||
"NEO4J_USERNAME": "neo4j",
|
"NEO4J_USERNAME": "neo4j",
|
||||||
"NEO4J_PASSWORD": "letmein"
|
"NEO4J_PASSWORD": "letmein"
|
||||||
}
|
}
|
||||||
@ -31,6 +31,7 @@ Given('I am logged in with a {string} role', role => {
|
|||||||
cy.factory().create('User', {
|
cy.factory().create('User', {
|
||||||
email: `${role}@example.org`,
|
email: `${role}@example.org`,
|
||||||
password: '1234',
|
password: '1234',
|
||||||
|
termsAndConditionsAgreedVersion: "0.0.2",
|
||||||
role
|
role
|
||||||
})
|
})
|
||||||
cy.login({
|
cy.login({
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { Given, When, Then } from "cypress-cucumber-preprocessor/steps";
|
import { Given, When, Then } from "cypress-cucumber-preprocessor/steps";
|
||||||
import { getLangByName } from "../../support/helpers";
|
import { getLangByName } from "../../support/helpers";
|
||||||
import slugify from "slug";
|
import slugify from "slug";
|
||||||
|
// import { VERSION } from '../../../webapp/pages/terms-and-conditions.vue';
|
||||||
|
|
||||||
/* global cy */
|
/* global cy */
|
||||||
|
|
||||||
@ -10,13 +11,18 @@ let loginCredentials = {
|
|||||||
email: "peterpan@example.org",
|
email: "peterpan@example.org",
|
||||||
password: "1234"
|
password: "1234"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const termsAndConditionsAgreedVersion = { termsAndConditionsAgreedVersion: "0.0.2" };
|
||||||
|
|
||||||
const narratorParams = {
|
const narratorParams = {
|
||||||
name: "Peter Pan",
|
name: "Peter Pan",
|
||||||
slug: "peter-pan",
|
slug: "peter-pan",
|
||||||
avatar: "https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg",
|
avatar: "https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg",
|
||||||
|
...termsAndConditionsAgreedVersion,
|
||||||
...loginCredentials
|
...loginCredentials
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Given("I am logged in", () => {
|
Given("I am logged in", () => {
|
||||||
cy.login(loginCredentials);
|
cy.login(loginCredentials);
|
||||||
});
|
});
|
||||||
@ -35,12 +41,14 @@ Given("we have a selection of tags and categories as well as posts", () => {
|
|||||||
const someAuthor = {
|
const someAuthor = {
|
||||||
id: "authorId",
|
id: "authorId",
|
||||||
email: "author@example.org",
|
email: "author@example.org",
|
||||||
password: "1234"
|
password: "1234",
|
||||||
|
...termsAndConditionsAgreedVersion
|
||||||
};
|
};
|
||||||
const yetAnotherAuthor = {
|
const yetAnotherAuthor = {
|
||||||
id: "yetAnotherAuthor",
|
id: "yetAnotherAuthor",
|
||||||
email: "yet-another-author@example.org",
|
email: "yet-another-author@example.org",
|
||||||
password: "1234"
|
password: "1234",
|
||||||
|
...termsAndConditionsAgreedVersion
|
||||||
};
|
};
|
||||||
cy.factory()
|
cy.factory()
|
||||||
.create("User", someAuthor)
|
.create("User", someAuthor)
|
||||||
@ -66,7 +74,7 @@ Given("we have a selection of tags and categories as well as posts", () => {
|
|||||||
|
|
||||||
Given("we have the following user accounts:", table => {
|
Given("we have the following user accounts:", table => {
|
||||||
table.hashes().forEach(params => {
|
table.hashes().forEach(params => {
|
||||||
cy.factory().create("User", params);
|
cy.factory().create("User", { ...params, ...termsAndConditionsAgreedVersion });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -77,6 +85,7 @@ Given("I have a user account", () => {
|
|||||||
Given("my user account has the role {string}", role => {
|
Given("my user account has the role {string}", role => {
|
||||||
cy.factory().create("User", {
|
cy.factory().create("User", {
|
||||||
role,
|
role,
|
||||||
|
...termsAndConditionsAgreedVersion,
|
||||||
...loginCredentials
|
...loginCredentials
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -182,7 +191,8 @@ Given("we have the following posts in our database:", table => {
|
|||||||
const moderatorParams = {
|
const moderatorParams = {
|
||||||
email: "moderator@example.org",
|
email: "moderator@example.org",
|
||||||
role: "moderator",
|
role: "moderator",
|
||||||
password: "1234"
|
password: "1234",
|
||||||
|
termsAndConditionsAgreedVersion: '0.0.2',
|
||||||
};
|
};
|
||||||
cy.factory()
|
cy.factory()
|
||||||
.create("User", moderatorParams)
|
.create("User", moderatorParams)
|
||||||
@ -269,8 +279,7 @@ Then(
|
|||||||
|
|
||||||
Given("my user account has the following login credentials:", table => {
|
Given("my user account has the following login credentials:", table => {
|
||||||
loginCredentials = table.hashes()[0];
|
loginCredentials = table.hashes()[0];
|
||||||
cy.debug();
|
cy.factory().create("User", { ...termsAndConditionsAgreedVersion, ...loginCredentials });
|
||||||
cy.factory().create("User", loginCredentials);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
When("I fill the password form with:", table => {
|
When("I fill the password form with:", table => {
|
||||||
@ -367,12 +376,14 @@ Then("there are no notifications in the top menu", () => {
|
|||||||
Given("there is an annoying user called {string}", name => {
|
Given("there is an annoying user called {string}", name => {
|
||||||
const annoyingParams = {
|
const annoyingParams = {
|
||||||
email: "spammy-spammer@example.org",
|
email: "spammy-spammer@example.org",
|
||||||
password: "1234"
|
password: "1234",
|
||||||
|
...termsAndConditionsAgreedVersion
|
||||||
};
|
};
|
||||||
cy.factory().create("User", {
|
cy.factory().create("User", {
|
||||||
...annoyingParams,
|
...annoyingParams,
|
||||||
id: "annoying-user",
|
id: "annoying-user",
|
||||||
name
|
name,
|
||||||
|
...termsAndConditionsAgreedVersion
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user