Skip to content

Commit

Permalink
debug component testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquesfize committed Mar 11, 2024
1 parent e4ab098 commit 0248b81
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 34 deletions.
26 changes: 2 additions & 24 deletions frontend/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,14 @@ export default defineConfig({
},
baseUrl: "http://127.0.0.1:4200",
specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx}",
supportFile: false,
},

component: {
devServer: {
framework: "angular",
bundler: "webpack",
options: {
projectConfig: {
root: 'src',
sourceRoot: 'src/app',
buildOptions: {
// outputPath: 'dist/my-app',
// index: 'apps/my-app/src/index.html',
// main: 'apps/my-app/src/main.ts',
// polyfills: 'apps/my-app/src/polyfills.ts',
tsConfig: 'tsconfig.spec.json',
// inlineStyleLanguage: 'scss',
// assets: ['apps/my-app/src/favicon.ico', 'apps/my-app/src/assets'],
// styles: ['apps/my-app/src/styles.scss'],
// scripts: [],
// buildOptimizer: false,
// optimization: false,
// vendorChunk: true,
// extractLicenses: false,
// sourceMap: true,
// namedChunks: true,
},
},
},
},
specPattern: "**/*.spec.ts",
specPattern: "**/*.cy.ts",
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,28 @@
import { Component, OnInit } from '@angular/core';
import { ConfigService } from '../../../services/config.service';
import { MountConfig } from 'cypress/angular';
import { HttpClient } from '@angular/common/http';
import { GN2CommonModule } from '../../GN2Common.module';
import { HttpClient, HttpHandler } from '@angular/common/http';
import * as gerard from '../../GN2Common.module';

@Component({
selector: 'pnx-pouet',
template: '<h1>POUET POUET</h1>',
})
export class testComponent implements OnInit {
constructor(configService: ConfigService) {}
constructor(configService: ConfigService) { }

ngOnInit() {}
ngOnInit() { }
}

export abstract class ConfigMock {

}

describe('testComponent', () => {
const config: MountConfig<testComponent> = {
imports: [GN2CommonModule],
providers: [ConfigService, HttpClient]
}
// const config: MountConfig<testComponent> = {
// imports: [GN2CommonModule],
// providers: [ConfigService, HttpClient]
// }



Expand All @@ -38,8 +41,12 @@ describe('testComponent', () => {
// cy.get('.name').should('have.value', 'my custom message')
// console.log(cy.stub(_ds, "getAcquisitionFrameworks").returns({}))


cy.mount(testComponent, config)
console.log("test")
cy.mount(testComponent, {
imports: [],
declarations: [testComponent],
providers: [{ provide: ConfigService, useClass: ConfigMock }]
})
});
});

0 comments on commit 0248b81

Please sign in to comment.