Jack Maclennan Portfolio
    Preparing search index...

    Fixture for SocialIcons component

        this.socialIcons = new SocialIcons(
    this.navBar.getByRole('group', { name: 'Social links' }).filter({ visible: true })
    );

    Provides method helpers for locating children elements and interactivity.

    Used in example to be accessed in testing environment.

    export default class SocialIcons implements ListComponent {
    /** @public Component wrapper. */
    private readonly emailLink: Locator;
    /** @public Component wrapper. */
    private readonly githubLink: Locator;
    /** @public Component wrapper. */
    private readonly linkedInLink: Locator;

    /**
    * Fixture constructor - initialise variables.
    * @param socialIcons - Social icons locator.
    */
    public constructor(private readonly socialIcons: Locator) {
    this.emailLink = this.socialIcons.getByRole('link', { name: 'email' });
    this.githubLink = this.socialIcons.getByRole('link', { name: 'github' });
    this.linkedInLink = this.socialIcons.getByRole('link', { name: 'linkedin' });
    }

    /** Getter method. @returns {@link socialIcons}. */
    public getWrapper(): Locator {
    return this.socialIcons;
    }

    /** Testing helper method. */
    public async rendersCorrectly(): Promise<boolean> {
    await expect(this.getWrapper(), 'wrapper is visible').toBeVisible();
    await expect(this.getEmailLink(), 'email link is visible').toBeVisible();
    await expect(this.getGithubLink(), 'github link is visible').toBeVisible();
    await expect(this.getLinkedInLink(), 'linkedin link is visible').toBeVisible();
    expect(await this.getListLength(), 'has list length of 3').toBe(3);
    return true;
    }

    /** Getter method. @returns {@link emailLink}. */
    public getEmailLink(): Locator {
    return this.emailLink;
    }

    /** Getter method. @returns {@link githubLink}. */
    public getGithubLink(): Locator {
    return this.githubLink;
    }

    /** Getter method. @returns {@link linkedInLink}. */
    public getLinkedInLink(): Locator {
    return this.linkedInLink;
    }

    /** Getter method. @returns Link element children. */
    public getListItems(): Locator {
    return this.socialIcons.getByRole('link');
    }

    /** Getter method. @inheritDoc */
    public async getListLength(): Promise<number> {
    return this.getListItems().count();
    }

    /** Getter method. @returns Link child at given index. */
    public getListItemByIndex(index: number): Locator {
    return this.getListItems().nth(index);
    }
    }

    Implements

    Index

    Constructors

    Properties

    emailLink: Locator

    Component wrapper.

    githubLink: Locator

    Component wrapper.

    linkedInLink: Locator

    Component wrapper.

    socialIcons: Locator

    Social icons locator.

    Methods