Skip to content

Commit

Permalink
1.0.0-beta-2
Browse files Browse the repository at this point in the history
1.0.0-beta-2
  • Loading branch information
Alexxiia authored Jan 9, 2023
2 parents f9f178a + b2ae77c commit 3e971e7
Show file tree
Hide file tree
Showing 133 changed files with 8,523 additions and 3,619 deletions.
22 changes: 11 additions & 11 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@
"plugin:prettier/recommended",
"plugin:storybook/recommended"
],
"plugins": ["unused-imports", "@ngneat/reactive-forms"],
"plugins": ["@ngneat/reactive-forms"],
"rules": {
"@angular-eslint/no-empty-lifecycle-method": "warn",
"comma-dangle": ["error", "always-multiline"],
"@typescript-eslint/comma-dangle": ["error", "only-multiline"],
"storybook/prefer-pascal-case": "off",
"no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_"
}
],
// "unused-imports/no-unused-imports": "error",
// "unused-imports/no-unused-vars": [
// "warn",
// {
// "vars": "all",
// "varsIgnorePattern": "^_",
// "args": "after-used",
// "argsIgnorePattern": "^_"
// }
// ],
"@ngneat/reactive-forms/no-angular-forms-imports": "error"
}
},
Expand Down
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@
/* ==== Spelling ==== */
/* ================== */
"cSpell.words": [
"auditlog",
"compodoc",
"devkit",
"Donte",
"lcov",
"ngneat",
"protobuf",
Expand Down
23 changes: 18 additions & 5 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@
],
"assets": [
"src/favicon.ico",
"src/assets"
"src/assets",
{
"glob": "**/*",
"input": "node_modules/monaco-editor",
"output": "/assets/monaco/"
}
],
"styles": [
"./node_modules/@angular/material/prebuilt-themes/deeppurple-amber.css",
Expand All @@ -68,7 +73,7 @@
"scripts": []
},
"configurations": {
"prod": {
"production": {
"budgets": [
{
"type": "initial",
Expand Down Expand Up @@ -127,7 +132,13 @@
"vendorChunk": true,
"customWebpackConfig": {
"path": "./cypress/coverage.webpack.ts"
}
},
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.dev.ts"
}
]
}
},
"defaultConfiguration": "production"
Expand Down Expand Up @@ -264,8 +275,10 @@
}
}
},
"defaultProject": "vernite",
"cli": {
"defaultCollection": "@angular-eslint/schematics"
"schematicCollections": [
"@angular-eslint/schematics"
],
"analytics": "7dc2ed6f-e15e-44f8-8497-32ad73c688d3"
}
}
31 changes: 19 additions & 12 deletions cypress/integration/projects.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import auth from '../fixtures/auth.json';

