-
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
9 changed files
with
185 additions
and
66 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,24 @@ | ||
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 | ||
run: npm ci && npm i --prefix ./test-site | ||
- 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 | ||
run: DEBUG=pw:api npx playwright test playwright.test.ts -g "test\s+Fire\s+Search\s+Event\s+on\s+Chromium,\s+Firefox,\s+and\s+Webkit$" | ||
|
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ dist/ | |
docs/ | ||
etc/ | ||
lib/ | ||
test-e2e/ | ||
node_modules/ | ||
package*.json | ||
LICENSE | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,84 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('test Fire Chat Event on Chromium, Firefox, and Webkit', async ({ | ||
page | ||
}) => { | ||
await Promise.all([ | ||
page.waitForResponse((res) => res.status() != 202), | ||
page.click('button:has-text("Fire Chat Event")') | ||
]) | ||
.then((responses) => { | ||
console.log(responses.at(0)); | ||
console.log(responses.at(0)?.status()); | ||
console.log(responses.at(0)?.statusText()); | ||
console.log(responses.at(0)?.ok()); | ||
|
||
console.log(responses.at(1)); | ||
console.log(responses.at(1)?.status()); | ||
console.log(responses.at(1)?.statusText()); | ||
console.log(responses.at(1)?.ok()); | ||
expect(responses.at(0)?.status()).toBe(202); | ||
}) | ||
.catch((e) => { | ||
console.log(e); | ||
console.log(e.status()); | ||
console.log(e.statusText()); | ||
console.log(e.message()); | ||
console.log(e.name()); | ||
test.fail(e); | ||
}); | ||
}); | ||
|
||
test('test Fire Search Event on Chromium, 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 Chromium, 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 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 Chromium, 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); | ||
}); | ||
}); |
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