mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +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 { getLangByName } from "../../support/helpers";
|
||||
import slugify from 'slug'
|
||||
import slugify from "slug";
|
||||
|
||||
/* global cy */
|
||||
|
||||
@ -12,7 +12,7 @@ let loginCredentials = {
|
||||
};
|
||||
const narratorParams = {
|
||||
name: "Peter Pan",
|
||||
slug: 'peter-pan',
|
||||
slug: "peter-pan",
|
||||
avatar: "https://s3.amazonaws.com/uifaces/faces/twitter/nerrsoft/128.jpg",
|
||||
...loginCredentials
|
||||
};
|
||||
@ -174,10 +174,10 @@ When("I press {string}", label => {
|
||||
|
||||
Given("we have the following posts in our database:", table => {
|
||||
table.hashes().forEach(({ Author, ...postAttributes }, i) => {
|
||||
Author = Author || `author-${i}`
|
||||
Author = Author || `author-${i}`;
|
||||
const userAttributes = {
|
||||
name: Author,
|
||||
email: `${slugify(Author, {lower: true})}@example.org`,
|
||||
email: `${slugify(Author, { lower: true })}@example.org`,
|
||||
password: "1234"
|
||||
};
|
||||
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");
|
||||
});
|
||||
|
||||
Given("there is an annoying user called {string}", (name) => {
|
||||
Given("there is an annoying user called {string}", name => {
|
||||
const annoyingParams = {
|
||||
email: 'spammy-spammer@example.org',
|
||||
password: '1234',
|
||||
}
|
||||
cy.factory().create('User', {
|
||||
email: "spammy-spammer@example.org",
|
||||
password: "1234"
|
||||
};
|
||||
cy.factory().create("User", {
|
||||
...annoyingParams,
|
||||
id: 'annoying-user',
|
||||
id: "annoying-user",
|
||||
name
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
Given("I am on the profile page of the annoying user", (name) => {
|
||||
cy.openPage('/profile/annoying-user/spammy-spammer');
|
||||
})
|
||||
Given("I am on the profile page of the annoying user", name => {
|
||||
cy.openPage("/profile/annoying-user/spammy-spammer");
|
||||
});
|
||||
|
||||
When("I visit the profile page of the annoying user", (name) => {
|
||||
cy.openPage('/profile/annoying-user');
|
||||
})
|
||||
When("I visit the profile page of the annoying user", name => {
|
||||
cy.openPage("/profile/annoying-user");
|
||||
});
|
||||
|
||||
When("I ", (name) => {
|
||||
cy.openPage('/profile/annoying-user');
|
||||
})
|
||||
When("I ", name => {
|
||||
cy.openPage("/profile/annoying-user");
|
||||
});
|
||||
|
||||
When("I click on {string} from the content menu in the user info box", (button) => {
|
||||
cy.get('.user-content-menu .content-menu-trigger')
|
||||
.click()
|
||||
cy.get('.popover .ds-menu-item-link')
|
||||
.contains(button)
|
||||
.click()
|
||||
})
|
||||
When(
|
||||
"I click on {string} from the content menu in the user info box",
|
||||
button => {
|
||||
cy.get(".user-content-menu .content-menu-trigger").click();
|
||||
cy.get(".popover .ds-menu-item-link")
|
||||
.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-popover")
|
||||
.find('a[href]').contains("Settings").click()
|
||||
cy.contains('.ds-menu-item-link', settingsPage).click()
|
||||
})
|
||||
.find("a[href]")
|
||||
.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()
|
||||
.first('User', { name }).then((followed) => {
|
||||
.first("User", { name })
|
||||
.then(followed => {
|
||||
cy.neode()
|
||||
.first('User', {name: narratorParams.name})
|
||||
.relateTo(followed, 'following')
|
||||
})
|
||||
})
|
||||
.first("User", { name: narratorParams.name })
|
||||
.relateTo(followed, "following");
|
||||
});
|
||||
});
|
||||
|
||||
Given("\"Spammy Spammer\" wrote a post {string}", (title) => {
|
||||
Given('"Spammy Spammer" wrote a post {string}', title => {
|
||||
cy.factory()
|
||||
.authenticateAs({
|
||||
email: 'spammy-spammer@example.org',
|
||||
password: '1234',
|
||||
email: "spammy-spammer@example.org",
|
||||
password: "1234"
|
||||
})
|
||||
.create("Post", { title })
|
||||
})
|
||||
.create("Post", { title });
|
||||
});
|
||||
|
||||
Then("the list of posts of this user is empty", () => {
|
||||
cy.get('.ds-card-content').not('.post-link')
|
||||
cy.get('.main-container').find('.ds-space.hc-empty')
|
||||
})
|
||||
cy.get(".ds-card-content").not(".post-link");
|
||||
cy.get(".main-container").find(".ds-space.hc-empty");
|
||||
});
|
||||
|
||||
Then("nobody is following the user profile anymore", () => {
|
||||
cy.get('.ds-card-content').not('.post-link')
|
||||
cy.get('.main-container').contains('.ds-card-content', 'is not followed by anyone')
|
||||
})
|
||||
cy.get(".ds-card-content").not(".post-link");
|
||||
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()
|
||||
.authenticateAs(loginCredentials)
|
||||
.create("Post", { title })
|
||||
})
|
||||
.create("Post", { title });
|
||||
});
|
||||
|
||||
When("I block the user {string}", (name) => {
|
||||
When("I block the user {string}", name => {
|
||||
cy.neode()
|
||||
.first('User', { name }).then((blocked) => {
|
||||
.first("User", { name })
|
||||
.then(blocked => {
|
||||
cy.neode()
|
||||
.first('User', {name: narratorParams.name})
|
||||
.relateTo(blocked, 'blocked')
|
||||
})
|
||||
})
|
||||
.first("User", { name: narratorParams.name })
|
||||
.relateTo(blocked, "blocked");
|
||||
});
|
||||
});
|
||||
|
||||
When("I log in with:", (table) => {
|
||||
const [firstRow] = table.hashes()
|
||||
const { Email, Password } = firstRow
|
||||
cy.login({email: Email, password: Password})
|
||||
})
|
||||
When("I log in with:", table => {
|
||||
const [firstRow] = table.hashes();
|
||||
const { Email, Password } = firstRow;
|
||||
cy.login({ email: Email, password: Password });
|
||||
});
|
||||
|
||||
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').contains('.post-link', 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").contains(".post-link", title);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user