diff --git a/cypress/e2e/misc/editor.spec.ts b/cypress/e2e/misc/editor.spec.ts index ac71d3859..0a1b64294 100644 --- a/cypress/e2e/misc/editor.spec.ts +++ b/cypress/e2e/misc/editor.spec.ts @@ -2,7 +2,6 @@ import {createFakeUserAndLogin} from '../../support/authenticateUser' import {TaskFactory} from '../../factories/task' import {ProjectFactory} from '../../factories/project' -import {NamespaceFactory} from '../../factories/namespace' import {UserProjectFactory} from '../../factories/users_project' import {BucketFactory} from '../../factories/bucket' @@ -10,7 +9,6 @@ describe('Editor', () => { createFakeUserAndLogin() beforeEach(() => { - NamespaceFactory.create(1) ProjectFactory.create(1) BucketFactory.create(1) TaskFactory.truncate() diff --git a/cypress/e2e/misc/menu.spec.ts b/cypress/e2e/misc/menu.spec.ts index bb7b3d774..cb37fc7f0 100644 --- a/cypress/e2e/misc/menu.spec.ts +++ b/cypress/e2e/misc/menu.spec.ts @@ -8,20 +8,20 @@ describe('The Menu', () => { }) it('Is visible by default on desktop', () => { - cy.get('.namespace-container') + cy.get('.menu-container') .should('have.class', 'is-active') }) it('Can be hidden on desktop', () => { cy.get('button.menu-show-button:visible') .click() - cy.get('.namespace-container') + cy.get('.menu-container') .should('not.have.class', 'is-active') }) it('Is hidden by default on mobile', () => { cy.viewport('iphone-8') - cy.get('.namespace-container') + cy.get('.menu-container') .should('not.have.class', 'is-active') }) @@ -29,7 +29,7 @@ describe('The Menu', () => { cy.viewport('iphone-8') cy.get('button.menu-show-button:visible') .click() - cy.get('.namespace-container') + cy.get('.menu-container') .should('have.class', 'is-active') }) }) diff --git a/cypress/e2e/project/namespaces.spec.ts b/cypress/e2e/project/namespaces.spec.ts deleted file mode 100644 index 6ce0d8837..000000000 --- a/cypress/e2e/project/namespaces.spec.ts +++ /dev/null @@ -1,145 +0,0 @@ -import {createFakeUserAndLogin} from '../../support/authenticateUser' - -import {ProjectFactory} from '../../factories/project' -import {NamespaceFactory} from '../../factories/namespace' - -describe('Namepaces', () => { - createFakeUserAndLogin() - - let namespaces - - beforeEach(() => { - namespaces = NamespaceFactory.create(1) - ProjectFactory.create(1) - }) - - it('Should be all there', () => { - cy.visit('/namespaces') - cy.get('[data-cy="namespace-title"]') - .should('contain', namespaces[0].title) - }) - - it('Should create a new Namespace', () => { - const newNamespaceTitle = 'New Namespace' - - cy.visit('/namespaces') - cy.get('[data-cy="new-namespace"]') - .should('contain', 'New namespace') - .click() - - cy.url() - .should('contain', '/namespaces/new') - cy.get('.card-header-title') - .should('contain', 'New namespace') - cy.get('input.input') - .type(newNamespaceTitle) - cy.get('.button') - .contains('Create') - .click() - - cy.get('.global-notification') - .should('contain', 'Success') - cy.get('.namespace-container') - .should('contain', newNamespaceTitle) - cy.url() - .should('contain', '/namespaces') - }) - - it('Should rename the namespace all places', () => { - const newNamespaces = NamespaceFactory.create(5) - const newNamespaceName = 'New namespace name' - - cy.visit('/namespaces') - - cy.get(`.namespace-container .menu.namespaces-lists .namespace-title:contains(${newNamespaces[0].title}) .dropdown .dropdown-trigger`) - .click() - cy.get('.namespace-container .menu.namespaces-lists .namespace-title .dropdown .dropdown-content') - .contains('Edit') - .click() - cy.url() - .should('contain', '/settings/edit') - cy.get('#namespacetext') - .invoke('val') - .should('equal', newNamespaces[0].title) // wait until the namespace data is loaded - cy.get('#namespacetext') - .type(`{selectall}${newNamespaceName}`) - cy.get('footer.card-footer .button') - .contains('Save') - .click() - - cy.get('.global-notification', { timeout: 1000 }) - .should('contain', 'Success') - cy.get('.namespace-container .menu.namespaces-lists') - .should('contain', newNamespaceName) - .should('not.contain', newNamespaces[0].title) - cy.get('[data-cy="namespaces-list"]') - .should('contain', newNamespaceName) - .should('not.contain', newNamespaces[0].title) - }) - - it('Should remove a namespace when deleting it', () => { - const newNamespaces = NamespaceFactory.create(5) - - cy.visit('/') - - cy.get(`.namespace-container .menu.namespaces-lists .namespace-title:contains(${newNamespaces[0].title}) .dropdown .dropdown-trigger`) - .click() - cy.get('.namespace-container .menu.namespaces-lists .namespace-title .dropdown .dropdown-content') - .contains('Delete') - .click() - cy.url() - .should('contain', '/settings/delete') - cy.get('[data-cy="modalPrimary"]') - .contains('Do it') - .click() - - cy.get('.global-notification') - .should('contain', 'Success') - cy.get('.namespace-container .menu.namespaces-lists') - .should('not.contain', newNamespaces[0].title) - }) - - it('Should not show archived projects & namespaces if the filter is not checked', () => { - const n = NamespaceFactory.create(1, { - id: 2, - is_archived: true, - }, false) - ProjectFactory.create(1, { - id: 2, - namespace_id: n[0].id, - }, false) - - ProjectFactory.create(1, { - id: 3, - is_archived: true, - }, false) - - // Initial - cy.visit('/namespaces') - cy.get('.namespace') - .should('not.contain', 'Archived') - - // Show archived - cy.get('[data-cy="show-archived-check"] .fancycheckbox__content') - .should('be.visible') - .click() - cy.get('[data-cy="show-archived-check"] input') - .should('be.checked') - cy.get('.namespace') - .should('contain', 'Archived') - - // Don't show archived - cy.get('[data-cy="show-archived-check"] .fancycheckbox__content') - .should('be.visible') - .click() - cy.get('[data-cy="show-archived-check"] input') - .should('not.be.checked') - - // Second time visiting after unchecking - cy.visit('/namespaces') - cy.get('[data-cy="show-archived-check"] input') - .should('not.be.checked') - cy.get('.namespace') - .should('not.contain', 'Archived') - }) -}) diff --git a/cypress/e2e/project/prepareProjects.ts b/cypress/e2e/project/prepareProjects.ts index b3b8952f8..ea7a1b01d 100644 --- a/cypress/e2e/project/prepareProjects.ts +++ b/cypress/e2e/project/prepareProjects.ts @@ -1,9 +1,7 @@ import {ProjectFactory} from '../../factories/project' -import {NamespaceFactory} from '../../factories/namespace' import {TaskFactory} from '../../factories/task' export function createProjects() { - NamespaceFactory.create(1) const projects = ProjectFactory.create(1, { title: 'First Project' }) diff --git a/cypress/e2e/project/project-history.spec.ts b/cypress/e2e/project/project-history.spec.ts index 91ab258c1..ca0cd19d9 100644 --- a/cypress/e2e/project/project-history.spec.ts +++ b/cypress/e2e/project/project-history.spec.ts @@ -8,37 +8,30 @@ describe('Project History', () => { prepareProjects() it('should show a project history on the home page', () => { - cy.intercept(Cypress.env('API_URL') + '/namespaces*').as('loadNamespaces') + cy.intercept(Cypress.env('API_URL') + '/projects*').as('loadProjects') cy.intercept(Cypress.env('API_URL') + '/projects/*').as('loadProject') const projects = ProjectFactory.create(6) cy.visit('/') - cy.wait('@loadNamespaces') + cy.wait('@loadProjects') cy.get('body') .should('not.contain', 'Last viewed') cy.visit(`/projects/${projects[0].id}`) - cy.wait('@loadNamespaces') cy.wait('@loadProject') cy.visit(`/projects/${projects[1].id}`) - cy.wait('@loadNamespaces') cy.wait('@loadProject') cy.visit(`/projects/${projects[2].id}`) - cy.wait('@loadNamespaces') cy.wait('@loadProject') cy.visit(`/projects/${projects[3].id}`) - cy.wait('@loadNamespaces') cy.wait('@loadProject') cy.visit(`/projects/${projects[4].id}`) - cy.wait('@loadNamespaces') cy.wait('@loadProject') cy.visit(`/projects/${projects[5].id}`) - cy.wait('@loadNamespaces') cy.wait('@loadProject') // cy.visit('/') - // cy.wait('@loadNamespaces') // Not using cy.visit here to work around the redirect issue fixed in #1337 cy.get('nav.menu.top-menu a') .contains('Overview') diff --git a/cypress/e2e/project/project-view-list.spec.ts b/cypress/e2e/project/project-view-list.spec.ts index ea4ecd1e7..c325f6824 100644 --- a/cypress/e2e/project/project-view-list.spec.ts +++ b/cypress/e2e/project/project-view-list.spec.ts @@ -58,7 +58,6 @@ describe('Project View Project', () => { }) const projects = ProjectFactory.create(2, { owner_id: '{increment}', - namespace_id: '{increment}', }) cy.visit(`/projects/${projects[1].id}/`) diff --git a/cypress/e2e/project/project.spec.ts b/cypress/e2e/project/project.spec.ts index b89bd9397..3ddccb784 100644 --- a/cypress/e2e/project/project.spec.ts +++ b/cypress/e2e/project/project.spec.ts @@ -10,14 +10,11 @@ describe('Projects', () => { prepareProjects((newProjects) => (projects = newProjects)) it('Should create a new project', () => { - cy.visit('/') - cy.get('.namespace-title .dropdown-trigger') - .click() - cy.get('.namespace-title .dropdown .dropdown-item') - .contains('New project') + cy.visit('/projects') + cy.get('.project-header [data-cy=new-project]') .click() cy.url() - .should('contain', '/projects/new/1') + .should('contain', '/projects/new') cy.get('.card-header-title') .contains('New project') cy.get('input.input') @@ -56,9 +53,9 @@ describe('Projects', () => { cy.get('.project-title') .should('contain', 'First Project') - cy.get('.namespace-container .menu.namespaces-lists .menu-list li:first-child .dropdown .menu-list-dropdown-trigger') + cy.get('.menu-container .menu-list li:first-child .dropdown .menu-list-dropdown-trigger') .click() - cy.get('.namespace-container .menu.namespaces-lists .menu-list li:first-child .dropdown .dropdown-content') + cy.get('.menu-container .menu-list li:first-child .dropdown .dropdown-content') .contains('Edit') .click() cy.get('#title') @@ -72,11 +69,11 @@ describe('Projects', () => { cy.get('.project-title') .should('contain', newProjectName) .should('not.contain', projects[0].title) - cy.get('.namespace-container .menu.namespaces-lists .menu-list li:first-child') + cy.get('.menu-container .menu-list li:first-child') .should('contain', newProjectName) .should('not.contain', projects[0].title) cy.visit('/') - cy.get('.card-content') + cy.get('.project-grid') .should('contain', newProjectName) .should('not.contain', projects[0].title) }) @@ -84,9 +81,9 @@ describe('Projects', () => { it('Should remove a project', () => { cy.visit(`/projects/${projects[0].id}`) - cy.get('.namespace-container .menu.namespaces-lists .menu-list li:first-child .dropdown .menu-list-dropdown-trigger') + cy.get('.menu-container .menu-list li:first-child .dropdown .menu-list-dropdown-trigger') .click() - cy.get('.namespace-container .menu.namespaces-lists .menu-list li:first-child .dropdown .dropdown-content') + cy.get('.menu-container .menu-list li:first-child .dropdown .dropdown-content') .contains('Delete') .click() cy.url() @@ -97,7 +94,7 @@ describe('Projects', () => { cy.get('.global-notification') .should('contain', 'Success') - cy.get('.namespace-container .menu.namespaces-lists .menu-list') + cy.get('.menu-container .menu-list') .should('not.contain', projects[0].title) cy.location('pathname') .should('equal', '/') @@ -116,7 +113,7 @@ describe('Projects', () => { cy.get('.modal-content [data-cy=modalPrimary]') .click() - cy.get('.namespace-container .menu.namespaces-lists .menu-list') + cy.get('.menu-container .menu-list') .should('not.contain', projects[0].title) cy.get('main.app-content') .should('contain.text', 'This project is archived. It is not possible to create new or edit tasks for it.') diff --git a/cypress/e2e/task/overview.spec.ts b/cypress/e2e/task/overview.spec.ts index 6103f7a31..342134b23 100644 --- a/cypress/e2e/task/overview.spec.ts +++ b/cypress/e2e/task/overview.spec.ts @@ -3,12 +3,10 @@ import {createFakeUserAndLogin} from '../../support/authenticateUser' import {ProjectFactory} from '../../factories/project' import {seed} from '../../support/seed' import {TaskFactory} from '../../factories/task' -import {NamespaceFactory} from '../../factories/namespace' import {BucketFactory} from '../../factories/bucket' import {updateUserSettings} from '../../support/updateUserSettings' function seedTasks(numberOfTasks = 50, startDueDate = new Date()) { - NamespaceFactory.create(1) const project = ProjectFactory.create()[0] BucketFactory.create(1, { project_id: project.id, @@ -137,8 +135,7 @@ describe('Home Page Task Overview', () => { cy.visit('/') cy.get('.home.app-content .content') - .should('contain.text', 'You can create a new project for your new tasks:') - .should('contain.text', 'Or import your projects and tasks from other services into Vikunja:') + .should('contain.text', 'Import your projects and tasks from other services into Vikunja:') }) it('Should not show the cta buttons for new project when there are tasks', () => { diff --git a/cypress/e2e/task/task.spec.ts b/cypress/e2e/task/task.spec.ts index 9724bc510..1f6ba034d 100644 --- a/cypress/e2e/task/task.spec.ts +++ b/cypress/e2e/task/task.spec.ts @@ -4,7 +4,6 @@ import {TaskFactory} from '../../factories/task' import {ProjectFactory} from '../../factories/project' import {TaskCommentFactory} from '../../factories/task_comment' import {UserFactory} from '../../factories/user' -import {NamespaceFactory} from '../../factories/namespace' import {UserProjectFactory} from '../../factories/users_project' import {TaskAssigneeFactory} from '../../factories/task_assignee' import {LabelFactory} from '../../factories/labels' @@ -47,13 +46,11 @@ function uploadAttachmentAndVerify(taskId: number) { describe('Task', () => { createFakeUserAndLogin() - let namespaces let projects let buckets beforeEach(() => { // UserFactory.create(1) - namespaces = NamespaceFactory.create(1) projects = ProjectFactory.create(1) buckets = BucketFactory.create(1, { project_id: projects[0].id, @@ -103,7 +100,7 @@ describe('Task', () => { .should('contain', 'Success') }) - it('Can add a task to favorites', () => { + it.only('Can add a task to favorites', () => { TaskFactory.create(1) cy.visit('/projects/1/list') @@ -133,7 +130,6 @@ describe('Task', () => { cy.get('.task-view h1.title.task-id') .should('contain', '#1') cy.get('.task-view h6.subtitle') - .should('contain', namespaces[0].title) .should('contain', projects[0].title) cy.get('.task-view .details.content.description') .should('contain', tasks[0].description) @@ -260,7 +256,6 @@ describe('Task', () => { .click() cy.get('.task-view h6.subtitle') - .should('contain', namespaces[0].title) .should('contain', projects[1].title) cy.get('.global-notification') .should('contain', 'Success') diff --git a/cypress/factories/namespace.ts b/cypress/factories/namespace.ts deleted file mode 100644 index 964faff14..000000000 --- a/cypress/factories/namespace.ts +++ /dev/null @@ -1,18 +0,0 @@ -import {faker} from '@faker-js/faker' -import {Factory} from '../support/factory' - -export class NamespaceFactory extends Factory { - static table = 'namespaces' - - static factory() { - const now = new Date() - - return { - id: '{increment}', - title: faker.lorem.words(3), - owner_id: 1, - created: now.toISOString(), - updated: now.toISOString(), - } - } -} diff --git a/cypress/factories/project.ts b/cypress/factories/project.ts index 6de5d48fc..8068027cb 100644 --- a/cypress/factories/project.ts +++ b/cypress/factories/project.ts @@ -11,7 +11,6 @@ export class ProjectFactory extends Factory { id: '{increment}', title: faker.lorem.words(3), owner_id: 1, - namespace_id: 1, created: now.toISOString(), updated: now.toISOString(), } diff --git a/src/components/home/navigation.vue b/src/components/home/navigation.vue index 3c244f87e..9bfe455b7 100644 --- a/src/components/home/navigation.vue +++ b/src/components/home/navigation.vue @@ -76,7 +76,7 @@ onBeforeMount(async () => { }) const projects = computed(() => Object.values(projectStore.projects) - .filter(p => p.parentProjectId === 0) + .filter(p => p.parentProjectId === 0 && !p.isArchived) .sort((a, b) => a.position < b.position ? -1 : 1))