Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ test('home page counter', async () => {
expect(screen.getByText(/count is 3/i)).not.toBeNull()
})

test('should have a card with a link to a LinkedIn post', () => {

const link = screen.getByText(/LinkedIn Post about this/i)
expect(link).not.toBeNull()
})

test.each(links)('should have a link to %s', (linkText) => {

const link = screen.getByAltText(linkText)
Expand Down
10 changes: 10 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ function App() {
</a>
</div>
<h1>Vite + React</h1>
<div className="card">
<p>
This is an example of a change in code that can be validated in a testing framework in a CI pipeline
</p>
<small>
<a href="https://www.linkedin.com/posts/daniel-wh_github-daniel-whcommithashdeploy-activity-7213178505499475968-JjVs?utm_source=share&utm_medium=member_desktop" target="_blank">
LinkedIn Post about this
</a>
</small>
</div>
<div className="card">
<button name='count' onClick={() => setCount((count) => count + 1)}>
count is {count}
Expand Down
6 changes: 5 additions & 1 deletion tests/example.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@ test('has title', async ({ page, context }) => {
await page.goto('/')
// Expect a title "to contain" a substring.
await expect(page).toHaveTitle("Vite + React + TS");
});

await page.goto('/')
const link = await page.getByRole('link', { name: /LinkedIn Post about this/i });
await expect(link).toBeDefined();
await expect(link).toHaveAttribute('href', 'https://www.linkedin.com/posts/daniel-wh_github-daniel-whcommithashdeploy-activity-7213178505499475968-JjVs?utm_source=share&utm_medium=member_desktop')
});