diff --git a/cypress/downloads/downloads.html b/cypress/downloads/downloads.html
new file mode 100644
index 0000000..edeeaf7
Binary files /dev/null and b/cypress/downloads/downloads.html differ
diff --git a/cypress/e2e/workspace.cy.js b/cypress/e2e/workspace.cy.js
index ac33dd8..019e52c 100644
--- a/cypress/e2e/workspace.cy.js
+++ b/cypress/e2e/workspace.cy.js
@@ -15,6 +15,7 @@ import AppPage from '../page/AppPage';
describe('Workspace', () => {
beforeEach(() => {
+ cy.exec('node scripts/seed-database.js');
// Cypress starts out with a blank slate for each test
// so we must tell it to visit our website with the `cy.visit()` command.
// Since we want to visit the same URL at the start of all our tests,
diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts
index 9823d96..e659acb 100644
--- a/cypress/support/commands.ts
+++ b/cypress/support/commands.ts
@@ -8,6 +8,7 @@
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
+/* eslint-disable @typescript-eslint/no-namespace */
import '@testing-library/cypress/add-commands';
@@ -20,30 +21,11 @@ Cypress.Commands.add('login', () => {
}).should('exist');
});
-//
-//
-// -- This is a parent command --
-// Cypress.Commands.add('login', (email, password) => { ... })
-//
-//
-// -- This is a child command --
-// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
-//
-//
-// -- This is a dual command --
-// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
-//
-//
-// -- This will overwrite an existing command --
-// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
-//
-
-/* eslint-disable @typescript-eslint/no-namespace */
-
declare global {
namespace Cypress {
interface Chainable {
login(): Chainable;
+ databaseReset(): Chainable;
}
}
}
diff --git a/package-lock.json b/package-lock.json
index 1e92225..4d82d10 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -68,6 +68,7 @@
"@types/md5": "^2.3.2",
"@types/node": "17.0.14",
"@types/react": "17.0.38",
+ "@types/shelljs": "^0.8.11",
"@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/parser": "^5.36.1",
"@zeit/next-css": "^1.0.1",
@@ -12502,6 +12503,16 @@
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz",
"integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew=="
},
+ "node_modules/@types/shelljs": {
+ "version": "0.8.11",
+ "resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.8.11.tgz",
+ "integrity": "sha512-x9yaMvEh5BEaZKeVQC4vp3l+QoFj3BXcd4aYfuKSzIIyihjdVARAadYy3SMNIz0WCCdS2vB9JL/U6GQk5PaxQw==",
+ "dev": true,
+ "dependencies": {
+ "@types/glob": "*",
+ "@types/node": "*"
+ }
+ },
"node_modules/@types/sinonjs__fake-timers": {
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.1.tgz",
@@ -44146,6 +44157,16 @@
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz",
"integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew=="
},
+ "@types/shelljs": {
+ "version": "0.8.11",
+ "resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.8.11.tgz",
+ "integrity": "sha512-x9yaMvEh5BEaZKeVQC4vp3l+QoFj3BXcd4aYfuKSzIIyihjdVARAadYy3SMNIz0WCCdS2vB9JL/U6GQk5PaxQw==",
+ "dev": true,
+ "requires": {
+ "@types/glob": "*",
+ "@types/node": "*"
+ }
+ },
"@types/sinonjs__fake-timers": {
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.1.tgz",
diff --git a/package.json b/package.json
index f62d6d2..7a2d8a6 100644
--- a/package.json
+++ b/package.json
@@ -89,6 +89,7 @@
"@types/md5": "^2.3.2",
"@types/node": "17.0.14",
"@types/react": "17.0.38",
+ "@types/shelljs": "^0.8.11",
"@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/parser": "^5.36.1",
"@zeit/next-css": "^1.0.1",
diff --git a/scripts/seed-database.js b/scripts/seed-database.js
index 66d4dc2..9794979 100644
--- a/scripts/seed-database.js
+++ b/scripts/seed-database.js
@@ -60,8 +60,40 @@ function splitStringByNotQuotedSemicolon(input) {
}
const main = async () => {
- shell.exec('npm run db:reset -- --force');
- await seedDatabase();
+ // shell.exec('npm run db:reset -- --force');
+ const tablesToEmpty = [
+ 'ProjectMapPosition',
+ 'ProjectMapEdgesSet',
+ 'Issue',
+ 'KeyIssue',
+ 'Project',
+ 'TeamWorkspace',
+ 'TeamUsers',
+ 'Team',
+ 'Workspace',
+ 'Account',
+ 'UserPreference',
+ 'User',
+ ];
+
+ for (let table of tablesToEmpty) {
+ try {
+ console.log(`Deleting table ${table}`);
+ await prisma[table].deleteMany({ where: {} });
+ } catch (err) {
+ console.error(`Error deleting table`);
+ console.error(err);
+ }
+ }
+ try {
+ console.log('Seeding database');
+ await seedDatabase();
+ } catch (err) {
+ console.error('Error seeding database');
+ console.error(err);
+ }
+
+ console.log('Success');
};
main();