-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
93 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
name: Playwright Tests | ||
on: [push, pull_request] | ||
|
||
env: | ||
YEXT_API_KEY: ${{ secrets.GCP_SA_KEY }} | ||
|
||
jobs: | ||
test: | ||
timeout-minutes: 5 | ||
runs-on: ubuntu-latest | ||
container: | ||
image: mcr.microsoft.com/playwright:v1.38.0-jammy | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
- name: build package | ||
run: npm run build | ||
- name: Run Playwright tests | ||
run: npx playwright test | ||
- uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: playwright-report | ||
path: playwright-report/ | ||
retention-days: 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('test Fire Chat Event on chrome, firefox, and webkit', async ({ | ||
page | ||
}) => { | ||
await page.goto('http://localhost:3000'); | ||
|
||
await Promise.all([ | ||
page.waitForResponse((res) => res.status() == 202), | ||
await page.click('button:has-text("Fire Chat Event")') | ||
]) | ||
.then((responses) => { | ||
expect(responses.at(0)?.status()).toBe(202); | ||
}) | ||
.catch((e) => { | ||
console.log(e); | ||
test.fail(e); | ||
}); | ||
}); | ||
|
||
test('test Fire Search Event on chrome, firefox, and webkit', async ({ | ||
page | ||
}) => { | ||
await page.goto('http://localhost:3000'); | ||
|
||
await Promise.all([ | ||
page.waitForResponse((res) => res.status() == 202), | ||
page.click('button:has-text("Fire Search Event")') | ||
]) | ||
.then((responses) => { | ||
expect(responses.at(0)?.status()).toBe(202); | ||
}) | ||
.catch((e) => { | ||
console.log(e); | ||
test.fail(e); | ||
}); | ||
}); | ||
|
||
test('test Fire CTA Event on chrome, firefox, and webkit', async ({ page }) => { | ||
await page.goto('http://localhost:3000'); | ||
|
||
await Promise.all([ | ||
page.waitForResponse((res) => res.status() == 202), | ||
page.click('button:has-text("Fire CTA Event")') | ||
]) | ||
.then((responses) => { | ||
expect(responses.at(0)?.status()).toBe(202); | ||
}) | ||
.catch((e) => { | ||
console.log(e); | ||
test.fail(e); | ||
}); | ||
}); | ||
|
||
test('test Fire Event w/ Session Tracking on chrome, firefox, and webkit', async ({ | ||
page | ||
}) => { | ||
await page.goto('http://localhost:3000'); | ||
|
||
await Promise.all([ | ||
page.waitForResponse((res) => res.status() == 202), | ||
page.click('button:has-text("Fire Event w/ Session Tracking")') | ||
]) | ||
.then((responses) => { | ||
expect(responses.at(0)?.status()).toBe(202); | ||
}) | ||
.catch((e) => { | ||
console.log(e); | ||
test.fail(e); | ||
}); | ||
}); |