diff --git a/cypress/integration/administration/PinPost.feature b/cypress/integration/administration/.PinPost.feature similarity index 100% rename from cypress/integration/administration/PinPost.feature rename to cypress/integration/administration/.PinPost.feature diff --git a/cypress/integration/administration/TagsAndCategories.feature b/cypress/integration/administration/.TagsAndCategories.feature similarity index 100% rename from cypress/integration/administration/TagsAndCategories.feature rename to cypress/integration/administration/.TagsAndCategories.feature diff --git a/cypress/integration/common/admin.js b/cypress/integration/common/.admin.js similarity index 100% rename from cypress/integration/common/admin.js rename to cypress/integration/common/.admin.js diff --git a/cypress/integration/common/post.js b/cypress/integration/common/.post.js similarity index 100% rename from cypress/integration/common/post.js rename to cypress/integration/common/.post.js diff --git a/cypress/integration/common/profile.js b/cypress/integration/common/.profile.js similarity index 100% rename from cypress/integration/common/profile.js rename to cypress/integration/common/.profile.js diff --git a/cypress/integration/common/report.js b/cypress/integration/common/.report.js similarity index 100% rename from cypress/integration/common/report.js rename to cypress/integration/common/.report.js diff --git a/cypress/integration/common/search.js b/cypress/integration/common/.search.js similarity index 100% rename from cypress/integration/common/search.js rename to cypress/integration/common/.search.js diff --git a/cypress/integration/common/settings.js b/cypress/integration/common/.settings.js similarity index 100% rename from cypress/integration/common/settings.js rename to cypress/integration/common/.settings.js diff --git a/cypress/integration/common/steps.js b/cypress/integration/common/.steps.js similarity index 96% rename from cypress/integration/common/steps.js rename to cypress/integration/common/.steps.js index 22a9d016e..8a97a1be2 100644 --- a/cypress/integration/common/steps.js +++ b/cypress/integration/common/.steps.js @@ -13,19 +13,9 @@ import orderBy from 'lodash/orderBy' const languages = orderBy(locales, 'name') let lastPost = {}; -let loginCredentials = { - email: "peterpan@example.org", - password: "1234" -}; const termsAndConditionsAgreedVersion = { termsAndConditionsAgreedVersion: VERSION }; -const narratorParams = { - id: 'id-of-peter-pan', - name: "Peter Pan", - slug: "peter-pan", - ...termsAndConditionsAgreedVersion, -}; const annoyingParams = { email: "spammy-spammer@example.org", @@ -121,10 +111,6 @@ Given("we have the following user accounts:", table => { }); }); -Given("I have a user account", () => { - cy.factory().build("user", narratorParams, loginCredentials); -}); - Given("my user account has the role {string}", role => { cy.factory().build("user", { role, @@ -138,10 +124,6 @@ When("I visit {string}", page => { cy.openPage(page); }); -When("I visit the {string} page", page => { - cy.openPage(page); -}); - When("a blocked user visits the post page of one of my authored posts", () => { cy.logout() cy.neode() @@ -161,10 +143,6 @@ Given("I am on the {string} page", page => { cy.openPage(page); }); -When("I fill in my email and password combination and click submit", () => { - cy.manualLogin(loginCredentials); -}); - When(/(?:when )?I refresh the page/, () => { cy.visit('/') .reload(); diff --git a/cypress/integration/common/when_I_visit_the_{string}_page.js b/cypress/integration/common/when_I_visit_the_{string}_page.js new file mode 100644 index 000000000..336d14b15 --- /dev/null +++ b/cypress/integration/common/when_I_visit_the_{string}_page.js @@ -0,0 +1,5 @@ +import { When } from "cypress-cucumber-preprocessor/steps"; + +When("I visit the {string} page", page => { + cy.openPage(page); +}); \ No newline at end of file diff --git a/cypress/integration/common/when_I_wait_for_{int}_milliseconds.js b/cypress/integration/common/when_I_wait_for_{int}_milliseconds.js new file mode 100644 index 000000000..95d064ed9 --- /dev/null +++ b/cypress/integration/common/when_I_wait_for_{int}_milliseconds.js @@ -0,0 +1,5 @@ +import { When } from "cypress-cucumber-preprocessor/steps"; + +When("I wait for {int} milliseconds", ms => { + cy.wait(ms) +}); \ No newline at end of file diff --git a/cypress/integration/internationalization/Internationalization.feature b/cypress/integration/internationalization/.Internationalization.feature similarity index 100% rename from cypress/integration/internationalization/Internationalization.feature rename to cypress/integration/internationalization/.Internationalization.feature diff --git a/cypress/integration/moderation/HidePosts.feature b/cypress/integration/moderation/.HidePosts.feature similarity index 100% rename from cypress/integration/moderation/HidePosts.feature rename to cypress/integration/moderation/.HidePosts.feature diff --git a/cypress/integration/moderation/ReportContent.feature b/cypress/integration/moderation/.ReportContent.feature similarity index 100% rename from cypress/integration/moderation/ReportContent.feature rename to cypress/integration/moderation/.ReportContent.feature diff --git a/cypress/integration/notifications/Mentions.feature b/cypress/integration/notifications/.Mentions.feature similarity index 100% rename from cypress/integration/notifications/Mentions.feature rename to cypress/integration/notifications/.Mentions.feature diff --git a/cypress/integration/post/Comment.feature b/cypress/integration/post/.Comment.feature similarity index 100% rename from cypress/integration/post/Comment.feature rename to cypress/integration/post/.Comment.feature diff --git a/cypress/integration/post/DeleteImage.feature b/cypress/integration/post/.DeleteImage.feature similarity index 100% rename from cypress/integration/post/DeleteImage.feature rename to cypress/integration/post/.DeleteImage.feature diff --git a/cypress/integration/post/ImageUploader.feature b/cypress/integration/post/.ImageUploader.feature similarity index 100% rename from cypress/integration/post/ImageUploader.feature rename to cypress/integration/post/.ImageUploader.feature diff --git a/cypress/integration/post/PersistentLinks.feature b/cypress/integration/post/.PersistentLinks.feature similarity index 100% rename from cypress/integration/post/PersistentLinks.feature rename to cypress/integration/post/.PersistentLinks.feature diff --git a/cypress/integration/post/WritePost.feature b/cypress/integration/post/.WritePost.feature similarity index 100% rename from cypress/integration/post/WritePost.feature rename to cypress/integration/post/.WritePost.feature diff --git a/cypress/integration/search/Search.feature b/cypress/integration/search/.Search.feature similarity index 100% rename from cypress/integration/search/Search.feature rename to cypress/integration/search/.Search.feature diff --git a/cypress/integration/user_account/ChangePassword.feature b/cypress/integration/user_account/.ChangePassword.feature similarity index 100% rename from cypress/integration/user_account/ChangePassword.feature rename to cypress/integration/user_account/.ChangePassword.feature diff --git a/cypress/integration/user_account/Login.feature b/cypress/integration/user_account/Login.feature deleted file mode 100644 index 6e8f60a56..000000000 --- a/cypress/integration/user_account/Login.feature +++ /dev/null @@ -1,23 +0,0 @@ -Feature: Authentication - As a database administrator - I want users to sign in - In order to attribute posts and other contributions to their authors - - Background: - Given I have a user account - - Scenario: Log in - When I visit the "login" page - And I fill in my email and password combination and click submit - Then I can click on my profile picture in the top right corner - And I can see my name "Peter Lustig" in the dropdown menu - - Scenario: Refresh and stay logged in - Given I am logged in - When I refresh the page - Then I am still logged in - - Scenario: Log out - Given I am logged in - When I log out through the menu in the top right corner - Then I see the login screen again diff --git a/cypress/integration/user_profile/AboutMeAndLocation.feature b/cypress/integration/user_profile/.AboutMeAndLocation.feature similarity index 100% rename from cypress/integration/user_profile/AboutMeAndLocation.feature rename to cypress/integration/user_profile/.AboutMeAndLocation.feature diff --git a/cypress/integration/user_profile/BlockUser.feature b/cypress/integration/user_profile/.BlockUser.feature similarity index 100% rename from cypress/integration/user_profile/BlockUser.feature rename to cypress/integration/user_profile/.BlockUser.feature diff --git a/cypress/integration/user_profile/SocialMedia.feature b/cypress/integration/user_profile/.SocialMedia.feature similarity index 100% rename from cypress/integration/user_profile/SocialMedia.feature rename to cypress/integration/user_profile/.SocialMedia.feature diff --git a/cypress/integration/user_profile/UploadUserProfileImage.feature b/cypress/integration/user_profile/.UploadUserProfileImage.feature similarity index 100% rename from cypress/integration/user_profile/UploadUserProfileImage.feature rename to cypress/integration/user_profile/.UploadUserProfileImage.feature diff --git a/cypress/integration/user_profile/mute-users/Mute.feature b/cypress/integration/user_profile/mute-users/.Mute.feature similarity index 100% rename from cypress/integration/user_profile/mute-users/Mute.feature rename to cypress/integration/user_profile/mute-users/.Mute.feature diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index 1feb2af6a..09939ef2e 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -15,17 +15,14 @@ const cucumber = require('cypress-cucumber-preprocessor').default const dotenv = require('dotenv') +// Import backend .env (smart)? +const { parsed } = dotenv.config({ path: require.resolve('../../backend/.env') }) + module.exports = (on, config) => { - // (on, config) => { - // `on` is used to hook into various events Cypress emits - // `config` is the resolved Cypress config - const { parsed } = dotenv.config({ path: require.resolve('../../backend/.env') }) config.env.NEO4J_URI = parsed.NEO4J_URI config.env.NEO4J_USERNAME = parsed.NEO4J_USERNAME config.env.NEO4J_PASSWORD = parsed.NEO4J_PASSWORD config.env.JWT_SECRET = parsed.JWT_SECRET - // config.baseUrl = 'http://localhost:3000' - // config.chromeWebSecurity = false on('file:preprocessor', cucumber()) return config } diff --git a/cypress/support/commands.js b/cypress/support/commands.js index a15e57007..2d7573dda 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -57,7 +57,7 @@ Cypress.Commands.add("login", user => { .visit("/") }); -Cypress.Commands.add("manualLogin", ({ email, password }) => { +/*Cypress.Commands.add("manualLogin", ({ email, password }) => { cy.visit(`/login`) .get("input[name=email]") .trigger("focus") @@ -68,7 +68,7 @@ Cypress.Commands.add("manualLogin", ({ email, password }) => { .get("button[name=submit]") .as("submitButton") .click(); -}); +});*/ Cypress.Commands.add("logout", () => { cy.visit(`/logout`);