Skip to content

Commit

Permalink
fix note images test
Browse files Browse the repository at this point in the history
  • Loading branch information
arpitdalal authored and kentcdodds committed Oct 31, 2023
1 parent 88b4088 commit c934acd
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions tests/e2e/note-images.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import fs from 'fs'
import { faker } from '@faker-js/faker'
import { expect, test } from '@playwright/test'
import { type NoteImage, type Note } from '@prisma/client'
import { prisma } from '#app/utils/db.server.ts'
import { loginPage } from '#tests/playwright-utils.ts'
import { expect, test } from '#tests/playwright-utils.ts'

test('Users can create note with an image', async ({ page }) => {
const user = await loginPage({ page })
test('Users can create note with an image', async ({ page, login }) => {
const user = await login()
await page.goto(`/users/${user.username}/notes`)

const newNote = createNote()
Expand All @@ -28,8 +27,8 @@ test('Users can create note with an image', async ({ page }) => {
await expect(page.getByAltText(altText)).toBeVisible()
})

test('Users can create note with multiple images', async ({ page }) => {
const user = await loginPage({ page })
test('Users can create note with multiple images', async ({ page, login }) => {
const user = await login()
await page.goto(`/users/${user.username}/notes`)

const newNote = createNote()
Expand Down Expand Up @@ -60,8 +59,8 @@ test('Users can create note with multiple images', async ({ page }) => {
await expect(page.getByAltText(altText2)).toBeVisible()
})

test('Users can edit note image', async ({ page }) => {
const user = await loginPage({ page })
test('Users can edit note image', async ({ page, login }) => {
const user = await login()

const note = await prisma.note.create({
select: { id: true },
Expand All @@ -86,8 +85,8 @@ test('Users can edit note image', async ({ page }) => {
await expect(page.getByAltText(updatedImage.altText)).toBeVisible()
})

test('Users can delete note image', async ({ page }) => {
const user = await loginPage({ page })
test('Users can delete note image', async ({ page, login }) => {
const user = await login()

const note = await prisma.note.create({
select: { id: true, title: true },
Expand Down

0 comments on commit c934acd

Please sign in to comment.