Skip to content

Commit

Permalink
fixed integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
LasithaPrabodha committed Mar 19, 2024
1 parent 1b9f370 commit 4b4b568
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ Weight, and Friends.
### Running e2e tests for the app

1. `npx nx run my-friends-e2e:e2e`
2. Wait for the cypress test window to launch
3. Click "app.spec.ts"
4. End-to-end tests for the application will run
2. End-to-end tests for the application will run

### Running unit tests

Expand Down
1 change: 1 addition & 0 deletions apps/my-friends-e2e/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ export default defineConfig({
ciWebServerCommand: 'nx run my-friends:serve-static',
}),
baseUrl: 'http://localhost:4200',
testIsolation: false
},
});
6 changes: 5 additions & 1 deletion apps/my-friends-e2e/src/integration/app.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('my-friends', () => {
});

describe('Valid pages', () => {
beforeEach(() => cy.visit('/'));
before(() => cy.visit('/'));

it('should land on the proper url', () => {
cy.url().should('eq', 'http://localhost:4200/');
Expand Down Expand Up @@ -90,6 +90,10 @@ describe('my-friends', () => {
});

it('should add second user manually and be friends with John', () => {
cy.get('wyn-force-directed-graph-card').should('exist');
cy.get('wyn-bubble-chart-card').should('exist');
cy.get('wyn-horizontal-bar-chart-card').should('exist');

cy.get('input[formcontrolname="name"]').type('Chris');
cy.get('input[formcontrolname="name"]').should('have.value', 'Chris');

Expand Down
6 changes: 3 additions & 3 deletions apps/my-friends/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Component } from '@angular/core';
import { RouterModule } from '@angular/router';
import { RouterOutlet } from '@angular/router';
import { MatToolbar } from '@angular/material/toolbar';
import { CommonModule } from '@angular/common';
import { DashboardComponent } from './dashboard/dashboard.component';

@Component({
standalone: true,
imports: [CommonModule, RouterModule, MatToolbar, DashboardComponent],
imports: [CommonModule, RouterOutlet, MatToolbar, DashboardComponent],
selector: 'wyn-root',
template: `
<header>
Expand All @@ -15,7 +15,7 @@ import { DashboardComponent } from './dashboard/dashboard.component';
</mat-toolbar>
</header>
<main>
<wyn-dashboard />
<router-outlet></router-outlet>
</main>
`,
styles: `
Expand Down
2 changes: 1 addition & 1 deletion apps/my-friends/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const appRoutes: Route[] = [
{
path: '',
pathMatch: 'full',
loadChildren: () =>
loadComponent: () =>
import('./dashboard/dashboard.component').then(
(m) => m.DashboardComponent
),
Expand Down

0 comments on commit 4b4b568

Please sign in to comment.