Skip to content

Commit

Permalink
test(profile): add playwright tests
Browse files Browse the repository at this point in the history
  • Loading branch information
divyajindel committed Oct 16, 2023
1 parent 41fe318 commit 5985d97
Show file tree
Hide file tree
Showing 5 changed files with 231 additions and 177 deletions.
177 changes: 0 additions & 177 deletions cypress/components/profile/profile.cy.tsx

This file was deleted.

21 changes: 21 additions & 0 deletions playwright/components/profile/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Page } from "@playwright/test";
import { EMAIL, NAME, INITIALS, PROFILE } from "./locators";

// component preview locators

const emailPreview = (page: Page) => {
return page.locator(EMAIL);
};

const namePreview = (page: Page) => {
return page.locator(NAME);
};

const profilePreview = (page: Page) => {
return page.locator(PROFILE);
};

const initialPreview = (page: Page) => {
return page.locator(INITIALS);
};
export { emailPreview, namePreview, profilePreview, initialPreview };
5 changes: 5 additions & 0 deletions playwright/components/profile/locators.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// component preview locators
export const EMAIL = '[data-element="email"]';
export const NAME = '[data-element="name"]';
export const INITIALS = '[data-element="initials"]';
export const PROFILE = '[data-component="profile"]';
10 changes: 10 additions & 0 deletions src/components/profile/component.test-pw.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from "react";
import Profile, { ProfileProps } from ".";

const ProfileComponent = (props: Partial<ProfileProps>) => {
return (
<Profile email="email@email.com" initials="JD" name="John Doe" {...props} />
);
};

export default ProfileComponent;
Loading

0 comments on commit 5985d97

Please sign in to comment.