-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #475 from cloud-pi-native/develop
Develop
- Loading branch information
Showing
259 changed files
with
7,864 additions
and
5,890 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ node_modules | |
.env.test | ||
.env.prod | ||
.env.int | ||
.env.codespace | ||
|
||
# cypress | ||
screenshots | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
FROM docker.io/cypress/included:12.14.0 | ||
FROM docker.io/cypress/included:12.17.1 | ||
|
||
RUN npm install --location=global pnpm | ||
WORKDIR /app | ||
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml .npmrc ./ | ||
COPY apps/client/package.json ./apps/client/ | ||
COPY apps/client/ ./apps/client/ | ||
COPY packages/shared/ ./packages/shared/ | ||
COPY packages/tsconfig/ ./packages/tsconfig/ | ||
COPY packages/test-utils/ ./packages/test-utils/ | ||
COPY patches/ ./patches/ | ||
RUN pnpm install | ||
RUN pnpm --filter shared run build | ||
ENTRYPOINT [ "pnpm", "--filter", "client", "run" ] | ||
CMD [ "cypress:run" ] |
124 changes: 124 additions & 0 deletions
124
apps/client/cypress/components/specs/cluster-form.ct.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
import VueDsfr from '@gouvminint/vue-dsfr' | ||
import { createPinia } from 'pinia' | ||
import '@gouvfr/dsfr/dist/dsfr.min.css' | ||
import '@gouvfr/dsfr/dist/utility/icons/icons.min.css' | ||
import '@gouvfr/dsfr/dist/utility/utility.main.min.css' | ||
import '@gouvminint/vue-dsfr/styles' | ||
import '@/main.css' | ||
import * as icons from '@/icons.js' | ||
import ClusterForm from '@/components/ClusterForm.vue' | ||
import { getRandomCluster, getRandomProject, repeatFn } from 'test-utils' | ||
import { useSnackbarStore } from '@/stores/snackbar.js' | ||
import { useAdminClusterStore } from '@/stores/admin/cluster.js' | ||
|
||
describe('ClusterForm.vue', () => { | ||
it('Should mount a new cluster ClusterForm', () => { | ||
const pinia = createPinia() | ||
|
||
useSnackbarStore(pinia) | ||
|
||
const allProjects = repeatFn(5)(getRandomProject) | ||
|
||
const props = { | ||
allProjects, | ||
} | ||
|
||
const extensions = { | ||
use: [ | ||
[ | ||
VueDsfr, { icons: Object.values(icons) }, | ||
], | ||
], | ||
global: { | ||
plugins: [pinia], | ||
}, | ||
} | ||
|
||
cy.mount(ClusterForm, { extensions, props }) | ||
cy.getByDataTestid('labelInput') | ||
.find('input') | ||
.type('label') | ||
cy.getByDataTestid('clusterResourcesCbx').find('input[type=checkbox]') | ||
.check({ force: true }) | ||
cy.get('#privacy-select') | ||
.select('dedicated') | ||
cy.get('#multi-select') | ||
.select(`${allProjects[0].organization.name} - ${allProjects[0].name}`) | ||
cy.getByDataTestid('addClusterBtn').should('be.enabled') | ||
}) | ||
|
||
it('Should mount an update cluster ClusterForm', () => { | ||
const pinia = createPinia() | ||
|
||
useSnackbarStore(pinia) | ||
const adminClusterStore = useAdminClusterStore(pinia) | ||
|
||
const allProjects = repeatFn(5)(getRandomProject) | ||
adminClusterStore.clusters = [getRandomCluster([allProjects[0].id])] | ||
|
||
const props = { | ||
cluster: adminClusterStore.clusters[0], | ||
allProjects, | ||
isNewCluster: false, | ||
} | ||
|
||
const extensions = { | ||
use: [ | ||
[ | ||
VueDsfr, { icons: Object.values(icons) }, | ||
], | ||
], | ||
global: { | ||
plugins: [pinia], | ||
}, | ||
} | ||
|
||
cy.mount(ClusterForm, { extensions, props }) | ||
|
||
cy.getByDataTestid('user-json').should('be.visible') | ||
cy.getByDataTestid('cluster-json').should('be.visible') | ||
cy.getByDataTestid('labelInput') | ||
.find('input') | ||
.should('have.value', props.cluster.label) | ||
.and('be.disabled') | ||
cy.getByDataTestid('clusterResourcesCbx').find('input[type=checkbox]') | ||
.should(props.cluster.clusterResources ? 'be.checked' : 'not.be.checked') | ||
cy.get('#privacy-select') | ||
.should('have.value', props.cluster.privacy) | ||
cy.get('#privacy-select') | ||
.select('dedicated') | ||
cy.get('[data-testid$="-tag"]').should('have.length', props.cluster.projectsId.length) | ||
cy.getByDataTestid('updateClusterBtn').should('be.enabled') | ||
}) | ||
|
||
it('Should disable project selector when privacy is public', () => { | ||
const pinia = createPinia() | ||
|
||
useSnackbarStore(pinia) | ||
|
||
const allProjects = repeatFn(5)(getRandomProject) | ||
|
||
const props = { | ||
allProjects, | ||
} | ||
|
||
const extensions = { | ||
use: [ | ||
[ | ||
VueDsfr, { icons: Object.values(icons) }, | ||
], | ||
], | ||
global: { | ||
plugins: [pinia], | ||
}, | ||
} | ||
|
||
cy.mount(ClusterForm, { extensions, props }) | ||
cy.get('#privacy-select') | ||
.select('dedicated') | ||
cy.get('#multi-select').should('be.visible') | ||
cy.get('#privacy-select') | ||
.select('public') | ||
cy.get('#multi-select').should('not.to.exist') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import VueDsfr from '@gouvminint/vue-dsfr' | ||
import '@gouvfr/dsfr/dist/dsfr.min.css' | ||
import '@gouvfr/dsfr/dist/utility/icons/icons.min.css' | ||
import '@gouvfr/dsfr/dist/utility/utility.main.min.css' | ||
import '@gouvminint/vue-dsfr/styles' | ||
import '@/main.css' | ||
import * as icons from '@/icons.js' | ||
import MultiSelector from '@/components/MultiSelector.vue' | ||
|
||
describe('MultiSelector.vue', () => { | ||
it('Should mount a MultiSelector', () => { | ||
const props = { | ||
options: [ | ||
{ | ||
name: 'name1', | ||
id: '1', | ||
}, { | ||
name: 'name2', | ||
id: '2', | ||
}, | ||
], | ||
} | ||
|
||
const extensions = { | ||
use: [ | ||
[ | ||
VueDsfr, { icons: Object.values(icons) }, | ||
], | ||
], | ||
} | ||
|
||
cy.mount(MultiSelector, { extensions, props }) | ||
cy.get('[data-testid$="-tag"]').should('not.exist') | ||
cy.get('option') | ||
.should('have.length', props.options.length + 1) | ||
cy.get('#multi-select') | ||
.select(props.options[1].name) | ||
cy.getByDataTestid(`${props.options[1].name}-tag`) | ||
.should('be.visible') | ||
cy.get('#multi-select') | ||
.select(props.options[0].name) | ||
cy.getByDataTestid(`${props.options[0].name}-tag`) | ||
.should('be.visible') | ||
cy.get('[data-testid$="-tag"]').should('have.length', 2) | ||
cy.getByDataTestid(`${props.options[0].name}-tag`) | ||
.click() | ||
cy.get('[data-testid$="-tag"]').should('have.length', 1) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.