Skip to content

Commit

Permalink
Merge branch 'staging' into sdk-113
Browse files Browse the repository at this point in the history
  • Loading branch information
thelissimus-work committed Feb 26, 2025
2 parents b40407d + 74c4ccc commit 6e44ad9
Show file tree
Hide file tree
Showing 63 changed files with 4,246 additions and 4,642 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ uploads
modules/core/presentation/assets/css/main.min.css
bin/
logs/
migrations/
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ localdb:
clear-localdb:
rm -rf postgres-data/

reset-localdb:
docker compose -f compose.dev.yml down
make clear-localdb
make localdb

migrate:
go run cmd/migrate/main.go $(filter-out $@,$(MAKECMDGOALS))

Expand Down Expand Up @@ -84,10 +89,6 @@ run-iota-linter:
clean-iota-linter:
rm -f bin/iotalinter

# Migration management targets
collect-migrations:
go run cmd/migrate/main.go collect

build-docker-base:
docker buildx build --push --platform linux/amd64,linux/arm64 -t iotauz/sdk:base-$v --target base .

Expand All @@ -98,4 +99,4 @@ build-docker-prod:
%:
@:

.PHONY: default deps test test-watch localdb migrate migrate-down dev css-watch css lint release release-local clean setup build-iota-linter run-iota-linter clean-iota-linter collect-migrations
.PHONY: default deps test test-watch localdb clear-localdb reset-localdb migrate-up migrate-down dev css-watch css lint release release-local clean setup build-iota-linter run-iota-linter clean-iota-linter collect-migrations
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ various industries. Here's what's in the pipeline:

### Upcoming Features

- **HR Management**: Integrate a human resources management module for employee onboarding, payroll, and benefits.
- **HRM**: Integrate a human resources management module for employee onboarding, payroll, and benefits.
- **CRM**: Build a customer relationship management module to streamline client interactions and sales processes.
- **BI-Chat**: Introduce a business intelligence chatbot for real-time data insights and reporting.
- **Password Vault**: Securely store and manage sensitive credentials within the platform.
Expand Down
50 changes: 41 additions & 9 deletions e2e/cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,45 @@
const util = require("node:util");
const cp = require("node:child_process");
const { defineConfig } = require("cypress");
const { Pool } = require("pg");

const exec = util.promisify(cp.exec);
const { env } = process;
const pool = new Pool({
connectionString: `postgres://${env.DB_USER}:${env.DB_PASSWORD}@${env.DB_HOST}:${env.DB_PORT}/${env.DB_NAME}`,
});

async function resetDatabase() {
const client = await pool.connect();
try {
const res = await client.query(
"SELECT tablename FROM pg_tables WHERE schemaname = 'public';",
);
for (const row of res.rows) {
await client.query(`TRUNCATE TABLE ${row.tablename} RESTART IDENTITY CASCADE;`);
}
} finally {
client.release();
}
return null;
}

async function seedDatabase() {
await exec("cd .. && go run cmd/seed/main.go");
return null;
}

module.exports = defineConfig({
e2e: {
defaultCommandTimeout: 15000,
requestTimeout: 20000,
responseTimeout: 20000,
pageLoadTimeout: 60000,
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
e2e: {
defaultCommandTimeout: 15000,
requestTimeout: 20000,
responseTimeout: 20000,
pageLoadTimeout: 60000,
setupNodeEvents(on, config) {
on("task", {
resetDatabase,
seedDatabase,
});
},
},
});
36 changes: 31 additions & 5 deletions e2e/cypress/e2e/users/register.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@ const login = (email, password) => {
};

describe("user auth and registration flow", () => {
before(() => {
cy.task("resetDatabase");
cy.task("seedDatabase");
});

afterEach(() => {
cy.visit("http://localhost:3200/logout");
});

it("creates a user and displays changes in users table", () => {
login("[email protected]", "TestPass123!");
cy.visit("http://localhost:3200/users");
cy.get('a[href="/users/new"]').filter(':visible').click();
cy.get('a[href="/users/new"]').filter(":visible").click();
cy.get("[name=FirstName]").type("Test");
cy.get("[name=LastName]").type("User");
cy.get("[name=MiddleName]").type("Mid");
Expand All @@ -28,10 +33,7 @@ describe("user auth and registration flow", () => {
cy.get("[name=UILanguage]").select(2);
cy.get("[x-ref=trigger]").click();
cy.get("ul[x-ref=list]").should("be.visible");
cy.get("ul[x-ref=list]")
.find("li")
.first()
.click();
cy.get("ul[x-ref=list]").find("li").first().click();
cy.get("[id=save-btn]").click();
cy.visit("http://localhost:3200/users");
cy.get("tbody tr").should("have.length", 2);
Expand All @@ -43,4 +45,28 @@ describe("user auth and registration flow", () => {
cy.url().should("include", "/users");
cy.get("tbody tr").should("have.length", 2);
});

it("edits a user and displays changes in users table", () => {
login("[email protected]", "TestPass123!");
cy.visit("http://localhost:3200/users");

cy.get("tbody tr").contains("td", "Test User").parent("tr").find("td a").click();
cy.url().should("include", "/users/");
cy.get("[name=FirstName]").clear().type("TestNew");
cy.get("[name=LastName]").clear().type("UserNew");
cy.get("[name=MiddleName]").clear().type("MidNew");
cy.get("[name=Email]").clear().type("[email protected]");
cy.get("[name=UILanguage]").select(1);
cy.get("[id=save-btn]").click();

cy.visit("http://localhost:3200/users");
cy.get("tbody tr").should("have.length", 2);
cy.get("tbody tr").should("contain.text", "TestNew UserNew MidNew");
cy.get("tbody tr").should("contain.text", "[email protected]");

cy.visit("http://localhost:3200/logout");
login("[email protected]", "TestPass123!");
cy.visit("http://localhost:3200/users");
cy.url().should("include", "/users");
});
});
3 changes: 2 additions & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"dependencies": {
"cypress": "^13.15.0"
"cypress": "^13.15.0",
"pg": "^8.13.3"
}
}
Loading

0 comments on commit 6e44ad9

Please sign in to comment.