Skip to content

Commit

Permalink
Merge branch 'develop-6.6.x' into My-Account-bug-2
Browse files Browse the repository at this point in the history
  • Loading branch information
anjana-bl authored Oct 30, 2023
2 parents 1a3933f + c573c23 commit 036ee85
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,27 +1,52 @@
import { Component, Input } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LaunchDialogService } from '@spartacus/storefront';
import { ProductImageZoomDialogComponent } from './product-image-zoom-dialog.component';
import { I18nTestingModule } from '@spartacus/core';
import {
ICON_TYPE,
KeyboardFocusTestingModule,
LaunchDialogService,
} from '@spartacus/storefront';
import { ProductImageZoomDialogComponent } from './product-image-zoom-dialog.component';

class MockLaunchDialogService {
closeDialog() {}
}

@Component({
selector: 'cx-icon',
template: '',
})
class MockCxIconComponent {
@Input() type: ICON_TYPE;
}

@Component({
selector: 'cx-product-image-zoom-view',
template: '',
})
class MockProductImageZoomViewComponent {
@Input() galleryIndex: number;
}

describe('ProductImageZoomDialogComponent', () => {
let component: ProductImageZoomDialogComponent;
let fixture: ComponentFixture<ProductImageZoomDialogComponent>;
let launchDialogService: LaunchDialogService;

beforeEach(() => {
TestBed.configureTestingModule({
imports: [I18nTestingModule],
imports: [I18nTestingModule, KeyboardFocusTestingModule],
providers: [
{
provide: LaunchDialogService,
useClass: MockLaunchDialogService,
},
],
declarations: [ProductImageZoomDialogComponent],
declarations: [
ProductImageZoomDialogComponent,
MockCxIconComponent,
MockProductImageZoomViewComponent,
],
}).compileComponents();

fixture = TestBed.createComponent(ProductImageZoomDialogComponent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, Input } from '@angular/core';
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { I18nTestingModule, ImageGroup, Product } from '@spartacus/core';
Expand Down Expand Up @@ -68,7 +68,7 @@ class MockCurrentProductService {
template: '',
})
class MockMediaComponent {
@Input() container;
@Input() container: any;
}

@Component({
Expand All @@ -82,10 +82,20 @@ class MockMediaComponent {
`,
})
class MockCarouselComponent {
@Input() items;
@Input() itemWidth;
@Input() template;
@Input() hideIndicators;
@Input() items: any;
@Input() itemWidth: any;
@Input() template: any;
@Input() hideIndicators: any;
}

@Component({
selector: 'cx-product-image-zoom-trigger',
template: ``,
})
class MockProductImageZoomTriggerComponent {
@Input() expandImage: any;
@Input() galleryIndex: any;
@Output() dialogClose = new EventEmitter<void>();
}

describe('ProductImagesComponent', () => {
Expand All @@ -101,6 +111,7 @@ describe('ProductImagesComponent', () => {
ProductImageZoomProductImagesComponent,
MockMediaComponent,
MockCarouselComponent,
MockProductImageZoomTriggerComponent,
],
providers: [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { Component, ElementRef, Input } from '@angular/core';
import {
Component,
ElementRef,
EventEmitter,
Input,
Output,
} from '@angular/core';
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { ImageGroup, Product } from '@spartacus/core';
Expand Down Expand Up @@ -94,6 +100,16 @@ class MockIconComponent {
@Input() type;
}

@Component({
selector: 'cx-product-image-zoom-thumbnails',
template: '',
})
export class MockProductImageZoomThumbnailsComponent {
@Output() productImage = new EventEmitter<{ image: any; index: number }>();
@Input() thumbs$: Observable<ThumbnailsGroup[]>;
@Input() activeThumb: EventEmitter<ImageGroup>;
}

describe('ProductImageZoomViewComponent', () => {
let productImageZoomViewComponent: ProductImageZoomViewComponent;
let fixture: ComponentFixture<ProductImageZoomViewComponent>;
Expand All @@ -106,6 +122,7 @@ describe('ProductImageZoomViewComponent', () => {
MockIconComponent,
MockMediaComponent,
MockProductThumbnailsComponent,
MockProductImageZoomThumbnailsComponent,
],
providers: [
{ provide: CurrentProductService, useClass: MockCurrentProductService },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ export function checkout(): void {
cy.get('cx-delivery-mode').should('be.visible');
});

cy.log('choose first delivery method');
cy.get('cx-delivery-mode input#deliveryMode-premium-gross').first().click({
force: true,
});

cy.log("Navigate to the next step 'Payment details' tab");
cy.get('button.btn-primary')
.contains('Continue')
Expand Down

0 comments on commit 036ee85

Please sign in to comment.