Skip to content

Instantly share code, notes, and snippets.

@dadamssg
Last active August 30, 2024 21:07
Show Gist options
  • Save dadamssg/390014e8b7b766093c84f81466468009 to your computer and use it in GitHub Desktop.
Save dadamssg/390014e8b7b766093c84f81466468009 to your computer and use it in GitHub Desktop.
import { expect, test } from '@playwright/test'
import { login } from './auth'
test('can view contacts', async ({ page }) => {
await login({ page })
await fetch('http://localhost:3000/app/playwright', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({
url: 'http://localhost:6000/person/list',
method: 'post',
once: true,
response: {
data: [
{
id: 'abc',
firstname: 'Sally',
lastname: 'Rogers',
email1: '[email protected]',
lastupdatedate: '2021-05-13 12:04:05.000',
companyid: 'def',
cfd_companyname: 'Acme',
},
],
},
}),
})
await page.goto('/app/contacts')
const name = page.getByText('Sally Rogers')
await expect(name).toHaveText('Sally Rogers')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment