mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Add force true to click on Report User
This commit is contained in:
parent
569ace137b
commit
f12e2a6e16
@ -1,6 +1,6 @@
|
|||||||
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";
|
||||||
|
|
||||||
/* global cy */
|
/* global cy */
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ let loginCredentials = {
|
|||||||
};
|
};
|
||||||
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",
|
||||||
...loginCredentials
|
...loginCredentials
|
||||||
};
|
};
|
||||||
@ -174,10 +174,10 @@ When("I press {string}", label => {
|
|||||||
|
|
||||||
Given("we have the following posts in our database:", table => {
|
Given("we have the following posts in our database:", table => {
|
||||||
table.hashes().forEach(({ Author, ...postAttributes }, i) => {
|
table.hashes().forEach(({ Author, ...postAttributes }, i) => {
|
||||||
Author = Author || `author-${i}`
|
Author = Author || `author-${i}`;
|
||||||
const userAttributes = {
|
const userAttributes = {
|
||||||
name: Author,
|
name: Author,
|
||||||
email: `${slugify(Author, {lower: true})}@example.org`,
|
email: `${slugify(Author, { lower: true })}@example.org`,
|
||||||
password: "1234"
|
password: "1234"
|
||||||
};
|
};
|
||||||
postAttributes.deleted = Boolean(postAttributes.deleted);
|
postAttributes.deleted = Boolean(postAttributes.deleted);
|
||||||
@ -363,95 +363,106 @@ Then("there are no notifications in the top menu", () => {
|
|||||||
cy.get(".notifications-menu").should("contain", "0");
|
cy.get(".notifications-menu").should("contain", "0");
|
||||||
});
|
});
|
||||||
|
|
||||||
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"
|
||||||
}
|
};
|
||||||
cy.factory().create('User', {
|
cy.factory().create("User", {
|
||||||
...annoyingParams,
|
...annoyingParams,
|
||||||
id: 'annoying-user',
|
id: "annoying-user",
|
||||||
name
|
name
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
Given("I am on the profile page of the annoying user", (name) => {
|
Given("I am on the profile page of the annoying user", name => {
|
||||||
cy.openPage('/profile/annoying-user/spammy-spammer');
|
cy.openPage("/profile/annoying-user/spammy-spammer");
|
||||||
})
|
});
|
||||||
|
|
||||||
When("I visit the profile page of the annoying user", (name) => {
|
When("I visit the profile page of the annoying user", name => {
|
||||||
cy.openPage('/profile/annoying-user');
|
cy.openPage("/profile/annoying-user");
|
||||||
})
|
});
|
||||||
|
|
||||||
When("I ", (name) => {
|
When("I ", name => {
|
||||||
cy.openPage('/profile/annoying-user');
|
cy.openPage("/profile/annoying-user");
|
||||||
})
|
});
|
||||||
|
|
||||||
When("I click on {string} from the content menu in the user info box", (button) => {
|
When(
|
||||||
cy.get('.user-content-menu .content-menu-trigger')
|
"I click on {string} from the content menu in the user info box",
|
||||||
.click()
|
button => {
|
||||||
cy.get('.popover .ds-menu-item-link')
|
cy.get(".user-content-menu .content-menu-trigger").click();
|
||||||
.contains(button)
|
cy.get(".popover .ds-menu-item-link")
|
||||||
.click()
|
.contains(button)
|
||||||
})
|
.click({ force: true });
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
When ("I navigate to my {string} settings page", (settingsPage) => {
|
When("I navigate to my {string} settings page", settingsPage => {
|
||||||
cy.get(".avatar-menu").click();
|
cy.get(".avatar-menu").click();
|
||||||
cy.get(".avatar-menu-popover")
|
cy.get(".avatar-menu-popover")
|
||||||
.find('a[href]').contains("Settings").click()
|
.find("a[href]")
|
||||||
cy.contains('.ds-menu-item-link', settingsPage).click()
|
.contains("Settings")
|
||||||
})
|
.click();
|
||||||
|
cy.contains(".ds-menu-item-link", settingsPage).click();
|
||||||
|
});
|
||||||
|
|
||||||
Given("I follow the user {string}", (name) => {
|
Given("I follow the user {string}", name => {
|
||||||
cy.neode()
|
cy.neode()
|
||||||
.first('User', { name }).then((followed) => {
|
.first("User", { name })
|
||||||
|
.then(followed => {
|
||||||
cy.neode()
|
cy.neode()
|
||||||
.first('User', {name: narratorParams.name})
|
.first("User", { name: narratorParams.name })
|
||||||
.relateTo(followed, 'following')
|
.relateTo(followed, "following");
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
Given("\"Spammy Spammer\" wrote a post {string}", (title) => {
|
Given('"Spammy Spammer" wrote a post {string}', title => {
|
||||||
cy.factory()
|
cy.factory()
|
||||||
.authenticateAs({
|
.authenticateAs({
|
||||||
email: 'spammy-spammer@example.org',
|
email: "spammy-spammer@example.org",
|
||||||
password: '1234',
|
password: "1234"
|
||||||
})
|
})
|
||||||
.create("Post", { title })
|
.create("Post", { title });
|
||||||
})
|
});
|
||||||
|
|
||||||
Then("the list of posts of this user is empty", () => {
|
Then("the list of posts of this user is empty", () => {
|
||||||
cy.get('.ds-card-content').not('.post-link')
|
cy.get(".ds-card-content").not(".post-link");
|
||||||
cy.get('.main-container').find('.ds-space.hc-empty')
|
cy.get(".main-container").find(".ds-space.hc-empty");
|
||||||
})
|
});
|
||||||
|
|
||||||
Then("nobody is following the user profile anymore", () => {
|
Then("nobody is following the user profile anymore", () => {
|
||||||
cy.get('.ds-card-content').not('.post-link')
|
cy.get(".ds-card-content").not(".post-link");
|
||||||
cy.get('.main-container').contains('.ds-card-content', 'is not followed by anyone')
|
cy.get(".main-container").contains(
|
||||||
})
|
".ds-card-content",
|
||||||
|
"is not followed by anyone"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
Given("I wrote a post {string}", (title) => {
|
Given("I wrote a post {string}", title => {
|
||||||
cy.factory()
|
cy.factory()
|
||||||
.authenticateAs(loginCredentials)
|
.authenticateAs(loginCredentials)
|
||||||
.create("Post", { title })
|
.create("Post", { title });
|
||||||
})
|
});
|
||||||
|
|
||||||
When("I block the user {string}", (name) => {
|
When("I block the user {string}", name => {
|
||||||
cy.neode()
|
cy.neode()
|
||||||
.first('User', { name }).then((blocked) => {
|
.first("User", { name })
|
||||||
|
.then(blocked => {
|
||||||
cy.neode()
|
cy.neode()
|
||||||
.first('User', {name: narratorParams.name})
|
.first("User", { name: narratorParams.name })
|
||||||
.relateTo(blocked, 'blocked')
|
.relateTo(blocked, "blocked");
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
When("I log in with:", (table) => {
|
When("I log in with:", table => {
|
||||||
const [firstRow] = table.hashes()
|
const [firstRow] = table.hashes();
|
||||||
const { Email, Password } = firstRow
|
const { Email, Password } = firstRow;
|
||||||
cy.login({email: Email, password: Password})
|
cy.login({ email: Email, password: Password });
|
||||||
})
|
});
|
||||||
|
|
||||||
Then("I see only one post with the title {string}", (title) => {
|
Then("I see only one post with the title {string}", title => {
|
||||||
cy.get('.main-container').find('.post-link').should('have.length', 1)
|
cy.get(".main-container")
|
||||||
cy.get('.main-container').contains('.post-link', title)
|
.find(".post-link")
|
||||||
})
|
.should("have.length", 1);
|
||||||
|
cy.get(".main-container").contains(".post-link", title);
|
||||||
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user