-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Because - We need e2e test to make sure everything is working correctly This commit - Implement onboarding e2e test - Fix issue related to input field's id
- Loading branch information
Showing
15 changed files
with
121 additions
and
43 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1 @@ | ||
name: Playwright Tests | ||
on: | ||
push: | ||
branches: [] | ||
pull_request: | ||
branches: [] | ||
jobs: | ||
test: | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: "14.x" | ||
- name: Install dependencies | ||
run: yarn | ||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
- name: Run Playwright tests | ||
run: yarn playwright test | ||
- uses: actions/upload-artifact@v2 | ||
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 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,94 @@ | ||
import { test, expect } from "@playwright/test"; | ||
|
||
test("first time enter user should go to the onboarding page", async ({ | ||
page, | ||
}) => { | ||
if (!process.env.NEXT_PUBLIC_MAIN_URL) return; | ||
|
||
await page.goto(process.env.NEXT_PUBLIC_MAIN_URL); | ||
|
||
await expect(page).toHaveURL( | ||
`${process.env.NEXT_PUBLIC_MAIN_URL}/onboarding` | ||
); | ||
}); | ||
|
||
test("should disable start button, if email input is not correct", async ({ | ||
page, | ||
}) => { | ||
if (!process.env.NEXT_PUBLIC_MAIN_URL) return; | ||
|
||
await page.goto(process.env.NEXT_PUBLIC_MAIN_URL); | ||
|
||
// Fill in email | ||
await page.fill("text='Your email *'", "instill"); | ||
|
||
// Fill in company | ||
await page.fill("text='Your company *'", "instill-ai"); | ||
|
||
// Select role | ||
const select = await page.waitForSelector("#react-select-role-input"); | ||
await select.click(); | ||
const option = await page.waitForSelector(":text('Manager')", { | ||
state: "attached", | ||
}); | ||
await option.scrollIntoViewIfNeeded(); | ||
await option.click(); | ||
|
||
await page.locator("test=Start").isDisabled(); | ||
}); | ||
|
||
test("should disable start button, if other field is not filled in", async ({ | ||
page, | ||
}) => { | ||
if (!process.env.NEXT_PUBLIC_MAIN_URL) return; | ||
|
||
await page.goto(process.env.NEXT_PUBLIC_MAIN_URL); | ||
await page.fill("text='Your email *'", "instill@instill.tech"); | ||
await page.locator("test=Start").isDisabled(); | ||
}); | ||
|
||
test("should successfully fill in the onboarding form and submit", async ({ | ||
page, | ||
context, | ||
}) => { | ||
if (!process.env.NEXT_PUBLIC_MAIN_URL) return; | ||
|
||
await page.goto(process.env.NEXT_PUBLIC_MAIN_URL); | ||
await expect(page).toHaveURL( | ||
`${process.env.NEXT_PUBLIC_MAIN_URL}/onboarding` | ||
); | ||
|
||
// Fill in email | ||
await page.fill("text='Your email *'", "instill@instill.tech"); | ||
|
||
// Fill in company | ||
await page.fill("text='Your company *'", "instill-ai"); | ||
|
||
// Select role - manager | ||
const select = await page.waitForSelector("#react-select-role-input"); | ||
await select.click(); | ||
const option = await page.waitForSelector(":text('Manager')", { | ||
state: "attached", | ||
}); | ||
await option.scrollIntoViewIfNeeded(); | ||
await option.click(); | ||
|
||
// Accept newsletter subscription | ||
await page.locator("#newsletter_subscription").click(); | ||
|
||
// Click Start and wait for navigation | ||
await page.locator("test=Start").click(); | ||
await page.waitForNavigation(); | ||
|
||
expect(page.url).toBe(`${process.env.NEXT_PUBLIC_MAIN_URL}/pipeline`); | ||
|
||
// Check cookie exist | ||
const cookies = await context.cookies(); | ||
const instillCookies = cookies.find( | ||
(e) => e.name === process.env.NEXT_PUBLIC_INSTILL_AI_USER_COOKIE_NAME | ||
); | ||
expect(instillCookies).not.toBeNull(); | ||
expect( | ||
JSON.parse(instillCookies?.value as string).cookie_token | ||
).not.toBeNull(); | ||
}); |
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 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 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 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 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