Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ module.exports = defineConfig({
},
e2e: {
baseUrl: "http://localhost:3000",
specPattern: "cypress/tests/**/*.spec.{js,jsx,ts,tsx}",
specPattern: "cypress/tests/**/*.cy.{js,jsx,ts,tsx}",
supportFile: "cypress/support/e2e.ts",
viewportHeight: 1000,
viewportWidth: 1280,
viewportHeight: 500,
viewportWidth: 500,
experimentalRunAllSpecs: true,
experimentalStudio: true,
setupNodeEvents(on, config) {
Expand Down
12 changes: 6 additions & 6 deletions cypress/fixtures/public-transactions.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"source": "GYDJUNEaOK7",
"status": "complete",
"uuid": "41754166-ea5b-448a-9a8a-374ce387c714",
"receiverName": "Kevin",
"senderName": "Amir",
"receiverName": "Leila",
"senderName": "Mateo",
"likes": [],
"comments": []
},
Expand All @@ -41,8 +41,8 @@
"source": "GYDJUNEaOK7",
"status": "complete",
"uuid": "5cdc1625-c937-4ac5-a6ac-eb5c55e93576",
"receiverName": "Kevin",
"senderName": "Amir",
"receiverName": "Leila",
"senderName": "Mateo",
"likes": [],
"comments": []
},
Expand All @@ -61,8 +61,8 @@
"source": "GYDJUNEaOK7",
"status": "pending",
"uuid": "da9bcbd6-df80-4499-87ba-9a29927ea0c7",
"receiverName": "Kevin",
"senderName": "Amir",
"receiverName": "Leila",
"senderName": "Mateo",
"likes": [],
"comments": []
}
Expand Down
128 changes: 64 additions & 64 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,24 @@ Cypress.Commands.add("getBySelLike", (selector, ...args) => {

Cypress.Commands.add("login", (username, password, { rememberUser = false } = {}) => {
const signinPath = "/signin";
const log = Cypress.log({
name: "login",
displayName: "LOGIN",
message: [`🔐 Authenticating | ${username}`],
// @ts-ignore
autoEnd: false,
});
// const log = Cypress.log({
// name: "login",
// displayName: "LOGIN",
// message: [`🔐 Authenticating | ${username}`],
// // @ts-ignore
// autoEnd: false,
// });

cy.intercept("POST", "/login").as("loginUser");
cy.intercept("GET", "checkAuth").as("getUserProfile");
// cy.intercept("POST", "/login").as("loginUser");
// cy.intercept("GET", "checkAuth").as("getUserProfile");

cy.location("pathname", { log: false }).then((currentPath) => {
if (currentPath !== signinPath) {
cy.visit(signinPath);
}
});

log.snapshot("before");
// log.snapshot("before");

cy.getBySel("signin-username").type(username);
cy.getBySel("signin-password").type(password);
Expand All @@ -68,21 +68,21 @@ Cypress.Commands.add("login", (username, password, { rememberUser = false } = {}
}

cy.getBySel("signin-submit").click();
cy.wait("@loginUser").then((loginUser: any) => {
log.set({
consoleProps() {
return {
username,
password,
rememberUser,
userId: loginUser.response.statusCode !== 401 && loginUser.response.body.user.id,
};
},
});

log.snapshot("after");
log.end();
});
// cy.wait("@loginUser").then((loginUser: any) => {
// // log.set({
// // consoleProps() {
// // return {
// // username,
// // password,
// // rememberUser,
// // userId: loginUser.response.statusCode !== 401 && loginUser.response.body.user.id,
// // };
// // },
// // });

// // log.snapshot("after");
// // log.end();
// });
});

Cypress.Commands.add("loginByApi", (username, password = Cypress.env("defaultPassword")) => {
Expand Down Expand Up @@ -128,41 +128,41 @@ Cypress.Commands.add("setTransactionAmountRange", (min, max) => {
});

Cypress.Commands.add("loginByXstate", (username, password = Cypress.env("defaultPassword")) => {
const log = Cypress.log({
name: "loginbyxstate",
displayName: "LOGIN BY XSTATE",
message: [`🔐 Authenticating | ${username}`],
autoEnd: false,
});
// const log = Cypress.log({
// name: "loginbyxstate",
// displayName: "LOGIN BY XSTATE",
// message: [`🔐 Authenticating | ${username}`],
// autoEnd: false,
// });

cy.intercept("POST", "/login").as("loginUser");
cy.intercept("GET", "/checkAuth").as("getUserProfile");
cy.visit("/signin", { log: false }).then(() => {
log.snapshot("before");
// log.snapshot("before");
});

cy.window({ log: false }).then((win) => win.authService.send("LOGIN", { username, password }));

cy.wait("@loginUser").then((loginUser) => {
log.set({
consoleProps() {
return {
username,
password,
// @ts-ignore
userId: loginUser.response.body.user.id,
};
},
});
});

return cy
.getBySel("list-skeleton")
.should("not.exist")
.then(() => {
log.snapshot("after");
log.end();
});
// cy.wait("@loginUser").then((loginUser) => {
// // log.set({
// // consoleProps() {
// // return {
// // username,
// // password,
// // // @ts-ignore
// // userId: loginUser.response.body.user.id,
// // };
// // },
// // });
// });

// return cy
// .getBySel("list-skeleton")
// .should("not.exist")
// .then(() => {
// // log.snapshot("after");
// // log.end();
// });
});

Cypress.Commands.add("logoutByXstate", () => {
Expand Down Expand Up @@ -307,20 +307,20 @@ Cypress.Commands.add("database", (operation, entity, query, logTask = false) =>
query,
};

const log = Cypress.log({
name: "database",
displayName: "DATABASE",
message: [`🔎 ${operation}ing within ${entity} data`],
// @ts-ignore
autoEnd: false,
consoleProps() {
return params;
},
});
// const log = Cypress.log({
// name: "database",
// displayName: "DATABASE",
// message: [`🔎 ${operation}ing within ${entity} data`],
// // @ts-ignore
// autoEnd: false,
// consoleProps() {
// return params;
// },
// });

return cy.task(`${operation}:database`, params, { log: logTask }).then((data) => {
log.snapshot();
log.end();
// log.snapshot();
// log.end();
return data;
});
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/tests/api/api-bankaccounts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("Bank Accounts API", function () {
});

beforeEach(function () {
cy.task("db:seed");
cy.task("db:seed", {log: false});

cy.database("filter", "users").then((users: User[]) => {
ctx.authenticatedUser = users[0];
Expand Down
Loading
Loading