Fix lint issues
And disable eslint when building in prod mode Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
// https://docs.cypress.io/guides/guides/plugins-guide.html
|
||||
|
||||
// if you need a custom webpack configuration you can uncomment the following import
|
||||
// if you need a custom webpack configuration
|
||||
// you can uncomment the following import
|
||||
// and then use the `file:preprocessor` event
|
||||
// as explained in the cypress docs
|
||||
// https://docs.cypress.io/api/plugins/preprocessors-api.html#Examples
|
||||
|
||||
/* eslint-disable import/no-extraneous-dependencies, global-require, arrow-body-style */
|
||||
// const webpack = require('@cypress/webpack-preprocessor')
|
||||
|
||||
module.exports = (on, config) => {
|
||||
// on('file:preprocessor', webpack({
|
||||
// webpackOptions: require('@vue/cli-service/webpack.config'),
|
||||
|
||||
@@ -6,11 +6,16 @@ describe("Homepage", () => {
|
||||
cy.visit("/", { onBeforeLoad });
|
||||
cy.get("#mobilizon").find("footer").contains("The Mobilizon Contributors");
|
||||
|
||||
cy.contains("About").should("have.attr", "href").and("eq", "https://joinmobilizon.org");
|
||||
cy.contains("About")
|
||||
.should("have.attr", "href")
|
||||
.and("eq", "https://joinmobilizon.org");
|
||||
|
||||
cy.contains("License")
|
||||
.should("have.attr", "href")
|
||||
.and("eq", "https://framagit.org/framasoft/mobilizon/blob/master/LICENSE");
|
||||
.and(
|
||||
"eq",
|
||||
"https://framagit.org/framasoft/mobilizon/blob/master/LICENSE"
|
||||
);
|
||||
});
|
||||
|
||||
it("Tries to register from the hero section", () => {
|
||||
|
||||
@@ -36,13 +36,21 @@ describe("Events", () => {
|
||||
cy.url().should("include", "/events/");
|
||||
cy.contains(".title", EVENT.title);
|
||||
cy.contains(".column.is-3-tablet", "One person going");
|
||||
cy.get(".eventMetadataBlock").eq(1).contains("On Wednesday, September 15, 2021 from");
|
||||
cy.get(".eventMetadataBlock")
|
||||
.eq(1)
|
||||
.contains("On Wednesday, September 15, 2021 from");
|
||||
cy.contains(".column.is-3-tablet", "Public event");
|
||||
|
||||
cy.contains(".navbar-item", "My events").click();
|
||||
cy.contains(".title", EVENT.title);
|
||||
cy.contains(".content.column", "Organized by I'm a test user");
|
||||
cy.contains(".title-wrapper .date-component .datetime-container .month", "Sep");
|
||||
cy.contains(".title-wrapper .date-component .datetime-container .day", "15");
|
||||
cy.contains(
|
||||
".title-wrapper .date-component .datetime-container .month",
|
||||
"Sep"
|
||||
);
|
||||
cy.contains(
|
||||
".title-wrapper .date-component .datetime-container .day",
|
||||
"15"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,7 +11,9 @@ describe("Login", () => {
|
||||
cy.get("form .field").first().contains("label", "Email");
|
||||
cy.get("form .field").last().contains("label", "Password");
|
||||
cy.get("form").contains("button.button", "Login");
|
||||
cy.get("form").contains(".control a.button", "Forgot your password ?").click();
|
||||
cy.get("form")
|
||||
.contains(".control a.button", "Forgot your password ?")
|
||||
.click();
|
||||
cy.url().should("include", "/password-reset/send");
|
||||
cy.go("back");
|
||||
|
||||
@@ -24,17 +26,22 @@ describe("Login", () => {
|
||||
|
||||
it("Tries to login with incorrect credentials", () => {
|
||||
cy.visit("/login", { onBeforeLoad });
|
||||
cy.get("input[type=email]").type("notanemail").should("have.value", "notanemail");
|
||||
cy.get("input[type=email]")
|
||||
.type("notanemail")
|
||||
.should("have.value", "notanemail");
|
||||
cy.get("input[type=password]").click();
|
||||
cy.contains("button.button.is-primary.is-large", "Login").click();
|
||||
// cy.get('form .field').first().contains('p.help.is-danger', '@');
|
||||
// cy.get('form .field').last().contains('p.help.is-danger', 'Please fill out this field.');
|
||||
});
|
||||
|
||||
it("Tries to login with invalid credentials", () => {
|
||||
cy.visit("/login", { onBeforeLoad });
|
||||
cy.get("input[type=email]").type("test@email.com").should("have.value", "test@email.com");
|
||||
cy.get("input[type=password]").type("badPassword").should("have.value", "badPassword");
|
||||
cy.get("input[type=email]")
|
||||
.type("test@email.com")
|
||||
.should("have.value", "test@email.com");
|
||||
cy.get("input[type=password]")
|
||||
.type("badPassword")
|
||||
.should("have.value", "badPassword");
|
||||
cy.contains("button.button.is-primary.is-large", "Login").click();
|
||||
|
||||
cy.contains(
|
||||
@@ -49,7 +56,10 @@ describe("Login", () => {
|
||||
cy.get("input[type=password]").type("some password");
|
||||
cy.get("form").submit();
|
||||
cy.wait(1000);
|
||||
cy.get(".navbar-end .navbar-link span.icon i").should("have.class", "mdi-account-circle");
|
||||
cy.get(".navbar-end .navbar-link span.icon i").should(
|
||||
"have.class",
|
||||
"mdi-account-circle"
|
||||
);
|
||||
cy.contains("article.message.is-info", "Welcome back I'm a test user");
|
||||
cy.get(".navbar-item.has-dropdown").click();
|
||||
cy.get(".navbar-item").last().contains("Log out").click();
|
||||
@@ -94,7 +104,9 @@ describe("Login", () => {
|
||||
.parent()
|
||||
.find("textarea")
|
||||
.type("This shouln't work because it' using a dupublicated username");
|
||||
cy.get(".control.has-text-centered").contains("button", "Create my profile").click();
|
||||
cy.get(".control.has-text-centered")
|
||||
.contains("button", "Create my profile")
|
||||
.click();
|
||||
cy.contains(".help.is-danger", "This username is already taken.");
|
||||
|
||||
cy.get("form .field input").first(0).clear().type("test_user_2");
|
||||
@@ -103,7 +115,13 @@ describe("Login", () => {
|
||||
cy.get("form").submit();
|
||||
cy.wait(1000);
|
||||
|
||||
cy.get(".navbar-link span.icon i").should("have.class", "mdi-account-circle");
|
||||
cy.contains("article.message.is-info", "Welcome to Mobilizon, test_user_2!");
|
||||
cy.get(".navbar-link span.icon i").should(
|
||||
"have.class",
|
||||
"mdi-account-circle"
|
||||
);
|
||||
cy.contains(
|
||||
"article.message.is-info",
|
||||
"Welcome to Mobilizon, test_user_2!"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -10,13 +10,17 @@ describe("Registration", () => {
|
||||
cy.get("input[type=email]").click();
|
||||
cy.get("input[type=password]").type("short").should("have.value", "short");
|
||||
cy.get("form").contains("button.button.is-primary", "Register");
|
||||
// cy.get('form .field').first().contains('p.help.is-danger', 'Please fill out this field.');
|
||||
|
||||
cy.get("form").contains(".control a.button", "Didn't receive the instructions ?").click();
|
||||
cy.get("form")
|
||||
.contains(".control a.button", "Didn't receive the instructions ?")
|
||||
.click();
|
||||
cy.url().should("include", "/resend-instructions");
|
||||
cy.go("back");
|
||||
|
||||
cy.get("form").get(".control a.button").contains("Login").click({ force: true });
|
||||
cy.get("form")
|
||||
.get(".control a.button")
|
||||
.contains("Login")
|
||||
.click({ force: true });
|
||||
cy.url().should("include", "/login");
|
||||
|
||||
cy.go("back");
|
||||
@@ -48,11 +52,14 @@ describe("Registration", () => {
|
||||
.parent()
|
||||
.find("textarea")
|
||||
.type("This is a test account");
|
||||
cy.get(".control.has-text-centered").contains("button", "Create my profile").click();
|
||||
cy.get(".control.has-text-centered")
|
||||
.contains("button", "Create my profile")
|
||||
.click();
|
||||
|
||||
cy.contains("article.message.is-success", "Your account is nearly ready, tester").contains(
|
||||
"A validation email was sent to user2register@email.com"
|
||||
);
|
||||
cy.contains(
|
||||
"article.message.is-success",
|
||||
"Your account is nearly ready, tester"
|
||||
).contains("A validation email was sent to user2register@email.com");
|
||||
|
||||
cy.visit("/sent_emails");
|
||||
|
||||
@@ -74,7 +81,13 @@ describe("Registration", () => {
|
||||
expect(loc.pathname).to.eq("/");
|
||||
});
|
||||
|
||||
cy.get(".navbar-link span.icon i").should("have.class", "mdi-account-circle");
|
||||
cy.contains("article.message.is-info", "Welcome to Mobilizon, tester account!");
|
||||
cy.get(".navbar-link span.icon i").should(
|
||||
"have.class",
|
||||
"mdi-account-circle"
|
||||
);
|
||||
cy.contains(
|
||||
"article.message.is-info",
|
||||
"Welcome to Mobilizon, tester account!"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,11 +14,13 @@
|
||||
//
|
||||
//
|
||||
// -- This is a child command --
|
||||
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
|
||||
// Cypress.Commands.add("drag",
|
||||
// { prevSubject: 'element' }, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a dual command --
|
||||
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
|
||||
// Cypress.Commands.add("dismiss",
|
||||
// { prevSubject: 'optional' }, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is will overwrite an existing command --
|
||||
@@ -104,7 +106,10 @@ const decreaseFetches = () => {
|
||||
Cypress.env("fetchCount", count - 1);
|
||||
};
|
||||
|
||||
const buildTrackableFetchWithSessionId = (fetch) => (fetchUrl, fetchOptions) => {
|
||||
const buildTrackableFetchWithSessionId = (fetch) => (
|
||||
fetchUrl,
|
||||
fetchOptions
|
||||
) => {
|
||||
const { headers } = fetchOptions;
|
||||
const modifiedHeaders = {
|
||||
"x-session-id": Cypress.env("sessionId"),
|
||||
@@ -149,6 +154,8 @@ Cypress.Commands.add("iframeLoaded", { prevSubject: "element" }, ($iframe) => {
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("getInDocument", { prevSubject: "document" }, (document, selector) =>
|
||||
Cypress.$(selector, document)
|
||||
Cypress.Commands.add(
|
||||
"getInDocument",
|
||||
{ prevSubject: "document" },
|
||||
(document, selector) => Cypress.$(selector, document)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user