Skip to content

Commit

Permalink
feat: 🔥 remove organization feature
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudTA committed Jan 9, 2025
1 parent 0eaeede commit c416e25
Show file tree
Hide file tree
Showing 81 changed files with 693 additions and 608 deletions.
20 changes: 10 additions & 10 deletions apps/client/cypress/components/specs/repo-form.ct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ describe('RepoForm.vue', () => {

const randomDbSetup = createRandomDbSetup({})
const projectStore = useProjectStore()
projectStore.myProjectsById = {
[randomDbSetup.project.id]: randomDbSetup.project.id,
projectStore.myProjectsBySlug = {
[randomDbSetup.project.slug]: randomDbSetup.project,
}

cy.mount(RepoForm, { props })
Expand Down Expand Up @@ -97,8 +97,8 @@ describe('RepoForm.vue', () => {

const randomDbSetup = createRandomDbSetup({})
const projectStore = useProjectStore()
projectStore.myProjectsById = {
[randomDbSetup.project.id]: randomDbSetup.project.id,
projectStore.myProjectsBySlug = {
[randomDbSetup.project.slug]: randomDbSetup.project,
}

cy.mount(RepoForm, { props })
Expand Down Expand Up @@ -189,8 +189,8 @@ describe('RepoForm.vue', () => {

const randomDbSetup = createRandomDbSetup({})
const projectStore = useProjectStore()
projectStore.myProjectsById = {
[randomDbSetup.project.id]: randomDbSetup.project.id,
projectStore.myProjectsBySlug = {
[randomDbSetup.project.slug]: randomDbSetup.project,
}

cy.mount(RepoForm, { props })
Expand Down Expand Up @@ -236,8 +236,8 @@ describe('RepoForm.vue', () => {

const randomDbSetup = createRandomDbSetup({})
const projectStore = useProjectStore()
projectStore.myProjectsById = {
[randomDbSetup.project.id]: randomDbSetup.project.id,
projectStore.myProjectsBySlug = {
[randomDbSetup.project.slug]: randomDbSetup.project,
}

cy.mount(RepoForm, { props })
Expand Down Expand Up @@ -277,8 +277,8 @@ describe('RepoForm.vue', () => {

const randomDbSetup = createRandomDbSetup({})
const projectStore = useProjectStore()
projectStore.myProjectsById = {
[randomDbSetup.project.id]: randomDbSetup.project.id,
projectStore.myProjectsBySlug = {
[randomDbSetup.project.slug]: randomDbSetup.project,
}

cy.mount(RepoForm, { props })
Expand Down
6 changes: 3 additions & 3 deletions apps/client/cypress/e2e/specs/01-logs.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Project Logs', () => {
cy.intercept('PUT', `/api/v1/projects/${betaapp.id}/hooks`).as('replayHooks')

cy.goToProjects()
cy.getByDataTestid(`projectTile-${betaapp.name}`).click()
cy.getByDataTestid(`projectTile-${betaapp.slug}`).click()
cy.getByDataTestid('displayLogsPanel')
.should('not.be.visible')
cy.getByDataTestid('displayLogsBtn')
Expand Down Expand Up @@ -47,7 +47,7 @@ describe('Project Logs', () => {

// as owner
cy.goToProjects()
cy.getByDataTestid(`projectTile-${betaapp.name}`).click()
cy.getByDataTestid(`projectTile-${betaapp.slug}`).click()
cy.wait('@listLogs')
cy.getByDataTestid('displayLogsPanel')
.should('not.be.visible')
Expand All @@ -68,7 +68,7 @@ describe('Project Logs', () => {

// as member
cy.goToProjects()
cy.getByDataTestid(`projectTile-candilib`).click()
cy.getByDataTestid(`projectTile-mi-candilib`).click()
cy.wait('@listLogs')
cy.getByDataTestid('displayLogsPanel')
.should('not.be.visible')
Expand Down
8 changes: 4 additions & 4 deletions apps/client/cypress/e2e/specs/admin/organizations.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,14 @@ describe('Administration organizations', () => {

cy.getByDataTestid('menuMyProjects').click()
.wait('@listProjects')
cy.getByDataTestid(`projectTile-${projectFailed.name}`)
cy.getByDataTestid(`projectTile-${projectFailed.slug}`)
.click()
cy.getByDataTestid(`${projectFailed.id}-locked-badge`)
.should('exist')

cy.getByDataTestid('menuMyProjects').click()
.wait('@listProjects')
cy.getByDataTestid(`projectTile-${projectSucceed.name}`)
cy.getByDataTestid(`projectTile-${projectSucceed.slug}`)
.click()
cy.getByDataTestid(`${projectSucceed.id}-locked-badge`)
.should('exist')
Expand All @@ -194,13 +194,13 @@ describe('Administration organizations', () => {
cy.getByDataTestid('snackbar').should('contain', `Organisation ${organization.name} mise à jour`)

cy.getByDataTestid('menuMyProjects').click()
cy.getByDataTestid(`projectTile-${projectFailed.name}`)
cy.getByDataTestid(`projectTile-${projectFailed.slug}`)
.click()
cy.getByDataTestid(`${projectFailed.id}-locked-badge`)
.should('not.exist')

cy.getByDataTestid('menuMyProjects').click()
cy.getByDataTestid(`projectTile-${projectSucceed.name}`)
cy.getByDataTestid(`projectTile-${projectSucceed.slug}`)
.click()
cy.getByDataTestid(`${projectSucceed.id}-locked-badge`)
.should('not.exist')
Expand Down
6 changes: 3 additions & 3 deletions apps/client/cypress/e2e/specs/admin/quotas.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ describe('Administration quotas', () => {
cy.kcLogin('test')
cy.goToProjects()
.wait('@listProjects')
.getByDataTestid(`projectTile-${project?.name}`).click()
.getByDataTestid(`projectTile-${project?.slug}`).click()
.getByDataTestid('menuEnvironments').click()
cy.wait('@getClusters')
cy.url().should('contain', '/environments')
Expand Down Expand Up @@ -279,7 +279,7 @@ describe('Administration quotas', () => {
cy.kcLogin('test')
cy.goToProjects()
.wait('@listProjects')
.getByDataTestid(`projectTile-${project?.name}`).click()
.getByDataTestid(`projectTile-${project?.slug}`).click()
.getByDataTestid('menuEnvironments').click()
.url().should('contain', '/environments')
cy.wait('@getClusters')
Expand Down Expand Up @@ -396,7 +396,7 @@ describe('Administration quotas', () => {
cy.kcLogin('test')
cy.goToProjects()
.wait('@listProjects')
.getByDataTestid(`projectTile-${project?.name}`).click()
.getByDataTestid(`projectTile-${project?.slug}`).click()
.getByDataTestid('menuEnvironments').click()
.url().should('contain', '/environments')
cy.wait('@getClusters')
Expand Down
4 changes: 2 additions & 2 deletions apps/client/cypress/e2e/specs/admin/stages.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('Administration stages', () => {
cy.kcLogin('test')
cy.goToProjects()
.wait('@listProjects')
.getByDataTestid(`projectTile-${project?.name}`).click()
.getByDataTestid(`projectTile-${project?.slug}`).click()
.getByDataTestid('menuEnvironments').click()
.url().should('contain', '/environments')
cy.wait('@getClusters')
Expand Down Expand Up @@ -216,7 +216,7 @@ describe('Administration stages', () => {
cy.kcLogin('test')
cy.goToProjects()
.wait('@listProjects')
.getByDataTestid(`projectTile-${project?.name}`).click()
.getByDataTestid(`projectTile-${project?.slug}`).click()
.getByDataTestid('menuEnvironments').click()
.url().should('contain', '/environments')
cy.wait('@getClusters')
Expand Down
14 changes: 8 additions & 6 deletions apps/client/cypress/e2e/specs/create-project.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ const orgMi = organizations.find(({ name }) => name === 'mi') as Organization
describe('Create Project', () => {
const project = {
orgId: orgMi.id,
orgName: orgMi.name,
name: 'project01',
slug: 'mi-project01',
description: 'Application de prise de rendez-vous en préfécture.',
}

Expand Down Expand Up @@ -37,23 +39,23 @@ describe('Create Project', () => {
cy.getByDataTestid('createProjectBtn').should('be.enabled').click()

cy.wait('@postProject').its('response.statusCode').should('match', /^20\d$/)
cy.url().should('match', /projects\/.*\/dashboard/)
cy.url().should('contain', `/projects/${project.orgName}-${project.name}/dashboard`)

cy.wait('@listProjects').its('response.statusCode').should('match', /^20\d$/)

cy.assertCreateProjects([project.name])
cy.assertCreateProjects([project.slug])
})

it('Should not create a project if name is already taken', () => {
it('Should create a project even if name is already taken', () => {
cy.intercept('POST', '/api/v1/projects').as('postProject')
cy.intercept('GET', '/api/v1/projects?filter=member&statusNotIn=archived').as('listProjects')

cy.goToProjects()
.getByDataTestid('createProjectLink').click()
.get('select#organizationId-select').select(project.orgId)
.getByDataTestid('nameInput').type(`${project.name}`)
.getByDataTestid('nameInput').type(project.name)
cy.getByDataTestid('createProjectBtn').should('be.enabled').click()
cy.wait('@postProject').its('response.statusCode').should('not.match', /^20\d$/)
cy.getByDataTestid('snackbar').should('contain', `Le projet "${project.name}" existe déjà`)
cy.wait('@postProject').its('response.statusCode').should('match', /^20\d$/)
cy.url().should('contain', `/projects/${project.orgName}-${project.name}-0/dashboard`)
})
})
16 changes: 8 additions & 8 deletions apps/client/cypress/e2e/specs/dashboard.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Dashboard', () => {
before(() => {
cy.kcLogin('test')

cy.assertCreateProjects([projectToKeep.name, projectCreated.name, projectFailed.name])
cy.assertCreateProjects([projectToKeep.slug, projectCreated.slug, projectFailed.slug])
})

it('Should display project statuses', () => {
Expand All @@ -22,7 +22,7 @@ describe('Dashboard', () => {
cy.kcLogin('test')
projects.forEach((project) => {
cy.goToProjects()
.getByDataTestid(`projectTile-${project.name}`).click()
.getByDataTestid(`projectTile-${project.slug}`).click()
.getByDataTestid('menuDashboard').click()
cy.wait('@listStages')
.getByDataTestid(`${project.id}-${project.status}-badge`)
Expand All @@ -40,7 +40,7 @@ describe('Dashboard', () => {

cy.kcLogin('test')
.goToProjects()
.getByDataTestid(`projectTile-${projectToKeep.name}`).click()
.getByDataTestid(`projectTile-${projectToKeep.slug}`).click()
.getByDataTestid('menuDashboard').click()
cy.wait('@listStages')
.getByDataTestid('setDescriptionBtn').click()
Expand All @@ -65,7 +65,7 @@ describe('Dashboard', () => {
cy.kcLogin('test')

cy.goToProjects()
.getByDataTestid(`projectTile-${projectCreated.name}`).click()
.getByDataTestid(`projectTile-${projectCreated.slug}`).click()
.getByDataTestid('menuDashboard').click()

cy.url().should('contain', 'dashboard')
Expand All @@ -85,7 +85,7 @@ describe('Dashboard', () => {
cy.kcLogin('test')

cy.goToProjects()
.getByDataTestid(`projectTile-${projectCreated.name}`).click()
.getByDataTestid(`projectTile-${projectCreated.slug}`).click()
.getByDataTestid('menuDashboard').click()

cy.url().should('contain', 'dashboard')
Expand All @@ -101,7 +101,7 @@ describe('Dashboard', () => {
cy.kcLogin((user.firstName.slice(0, 1) + user.lastName).toLowerCase())

cy.goToProjects()
.getByDataTestid(`projectTile-${projectCreated.name}`).click()
.getByDataTestid(`projectTile-${projectCreated.slug}`).click()
.getByDataTestid('menuDashboard').click()

cy.url().should('contain', 'dashboard')
Expand All @@ -115,7 +115,7 @@ describe('Dashboard', () => {
cy.kcLogin((user.firstName.slice(0, 1) + user.lastName).toLowerCase())

cy.goToProjects()
.getByDataTestid(`projectTile-${projectCreated.name}`).click()
.getByDataTestid(`projectTile-${projectCreated.slug}`).click()
.getByDataTestid('menuDashboard').click()

cy.url().should('contain', 'dashboard')
Expand All @@ -126,7 +126,7 @@ describe('Dashboard', () => {
it('Should archive project as owner without impacting other projects', () => {
cy.kcLogin('test')
cy.archiveProject(projectToArchive)
cy.assertCreateProjects([projectToKeep.name, projectCreated.name, projectFailed.name])
cy.assertCreateProjects([projectToKeep.slug, projectCreated.slug, projectFailed.slug])
cy.assertAddRepo(projectToKeep, projectToKeep.repositories)
cy.assertUsers(projectToKeep, [owner.email, user.email])
cy.assertAddEnvironment(projectToKeep, projectToKeep.environments, false)
Expand Down
12 changes: 6 additions & 6 deletions apps/client/cypress/e2e/specs/environments.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('Manage project environments', () => {
cy.intercept('GET', '/api/v1/projects?filter=member&statusNotIn=archived').as('listProjects')

cy.goToProjects()
.getByDataTestid(`projectTile-${project0?.name}`).click()
.getByDataTestid(`projectTile-${project0?.slug}`).click()
.getByDataTestid('menuEnvironments').click()
.url().should('contain', '/environments')
cy.wait('@getClusters')
Expand Down Expand Up @@ -97,7 +97,7 @@ describe('Manage project environments', () => {
cy.intercept('GET', 'api/v1/quotas').as('listStages')

cy.goToProjects()
.getByDataTestid(`projectTile-${project0?.name}`)
.getByDataTestid(`projectTile-${project0?.slug}`)
.click()
cy.getByDataTestid('menuEnvironments')
.click()
Expand Down Expand Up @@ -159,7 +159,7 @@ describe('Manage project environments', () => {
cy.intercept('GET', 'api/v1/quotas').as('listStages')

cy.goToProjects()
.getByDataTestid(`projectTile-${project1?.name}`).click()
.getByDataTestid(`projectTile-${project1?.slug}`).click()
.getByDataTestid('menuEnvironments').click()
.url().should('contain', '/environments')
cy.wait('@getClusters')
Expand Down Expand Up @@ -203,7 +203,7 @@ describe('Manage project environments', () => {

cy.kcLogin('test')
cy.goToProjects()
.getByDataTestid(`projectTile-${project1.name}`).click()
.getByDataTestid(`projectTile-${project1.slug}`).click()
.getByDataTestid('menuEnvironments').click()
.url().should('contain', '/environments')
cy.wait('@listEnvironments').its('response.statusCode').should('match', /^20\d$/)
Expand Down Expand Up @@ -254,7 +254,7 @@ describe('Manage project environments', () => {
cy.intercept('GET', '/api/v1/stages').as('listStages')
cy.kcLogin((user.firstName.slice(0, 1) + user.lastName).toLowerCase())
.goToProjects()
.getByDataTestid(`projectTile-${project1.name}`).click()
.getByDataTestid(`projectTile-${project1.slug}`).click()
.getByDataTestid('menuEnvironments').click()
cy.wait('@getClusters')
cy.getByDataTestid(`environmentTile-${project1FirstEnvironment?.name}`)
Expand All @@ -270,7 +270,7 @@ describe('Manage project environments', () => {

cy.kcLogin('test')
cy.goToProjects()
.getByDataTestid(`projectTile-${projectFailed.name}`).click()
.getByDataTestid(`projectTile-${projectFailed.slug}`).click()
.getByDataTestid('menuEnvironments').click()
.url().should('contain', '/environments')
cy.getByDataTestid(`environmentTile-${projectFailed.environments[0].name}`).click()
Expand Down
4 changes: 2 additions & 2 deletions apps/client/cypress/e2e/specs/projects.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ describe('Projects view', () => {
.get('[data-testid^="projectTile-"]')
.should('have.length', `${response?.body.length}`)
})
.getByDataTestid(`projectTile-${project.name}`).click()
.url().should('contain', `projects/${project.id}/dashboard`)
.getByDataTestid(`projectTile-${project.slug}`).click()
.url().should('contain', `projects/${project.slug}/dashboard`)
cy.wait('@listStages')
cy.getByDataTestid('descriptionP')
cy.should('contain', project.description)
Expand Down
12 changes: 6 additions & 6 deletions apps/client/cypress/e2e/specs/redirection.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ describe('Redirection', () => {
cy.wait('@listProjects').its('response').then((response) => {
cy.get('[data-testid^="projectTile-"]')
cy.should('have.length', `${response?.body.length}`)
cy.getByDataTestid(`projectTile-${project.name}`).click()
cy.url().should('contain', `/projects/${project.id}/dashboard`)
cy.getByDataTestid(`projectTile-${project.slug}`).click()
cy.url().should('contain', `/projects/${project.slug}/dashboard`)
})
cy.reload()
cy.wait('@postToken')
cy.url().should('contain', `/projects/${project.id}/dashboard`)
cy.url().should('contain', `/projects/${project.slug}/dashboard`)
cy.wait('@listProjects').its('response').then((_response) => {
cy.getByDataTestid('descriptionP')
cy.should('contain', project.description)
Expand All @@ -36,13 +36,13 @@ describe('Redirection', () => {
cy.intercept('POST', '/realms/cloud-pi-native/protocol/openid-connect/token').as('postToken')
cy.intercept('GET', '/realms/cloud-pi-native/account').as('getAccount')

cy.visit(`/projects/${project.id}/dashboard`)
cy.url().should('not.contain', `/projects/${project.id}/dashboard`)
cy.visit(`/projects/${project.slug}/dashboard`)
cy.url().should('not.contain', `/projects/${project.slug}/dashboard`)
cy.get('input#username').type('test')
cy.get('input#password').type('test')
cy.get('input#kc-login').click()
cy.wait('@postToken')
cy.url().should('contain', `/projects/${project.id}/dashboard`)
cy.url().should('contain', `/projects/${project.slug}/dashboard`)
cy.wait('@listProjects', { timeout: 5_000 }).its('response').then((_response) => {
cy.getByDataTestid('descriptionP')
cy.should('contain', project.description)
Expand Down
Loading

0 comments on commit c416e25

Please sign in to comment.