diff --git a/package.json b/package.json index aa62fb79a27..8a1431f2b4e 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,8 @@ "scripts": { "build": "vue-tsc -p tsconfig.build.json --noEmit && vite build --emptyOutDir && tikui-core build", "dev": "npm run tikui:serve & npm run webapp:serve", - "e2e": "cypress open --config-file src/test/webapp/cypress/cypress-config.ts", - "e2e:headless": "cypress run --headless --config-file src/test/webapp/cypress/cypress-config.ts", + "e2e": "cypress open --config-file src/test/webapp/e2e/cypress-config.ts", + "e2e:headless": "cypress run --headless --config-file src/test/webapp/e2e/cypress-config.ts", "format": "prettier . --write", "glyph:build": "rimraf .fontello-session && fontello-cli install --config src/main/glyph/config.json --font src/main/glyph/font --css src/main/glyph/css", "glyph:open": "rimraf .fontello-session && fontello-cli open --config src/main/glyph/config.json", diff --git a/src/test/webapp/cypress/cypress-config.ts b/src/test/webapp/cypress/cypress-config.ts deleted file mode 100644 index cd9b501b137..00000000000 --- a/src/test/webapp/cypress/cypress-config.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { defineConfig } from 'cypress'; - -export default defineConfig({ - e2e: { - baseUrl: 'http://localhost:7471', - specPattern: 'src/test/webapp/cypress/integration/**/*.spec.ts', - fixturesFolder: 'src/test/webapp/cypress/fixtures', - supportFolder: 'src/test/webapp/cypress/support', - supportFile: false, - video: false, - }, -}); diff --git a/src/test/webapp/cypress/integration/Patch.spec.ts b/src/test/webapp/cypress/integration/Patch.spec.ts deleted file mode 100644 index b2e6aaf81da..00000000000 --- a/src/test/webapp/cypress/integration/Patch.spec.ts +++ /dev/null @@ -1,112 +0,0 @@ -import { dataSelector } from '../support/selector'; -import { interceptForever } from '../support/Interceptor'; - -describe('Patch', () => { - describe('E2E', () => { - it('should display modules', () => { - cy.visit('/patches'); - - cy.get(dataSelector('modules-list')).should('be.visible'); - }); - }); - - describe('Component', () => { - beforeEach(() => cy.intercept({ path: '/api/project-folders' }, { body: '/tmp/jhlite/1234' })); - - it('should display loader while loading modules', () => { - const result = interceptForever({ path: '/api/modules' }, { fixture: 'modules.json' }); - - cy.visit('/patches'); - - cy.get(dataSelector('modules-loader')) - .should('be.visible') - .then(() => { - result.send(); - - cy.get(dataSelector('modules-loader')).should('not.exist'); - cy.get(dataSelector('modules-list')).should('be.visible'); - cy.get(dataSelector('module-spring-test-application-button')).should('be.enabled'); - cy.get(dataSelector('module-spring-cucumber-application-button')).should('be.enabled'); - cy.get(dataSelector('folder-path-field')).invoke('val').should('equal', '/tmp/jhlite/1234'); - }); - }); - - it('should change theme after toggle switch theme button', () => { - cy.visit('/patches', { - onBeforeLoad(win) { - cy.stub(win, 'matchMedia').withArgs('(prefers-color-scheme: dark)').returns({ matches: true }); - }, - }); - - const themeSwitchButton = dataSelector('theme-switch-button'); - - cy.get(themeSwitchButton).should('exist').should('not.be.visible').should('not.be.checked'); - cy.get('[aria-label="dark-theme"]').should('exist'); - - cy.get(themeSwitchButton).click({ force: true }); - cy.get(themeSwitchButton).should('be.checked'); - cy.get('[aria-label="light-theme"]').should('exist'); - - cy.get(themeSwitchButton).click({ force: true }); - cy.get(themeSwitchButton).should('not.be.checked'); - cy.get('[aria-label="dark-theme"]').should('exist'); - }); - - it('should apply module without properties', () => { - cy.intercept({ path: '/api/modules' }, { fixture: 'modules.json' }); - - cy.intercept({ - path: '/api/modules/spring-test/apply-patch', - method: 'POST', - }).as('spring-test-creation'); - - cy.visit('/patches'); - cy.get(dataSelector('folder-path-field')).clear(); - cy.get(dataSelector('folder-path-field')).type('test'); - cy.get(dataSelector('module-spring-test-application-button')).click(); - - cy.wait('@spring-test-creation').should(xhr => { - const body = xhr.request.body; - - expect(body).to.deep.equal({ - projectFolder: 'test', - commit: true, - parameters: {}, - }); - }); - }); - - it('should apply module with properties', () => { - cy.intercept({ path: '/api/modules' }, { fixture: 'modules.json' }); - - cy.intercept({ - path: '/api/modules/spring-cucumber/apply-patch', - method: 'POST', - }).as('spring-cucumber-creation'); - - cy.visit('/patches'); - - cy.get(dataSelector('spring-cucumber-module-content')).click(); - cy.get(dataSelector('folder-path-field')).clear(); - cy.get(dataSelector('folder-path-field')).type('test'); - cy.get(dataSelector('parameter-baseName-field')).type('jhipster'); - cy.get(dataSelector('parameter-optionalBoolean-field')).select('true'); - cy.get(dataSelector('parameter-optionalInteger-field')).type('42'); - cy.get(dataSelector('module-spring-cucumber-application-button')).click(); - - cy.wait('@spring-cucumber-creation').should(xhr => { - const body = xhr.request.body; - - expect(body).to.deep.equal({ - projectFolder: 'test', - commit: true, - parameters: { - baseName: 'jhipster', - optionalBoolean: true, - optionalInteger: 42, - }, - }); - }); - }); - }); -}); diff --git a/src/test/webapp/cypress/.eslintrc.cjs b/src/test/webapp/e2e/.eslintrc.cjs similarity index 100% rename from src/test/webapp/cypress/.eslintrc.cjs rename to src/test/webapp/e2e/.eslintrc.cjs diff --git a/src/test/webapp/e2e/cypress-config.ts b/src/test/webapp/e2e/cypress-config.ts new file mode 100644 index 00000000000..43600759d76 --- /dev/null +++ b/src/test/webapp/e2e/cypress-config.ts @@ -0,0 +1,12 @@ +import { defineConfig } from 'cypress'; + +export default defineConfig({ + e2e: { + baseUrl: 'http://localhost:7471', + specPattern: 'src/test/webapp/e2e/integration/**/*.spec.ts', + fixturesFolder: 'src/test/e2e/cypress/fixtures', + supportFolder: 'src/test/e2e/cypress/support', + supportFile: false, + video: false, + }, +}); diff --git a/src/test/webapp/e2e/integration/Patch.spec.ts b/src/test/webapp/e2e/integration/Patch.spec.ts new file mode 100644 index 00000000000..24d484d6cd8 --- /dev/null +++ b/src/test/webapp/e2e/integration/Patch.spec.ts @@ -0,0 +1,9 @@ +import { dataSelector } from '../support/selector'; + +describe('Patch', () => { + it('should display modules', () => { + cy.visit('/patches'); + + cy.get(dataSelector('modules-list')).should('be.visible'); + }); +}); diff --git a/src/test/webapp/cypress/support/selector.ts b/src/test/webapp/e2e/support/selector.ts similarity index 100% rename from src/test/webapp/cypress/support/selector.ts rename to src/test/webapp/e2e/support/selector.ts diff --git a/src/test/webapp/cypress/tsconfig.json b/src/test/webapp/e2e/tsconfig.json similarity index 100% rename from src/test/webapp/cypress/tsconfig.json rename to src/test/webapp/e2e/tsconfig.json diff --git a/tsconfig.json b/tsconfig.json index 226911d45de..51458088e8c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,5 +23,5 @@ "src/main/webapp/**/*.vue", "src/test/webapp/unit/**/*.ts" ], - "exclude": ["./node_modules", "src/test/webapp/cypress/**/*.ts"] + "exclude": ["./node_modules", "src/test/webapp/e2e/**/*.ts"] }