describe('Projects tests', () => {
const rand = Math.random();

before(() => {
cy.logout();
cy.login(auth.email, auth.password);
cy.createWorkspace('Test workspace');
});

beforeEach(() => {
Expand All @@ -14,34 +15,40 @@ describe('Projects tests', () => {
});

it('Should be able to create a new project', () => {
cy.contains('td', 'Test workspace').click();
cy.contains('td', 'test workspace ').click();
cy.contains('New project').click();
cy.get('input[name=name]').type('Test project');
cy.get('input[name=name]').type('Test project ' + rand);
cy.contains('button', 'Create project').click();
});

it('Should not be able to create a new project without name', () => {
cy.contains('td', 'Test workspace').click();
cy.contains('New project').click();
cy.contains('td', 'test workspace').click();
cy.contains('button[type=submit]', 'New project').click();
cy.wait(2000);
cy.contains('button', 'Create project').click();
cy.contains('is required');
});

it('Should be able to edit a project', () => {
cy.contains('td', 'Test workspace').click();
cy.contains('tr', 'Test project').find('.mat-menu-trigger').click();
cy.contains('td', 'test workspace').click();
cy.contains('tr', 'Test project ' + rand)
.find('.mat-menu-trigger')
.click();
cy.contains('Edit').click();
cy.get('input[name=name]').clear().type('Test project - renamed');
cy.get('input[name=name]')
.clear()
.type('Test project - renamed ' + rand);
cy.contains('button', 'Save changes').click();
cy.contains('Test project - renamed');
cy.contains('Test project - renamed ' + rand);
});

it('Should be able to delete a project', () => {
cy.contains('td', 'Test workspace').click();
cy.contains('tr', 'Test project - renamed').find('.mat-menu-trigger').click();
cy.contains('td', 'test workspace').click();
cy.contains('tr', 'Test project - renamed ' + rand)
.find('.mat-menu-trigger')
.click();
cy.contains('Delete').click();
cy.get('.mat-dialog-container').contains('button', 'Delete').click();
cy.contains('Test project - renamed').should('not.exist');
cy.contains('Test project - renamed ' + rand).should('not.exist');
});
});
55 changes: 55 additions & 0 deletions cypress/integration/task.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import auth from '../fixtures/auth.json';

describe('Task tests', () => {
const rand = Math.random();

before(() => {
cy.logout();
cy.login(auth.email, auth.password);
});

beforeEach(() => {
cy.logout();
cy.login(auth.email, auth.password);
cy.visit('/workspaces');
});

it('Should be able to create a new task', () => {
cy.contains('New task').click();
cy.get('app-select[floatingLabel="Project"]').click();
cy.get('app-option').contains('test project').click();
cy.get('input[name=name]').type('Test task ' + rand);
cy.get('button[type=submit]').contains('Create').click();
cy.get('td').contains('test workspace').click();
cy.get('td').contains('test project').click();
cy.contains('Backlog').click();
cy.contains('Test task ' + rand);
});

it('Should be able to edit a task', () => {
cy.get('td').contains('test workspace').click();
cy.get('td').contains('test project').click();
cy.contains('Backlog').click();
cy.contains('.row', 'Test task ' + rand)
.find('.mat-menu-trigger')
.click();
cy.get('button').contains('Edit task').click();
cy.get('input[name=name]')
.clear()
.type('Test task edited ' + rand);
cy.get('button[type=submit]').contains('Save changes').click();
cy.contains('Test task edited ' + rand);
});

it('Should be able to delete a task', () => {
cy.get('td').contains('test workspace').click();
cy.get('td').contains('test project').click();
cy.contains('Backlog').click();
cy.contains('.row', 'Test task edited ' + rand)
.find('.mat-menu-trigger')
.click();
cy.get('button').contains('Delete task').click();
cy.get('button').contains('Delete').click();
cy.contains('Test task edited ' + rand).should('not.exist');
});
});
30 changes: 19 additions & 11 deletions cypress/integration/workspaces.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import auth from '../fixtures/auth.json';

describe('Workspaces tests', () => {
const rand = Math.random();

beforeEach(() => {
cy.logout();
cy.login(auth.email, auth.password);
Expand All @@ -9,29 +11,35 @@ describe('Workspaces tests', () => {

it('Should be able to create a new workspace', () => {
cy.contains('New workspace').click();
cy.get('input[name=name]').type('Test workspace');
cy.get('button[type=submit]').dblclick();
cy.contains('Test workspace');
cy.get('input[name=name]').type('Test workspace ' + rand);
cy.contains('button[type=submit]', 'Save').dblclick();
cy.contains('Test workspace ' + rand);
});

it('Should not be able to create a new workspace without name', () => {
cy.contains('New workspace').click();
cy.get('button[type=submit]').click();
cy.contains('button[type=submit]', 'New workspace').click();
cy.contains('button[type=submit]', 'Save').click();
cy.contains('is required');
});

it('Should be able to edit a workspace', () => {
cy.contains('tr', 'Test workspace').find('.mat-menu-trigger').click();
cy.contains('tr', 'Test workspace ' + rand)
.find('.mat-menu-trigger')
.click();
cy.contains('Edit').click();
cy.get('input[name=name]').clear().type('Test workspace - renamed');
cy.get('button[type=submit]').click();
cy.contains('Test workspace - renamed');
cy.get('input[name=name]')
.clear()
.type('Test workspace - renamed ' + rand);
cy.contains('button[type=submit]', 'Save').click();
cy.contains('Test workspace - renamed ' + rand);
});

it('Should be able to delete a workspace', () => {
cy.contains('tr', 'Test workspace - renamed').find('.mat-menu-trigger').click();
cy.contains('tr', 'Test workspace - renamed ' + rand)
.find('.mat-menu-trigger')
.click();
cy.contains('Delete').click();
cy.get('.mat-dialog-container').contains('button', 'Delete').click();
cy.contains('Test workspace - renamed').should('not.exist');
cy.contains('Test workspace - renamed ' + rand).should('not.exist');
});
});
44 changes: 24 additions & 20 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
declare namespace Cypress {
interface Chainable<Subject = any> {
login(email: string, password: string): typeof login;
logout(): typeof logout;
createWorkspace(name: string): typeof createWorkspace;
createProject(name: string): typeof createProject;
deleteProject(id: number): typeof deleteProject;
deleteWorkspace(id: number): typeof deleteWorkspace;
deleteAllProjectsAndWorkspaces(): typeof deleteAllProjectsAndWorkspaces;
clearUser(email: string, password: string): typeof clearUser;
import { AuthService } from '../../src/app/auth/services/auth/auth.service';

declare global {
namespace Cypress {
// eslint-disable-next-line unused-imports/no-unused-vars
interface Chainable<Subject = any> {
login(email: string, password: string): typeof login;
logout(): typeof logout;
createWorkspace(name: string): typeof createWorkspace;
createProject(name: string): typeof createProject;
deleteProject(id: number): typeof deleteProject;
deleteWorkspace(id: number): typeof deleteWorkspace;
deleteAllProjectsAndWorkspaces(): typeof deleteAllProjectsAndWorkspaces;
clearUser(email: string, password: string): typeof clearUser;
}
}
}

Expand All @@ -16,7 +21,7 @@ function requestWithAuth(
fn?: (response: any) => void,
) {
cy.getCookie('session').then((cookie) => {
const cookieValue = cookie?.value;
const cookieValue = cookie && cookie.value;

cy.request({
method,
Expand All @@ -26,27 +31,26 @@ function requestWithAuth(
Cookie: 'session=' + cookieValue,
},
}).then((res) => {
fn?.(res);
fn && fn(res);
});
});
}

function login(email: string, password: string) {
cy.session([email, password, Math.random()], () => {
cy.request({
method: 'POST',
url: '/api/auth/login',
body: { email, password },
}).then(() => {
localStorage.setItem('logged', 'true');
cy.visit('/login');
cy.window().then((win) => {
const SERVICES = (win as any)['SERVICES'];
const authService = SERVICES.AuthService as AuthService;
authService.login({ email, password, remember: true }).subscribe();
});
cy.wait(2000);
});
}

function logout() {
cy.getCookie('session').then((cookie) => {
const cookieValue = cookie?.value;
const cookieValue = cookie && cookie.value;

if (!cookieValue) return;

Expand All @@ -56,7 +60,7 @@ function logout() {
headers: {
Cookie: 'session=' + cookieValue,
},
}).then((res) => {
}).then(() => {
cy.clearCookies();
cy.clearLocalStorage();
});
Expand Down
Loading

0 comments on commit 3e971e7

Please sign in to comment.