mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Notification.Mention.feature
Regex for URL matches "I am on page ..." Fixed some category/search related errors
This commit is contained in:
parent
61d4107e7b
commit
f8d87a4e98
@ -105,12 +105,12 @@ Factory.define('user')
|
||||
})
|
||||
|
||||
Factory.define('post')
|
||||
.option('categoryIds', [])
|
||||
/*.option('categoryIds', [])
|
||||
.option('categories', ['categoryIds'], (categoryIds) => {
|
||||
if (categoryIds.length) return Promise.all(categoryIds.map((id) => neode.find('Category', id)))
|
||||
// there must be at least one category
|
||||
return Promise.all([Factory.build('category')])
|
||||
})
|
||||
})*/
|
||||
.option('tagIds', [])
|
||||
.option('tags', ['tagIds'], (tagIds) => {
|
||||
return Promise.all(tagIds.map((id) => neode.find('Tag', id)))
|
||||
@ -147,16 +147,16 @@ Factory.define('post')
|
||||
return language || 'en'
|
||||
})
|
||||
.after(async (buildObject, options) => {
|
||||
const [post, author, image, categories, tags] = await Promise.all([
|
||||
const [post, author, image, /*categories,*/ tags] = await Promise.all([
|
||||
neode.create('Post', buildObject),
|
||||
options.author,
|
||||
options.image,
|
||||
options.categories,
|
||||
//options.categories,
|
||||
options.tags,
|
||||
])
|
||||
await Promise.all([
|
||||
post.relateTo(author, 'author'),
|
||||
Promise.all(categories.map((c) => c.relateTo(post, 'post'))),
|
||||
//Promise.all(categories.map((c) => c.relateTo(post, 'post'))),
|
||||
Promise.all(tags.map((t) => t.relateTo(post, 'post'))),
|
||||
])
|
||||
if (image) await post.relateTo(image, 'image')
|
||||
|
||||
@ -348,7 +348,7 @@ export default {
|
||||
undefinedToNull: ['activityId', 'objectId', 'language', 'pinnedAt', 'pinned'],
|
||||
hasMany: {
|
||||
tags: '-[:TAGGED]->(related:Tag)',
|
||||
categories: '-[:CATEGORIZED]->(related:Category)',
|
||||
// categories: '-[:CATEGORIZED]->(related:Category)',
|
||||
comments: '<-[:COMMENTS]-(related:Comment)',
|
||||
shoutedBy: '<-[:SHOUTED]-(related:User)',
|
||||
emotions: '<-[related:EMOTED]',
|
||||
|
||||
28
cypress/integration/Notification.Mention.feature
Normal file
28
cypress/integration/Notification.Mention.feature
Normal file
@ -0,0 +1,28 @@
|
||||
Feature: Notification for a mention
|
||||
As a user
|
||||
I want to be notified if somebody mentions me in a post or comment
|
||||
In order join conversations about or related to me
|
||||
|
||||
Background:
|
||||
Given the following "users" are in the database:
|
||||
| slug | email | password | id | name | termsAndConditionsAgreedVersion |
|
||||
| wolle-aus-hamburg | wolle@example.org | 1234 | wolle | Wolle aus Hamburg | 0.0.4 |
|
||||
| matt-rider | matt@example.org | 4321 | matt | Matt Rider | 0.0.4 |
|
||||
|
||||
Scenario: Mention another user, re-login as this user and see notifications
|
||||
Given I am logged in as "wolle-aus-hamburg"
|
||||
And I navigate to page "landing"
|
||||
And I navigate to page "post/create"
|
||||
And I start to write a new post with the title "Hey Matt" beginning with:
|
||||
"""
|
||||
Big shout to our fellow contributor
|
||||
"""
|
||||
And mention "@matt-rider" in the text
|
||||
And I click on "save button"
|
||||
And I am logged in as "matt-rider"
|
||||
And I navigate to page "landing"
|
||||
And see 1 unread notifications in the top menu
|
||||
And open the notification menu and click on the first item
|
||||
Then I am on page "/post/.*/hey-matt"
|
||||
And the unread counter is removed
|
||||
And the notification menu button links to the all notifications page
|
||||
@ -0,0 +1,8 @@
|
||||
import { When } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
When("I start to write a new post with the title {string} beginning with:", (title, intro) => {
|
||||
cy.get('input[name="title"]')
|
||||
.type(title);
|
||||
cy.get(".ProseMirror")
|
||||
.type(intro);
|
||||
});
|
||||
@ -0,0 +1,9 @@
|
||||
import { When } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
When("mention {string} in the text", mention => {
|
||||
cy.get(".ProseMirror")
|
||||
.type(" @");
|
||||
cy.get(".suggestion-list__item")
|
||||
.contains(mention)
|
||||
.click();
|
||||
});
|
||||
@ -0,0 +1,10 @@
|
||||
import { When } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
When("open the notification menu and click on the first item", () => {
|
||||
cy.get(".notifications-menu")
|
||||
.invoke('show')
|
||||
.click(); // "invoke('show')" because of the delay for show the menu
|
||||
cy.get(".notification .link")
|
||||
.first()
|
||||
.click({force: true});
|
||||
});
|
||||
@ -0,0 +1,6 @@
|
||||
import { Then } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
Then("see {int} unread notifications in the top menu", count => {
|
||||
cy.get(".notifications-menu")
|
||||
.should("contain", count);
|
||||
});
|
||||
@ -0,0 +1,8 @@
|
||||
import { Then } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
Then("the notification menu button links to the all notifications page", () => {
|
||||
cy.get(".notifications-menu")
|
||||
.click();
|
||||
cy.location("pathname")
|
||||
.should("contain", "/notifications");
|
||||
});
|
||||
@ -0,0 +1,6 @@
|
||||
import { Then } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
Then("the unread counter is removed", () => {
|
||||
cy.get('.notifications-menu .counter-icon')
|
||||
.should('not.exist');
|
||||
});
|
||||
@ -20,5 +20,5 @@ Feature: Create a post
|
||||
for active citizenship.
|
||||
"""
|
||||
And I click on "save button"
|
||||
Then I am on page ".../my-first-post"
|
||||
Then I am on page "/post/.*/my-first-post"
|
||||
And the post was saved successfully
|
||||
|
||||
@ -19,7 +19,7 @@ Feature: Upload/Delete images on posts
|
||||
And I add all required fields
|
||||
And I click on "save button"
|
||||
And I wait for 750 milliseconds
|
||||
Then I am on page ".../new-post"
|
||||
Then I am on page "/post/.*/new-post"
|
||||
And I wait for 750 milliseconds
|
||||
And the post was saved successfully with the "new" teaser image
|
||||
|
||||
@ -29,7 +29,7 @@ Feature: Upload/Delete images on posts
|
||||
And I click on "save button"
|
||||
Then I see a toaster with "Saved!"
|
||||
And I wait for 750 milliseconds
|
||||
And I am on page ".../post-to-be-updated"
|
||||
And I am on page "/post/.*/post-to-be-updated"
|
||||
And I wait for 750 milliseconds
|
||||
Then the post was saved successfully with the "updated" teaser image
|
||||
|
||||
@ -46,7 +46,7 @@ Feature: Upload/Delete images on posts
|
||||
And I add all required fields
|
||||
And I click on "save button"
|
||||
And I wait for 750 milliseconds
|
||||
Then I am on page ".../new-post"
|
||||
Then I am on page "/post/.*/new-post"
|
||||
And I wait for 750 milliseconds
|
||||
And the "new" post was saved successfully without a teaser image
|
||||
|
||||
@ -56,6 +56,6 @@ Feature: Upload/Delete images on posts
|
||||
Then I should be able to "remove" a teaser image
|
||||
And I click on "save button"
|
||||
And I wait for 750 milliseconds
|
||||
Then I am on page ".../post-to-be-updated"
|
||||
Then I am on page "/post/.*/post-to-be-updated"
|
||||
And I wait for 750 milliseconds
|
||||
And the "updated" post was saved successfully without a teaser image
|
||||
@ -20,4 +20,4 @@ Feature: See a post
|
||||
Scenario: Navigate to the Post Page
|
||||
When I navigate to page "landing"
|
||||
And I click on "the first post"
|
||||
Then I am on page "post/..."
|
||||
Then I am on page "/post/.*"
|
||||
|
||||
@ -30,7 +30,6 @@ Feature: Search
|
||||
Then I should see the following posts on the search results page:
|
||||
| title |
|
||||
| 101 Essays that will change the way you think |
|
||||
And I wait for 750 milliseconds
|
||||
|
||||
Scenario: Press escape clears search
|
||||
When I type "Ess" and press escape
|
||||
|
||||
@ -185,50 +185,6 @@ Then(
|
||||
}
|
||||
);
|
||||
|
||||
When("open the notification menu and click on the first item", () => {
|
||||
cy.get(".notifications-menu").invoke('show').click(); // "invoke('show')" because of the delay for show the menu
|
||||
cy.get(".notification .link")
|
||||
.first()
|
||||
.click({
|
||||
force: true
|
||||
});
|
||||
});
|
||||
|
||||
Then("see {int} unread notifications in the top menu", count => {
|
||||
cy.get(".notifications-menu").should("contain", count);
|
||||
});
|
||||
|
||||
Then("I get to the post page of {string}", path => {
|
||||
path = path.replace("...", "");
|
||||
cy.url().should("contain", "/post/");
|
||||
cy.url().should("contain", path);
|
||||
});
|
||||
|
||||
When(
|
||||
"I start to write a new post with the title {string} beginning with:",
|
||||
(title, intro) => {
|
||||
cy.get(".post-add-button").click();
|
||||
cy.get('input[name="title"]').type(title);
|
||||
cy.get(".ProseMirror").type(intro);
|
||||
}
|
||||
);
|
||||
|
||||
When("mention {string} in the text", mention => {
|
||||
cy.get(".ProseMirror").type(" @");
|
||||
cy.get(".suggestion-list__item")
|
||||
.contains(mention)
|
||||
.click();
|
||||
});
|
||||
|
||||
Then("the unread counter is removed", () => {
|
||||
cy.get('.notifications-menu .counter-icon').should('not.exist');
|
||||
});
|
||||
|
||||
Then("the notification menu button links to the all notifications page", () => {
|
||||
cy.get(".notifications-menu").click();
|
||||
cy.location("pathname").should("contain", "/notifications");
|
||||
});
|
||||
|
||||
Given("there is an annoying user called {string}", name => {
|
||||
cy.factory().build("user", {
|
||||
id: "annoying-user",
|
||||
|
||||
@ -2,5 +2,5 @@ import { Then } from "cypress-cucumber-preprocessor/steps";
|
||||
|
||||
Then("I am on page {string}", page => {
|
||||
cy.location("pathname")
|
||||
.should("contain", page.replace("...", ""));
|
||||
.should("match", new RegExp(page));
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user