-
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
95 additions
and
58 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,31 @@ | ||
name: Playwright Tests | ||
on: [push, pull_request] | ||
|
||
env: | ||
YEXT_API_KEY: ${{ secrets.GCP_SA_KEY }} | ||
|
||
jobs: | ||
test: | ||
timeout-minutes: 5 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- if: ${{ env.YEXT_API_KEY == ''}} | ||
run: | | ||
echo "YEXT_API_KEY is not set" | ||
exit 1 | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: build main package | ||
run: npm run build | ||
- name: Install test site dependencies | ||
run: npm i --prefix ./test-site | ||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
- name: Build test site | ||
run: echo 'Key:' '${{ env.YEXT_API_KEY }}' && npm run build --prefix ./test-site & | ||
- 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://127.0.0.1:3030'); | ||
|
||
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://127.0.0.1:3030'); | ||
|
||
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://127.0.0.1:3030'); | ||
|
||
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://127.0.0.1:3030'); | ||
|
||
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); | ||
}); | ||
}); |