Skip to content

Commit

Permalink
Adding comment to spec.ts files to generate screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
chromaticWaster committed Sep 20, 2024
1 parent 65b8e24 commit 4a859d9
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/email-field/EmailField.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ test(`Email Field - Visual and Behaviour`, async ({ page }) => {
await page.goto('/components/email-field/');
await page.evaluate(() => document.fonts.ready);

// Locate the email field component.
const emailField = page.locator('[data-testid]').first();
emailField.evaluate(async (t: EmailField) => {
t.value = '';
Expand Down
4 changes: 4 additions & 0 deletions src/icon/Icon.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ test(`Icon - Visual`, async ({ page }) => {
await withCoverage(page, async () => {
await page.goto('/components/icon/');

// Locate the icon component.
const icon = page.locator('.Interactive').getByTestId('test-icon');

await expect(icon).toHaveScreenshot('icon-initial.png');
Expand All @@ -14,6 +15,7 @@ test(`Icon - Local Source Visual`, async ({ page }) => {
await withCoverage(page, async () => {
await page.goto('/components/icon/');

// Locate the icon component.
const icon = page.locator('.Local_Source').getByTestId('test-icon');

await expect(icon).toHaveScreenshot('icon-initial.png');
Expand All @@ -24,6 +26,7 @@ test(`Icon - Remote Source Visual`, async ({ page }) => {
await withCoverage(page, async () => {
await page.goto('/components/icon/');

// Locate the icon component.
const icon = page.locator('.Remote_Source').getByTestId('test-icon');

await expect(icon).toHaveScreenshot('icon-initial.png');
Expand All @@ -44,6 +47,7 @@ test(`Icon - Asymmetrical Visual and Behaviour`, async ({ page }) => {
await withCoverage(page, async () => {
await page.goto('/components/icon/');

// Locate the icon component.
const icon = page.locator('.Asymmetrical').getByTestId('test-icon');

const svg = icon.locator('svg');
Expand Down
3 changes: 2 additions & 1 deletion src/number-field/NumberField.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ test(`Number Field - Visual and Behaviour`, async ({ page }) => {
await withCoverage(page, async () => {
await page.goto('/components/number-field/');
await page.evaluate(() => document.fonts.ready);


// Locate number field component.
const numberField = page.locator('[data-testid]').first();
numberField.evaluate(async (t: NumberField) => {
t.value = '';
Expand Down
1 change: 1 addition & 0 deletions src/pin-field/PinField.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ test(`Pin Field - Visual and Behaviour`, async ({ page }) => {
await page.goto('/components/pin-field/');
await page.evaluate(() => document.fonts.ready);

// Locate the pin field component
const pinField = page.locator('[data-testid]').first();
pinField.evaluate(async (t: PinField) => {
t.value = '';
Expand Down
1 change: 1 addition & 0 deletions src/search-field/SearchField.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ test(`Search Field - Visual and Behaviour`, async ({ page }) => {
await page.goto('/components/search-field/');
await page.evaluate(() => document.fonts.ready);

// Locate the search field component.
const searchField = page.locator('[data-testid]').first();
searchField.evaluate(async (t: SearchField) => {
t.value = '';
Expand Down
1 change: 1 addition & 0 deletions src/text-field/TextField.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test(`Text Field - Visual and Behaviour`, async ({ page }) => {

await page.waitForSelector('[data-testid]', {});

// Locate text field component.
const textField = page.locator('[data-testid]').first();
textField.evaluate(async (t: TextField) => {
t.value = '';
Expand Down

0 comments on commit 4a859d9

Please sign in to comment.