Skip to content

Commit

Permalink
🤖 Apply formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Nov 15, 2024
1 parent fa70fdd commit fe1c9d7
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 32 deletions.
3 changes: 1 addition & 2 deletions e2e/utils/pages/activity.page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Page } from '@playwright/test';
import { ACTIVITY_URL } from '../constants/e2e.constants';
import { HomepageLoggedIn, type HomepageLoggedInParams } from './homepage.page';
import { PromotionCarousel } from '../promotion-carousel.component';
import { HomepageLoggedIn, type HomepageLoggedInParams } from './homepage.page';

export type ActivityPageParams = HomepageLoggedInParams;

Expand All @@ -10,7 +10,6 @@ export class ActivityPage extends HomepageLoggedIn {
readonly #page: Page;
readonly promotionCarousel: PromotionCarousel;


constructor({ page, iiPage, viewportSize }: ActivityPageParams) {
super({ page, iiPage, viewportSize });

Expand Down
56 changes: 28 additions & 28 deletions e2e/utils/promotion-carousel.component.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import { Locator, Page } from "@playwright/test";
import { Locator, Page } from '@playwright/test';

export class PromotionCarousel {
private page: Page;
private carouselContainer: Locator;
private slideButtonSelector: string;
private activeSlideSelector: string;
private page: Page;
private carouselContainer: Locator;
private slideButtonSelector: string;
private activeSlideSelector: string;

constructor(page: Page) {
this.page = page;
this.carouselContainer = this.page.getByTestId('carousel-container');
// Selector template for the slide navigation buttons
this.slideButtonSelector = 'button[aria-label="Jump to slide {slideNumber}"]';
// Selector template for the active slide
this.activeSlideSelector = '.carousel-slide.active[data-slide="{slideNumber}"]';
}
constructor(page: Page) {
this.page = page;
this.carouselContainer = this.page.getByTestId('carousel-container');
// Selector template for the slide navigation buttons
this.slideButtonSelector = 'button[aria-label="Jump to slide {slideNumber}"]';
// Selector template for the active slide
this.activeSlideSelector = '.carousel-slide.active[data-slide="{slideNumber}"]';
}

/**
* Navigate to a specific slide in the carousel.
* @param slideNumber - The slide number to navigate to.
*/
async goToSlide(slideNumber: number): Promise<void> {
// Construct the selector for the slide button
const slideButton = this.slideButtonSelector.replace('{slideNumber}', slideNumber.toString());
/**
* Navigate to a specific slide in the carousel.
* @param slideNumber - The slide number to navigate to.
*/
async goToSlide(slideNumber: number): Promise<void> {
// Construct the selector for the slide button
const slideButton = this.slideButtonSelector.replace('{slideNumber}', slideNumber.toString());

// Wait for the carousel container to be visible
await this.carouselContainer.waitFor({ state: 'visible', timeout: 10000 });
// Wait for the carousel container to be visible
await this.carouselContainer.waitFor({ state: 'visible', timeout: 10000 });

// Click the button to navigate to the desired slide
await this.page.click(slideButton);
// Click the button to navigate to the desired slide
await this.page.click(slideButton);

// Ensure the carousel is on the correct slide
const activeSlide = this.activeSlideSelector.replace('{slideNumber}', slideNumber.toString());
await this.page.waitForSelector(activeSlide, { timeout: 5000 });
}
// Ensure the carousel is on the correct slide
const activeSlide = this.activeSlideSelector.replace('{slideNumber}', slideNumber.toString());
await this.page.waitForSelector(activeSlide, { timeout: 5000 });
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
name: dAppName
} = dappsCarouselSlide);
export let testId: string | undefined = undefined;
</script>
</script>

<div data-tid={testId} class="flex h-full items-center">
<div class="mr-4 shrink-0">
Expand Down

0 comments on commit fe1c9d7

Please sign in to comment.