forked from activepieces/activepieces
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request activepieces#4199 from activepieces/fix/e2e-test
test: e2e execution flow test
- Loading branch information
Showing
14 changed files
with
210 additions
and
131 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
AP_API_KEY=api-key | ||
AP_QUEUE_MODE=MEMORY | ||
AP_DB_TYPE=SQLITE3 | ||
AP_ENVIRONMENT=test | ||
AP_ENCRYPTION_KEY=7e19fad4c13eaea8f657afb12e8f9c40 | ||
AP_FRONTEND_URL=http://localhost:4200 | ||
AP_WEBHOOK_URL=http://localhost:3000 | ||
AP_WEBHOOK_TIMEOUT_SECONDS=30 | ||
AP_LOG_LEVEL=error | ||
AP_LOG_PRETTY=true | ||
AP_QUEUE_MODE=MEMORY | ||
AP_TELEMETRY_ENABLED=false | ||
AP_ENRICH_ERROR_CONTEXT=true | ||
AP_TRIGGER_DEFAULT_POLL_INTERVAL=1 | ||
AP_CACHE_PATH=./dev/cache | ||
AP_SIGN_UP_ENABLED=true | ||
AP_EXECUTION_MODE=UNSANDBOXED | ||
AP_PIECES_SOURCE=CLOUD_AND_DB | ||
AP_JWT_SECRET=secret | ||
|
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,5 @@ | ||
|
||
export const globalConfig = { | ||
instanceUrl: 'http://localhost:4200', | ||
password: 'Test@1234578', | ||
} |
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,48 @@ | ||
import { globalConfig } from "../config"; | ||
import { Page } from "@playwright/test"; | ||
import { dashboard } from "./dashboard"; | ||
|
||
export const authentication = { | ||
async signIn(page: Page, params: { email: string, password: string }) { | ||
await page.goto(`${globalConfig.instanceUrl}/sign-in`); | ||
|
||
const emailField = page.getByPlaceholder('Email'); | ||
|
||
await emailField.click(); | ||
await emailField.fill(params.email); | ||
await emailField.press('Tab'); | ||
|
||
const passwordField = page.getByPlaceholder('Password'); | ||
await passwordField.fill(params.password); | ||
await passwordField.press('Enter'); | ||
|
||
await dashboard.waitFor(page); | ||
}, | ||
async signUp(page: Page, params: { email: string, password: string }) { | ||
await page.goto(`${globalConfig.instanceUrl}/sign-up`); | ||
|
||
const firstNameField = page.getByText('First Name').first() | ||
await firstNameField.click(); | ||
await firstNameField.fill('Bugs'); | ||
await firstNameField.press('Tab'); | ||
|
||
const lastNameField = page.getByText('Last Name').first() | ||
await lastNameField.click(); | ||
await lastNameField.fill('Bunny'); | ||
await lastNameField.press('Tab'); | ||
|
||
const emailField = page.getByPlaceholder('Email'); | ||
await emailField.click(); | ||
await emailField.fill(params.email); | ||
await emailField.press('Tab'); | ||
|
||
const passwordField = page.getByText('Password').first(); | ||
await passwordField.fill(params.password); | ||
|
||
await page.locator('.cdk-overlay-backdrop').click(); | ||
|
||
await page.getByRole('button', { name: 'Sign up' }).click(); | ||
|
||
await dashboard.waitFor(page); | ||
} | ||
} |
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,48 @@ | ||
import { Page, expect } from '@playwright/test'; | ||
|
||
const property = { | ||
async selectConnection(page: Page, params: { connection: string }) { | ||
await page.getByRole('combobox', { name: 'Connection' }).locator('span').click(); | ||
await page.getByText(params.connection, { exact: true }).click(); | ||
}, | ||
async selectDropdown(page: Page, params: { property: string, value: string }) { | ||
await page.getByText(params.property, { exact: true }).click() | ||
await page.getByText(params.value).click(); | ||
} | ||
} | ||
|
||
export const builder = { | ||
async selectInitalTrigger(page: Page, params: { piece: string, trigger: string }) { | ||
await page.getByText('Choose a trigger', { exact: true }).click(); | ||
await page.getByPlaceholder('Search').click(); | ||
await page.getByPlaceholder('Search').fill(params.piece); | ||
await page.getByAltText(params.piece).click(); | ||
|
||
await page.getByText('Select a Trigger').click(); | ||
await page.getByText(params.trigger, { exact: true }).click(); | ||
await page.waitForTimeout(5000); | ||
}, | ||
async addAction(page: Page, params: { piece: string, action: string }) { | ||
await page.locator('app-small-add-button div').first().click(); | ||
await page.getByPlaceholder('Search').click(); | ||
await page.getByPlaceholder('Search').fill(params.piece); | ||
await page.getByText(params.piece).click(); | ||
|
||
await page.getByText('Select an action').click(); | ||
await page.getByText(params.action, { exact: true }).click(); | ||
}, | ||
async testFlowAndWaitForSuccess(page: Page) { | ||
await page.getByText('Test flow').click(); | ||
await page.waitForSelector('//*[contains(text(),"Run succeeded")]'); // Wait for the element to appear | ||
const runSuccessText = await page.locator('//*[contains(text(),"Run succeeded")]').textContent(); | ||
expect(runSuccessText).toContain('Run succeeded'); | ||
}, | ||
async exitRun(page: Page) { | ||
await page.getByRole('button', { name: 'Exit Run' }).click(); | ||
}, | ||
async clickHome(page: Page) { | ||
await page.getByLabel('Home').click(); | ||
}, | ||
property, | ||
} | ||
|
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,10 @@ | ||
import { Page } from "@playwright/test"; | ||
|
||
|
||
export const dashboard = { | ||
waitFor: async (page: Page) => { | ||
await page.getByLabel("Home").waitFor({ | ||
timeout: 5000 | ||
}); | ||
} | ||
} |
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,25 @@ | ||
import { Page } from "@playwright/test"; | ||
|
||
export const flows = { | ||
deleteFlow: async (page: Page, params: { flowName: string }) => { | ||
await page.getByRole('row', { name: new RegExp(`^${params.flowName}`) }).getByRole('button').first().click(); | ||
await page.getByRole('menuitem', { name: 'Delete' }).click(); | ||
|
||
await page.getByPlaceholder('DELETE').fill('DELETE'); | ||
const confirmButton = await page.getByRole('button', { name: 'Confirm' }); | ||
await confirmButton.click() | ||
|
||
await page.waitForSelector('button:has-text("Confirm")', { state: 'hidden' }); | ||
}, | ||
newFlowFromScratch: async (page: Page) => { | ||
const startBuildingButton = await page.getByText('Start building your first flow'); | ||
if (startBuildingButton) { | ||
await startBuildingButton.click(); | ||
await page.getByText('Start from scratch').click(); | ||
} else { | ||
const newFlowButton = await page.getByRole('button', { name: 'New Flow' }); | ||
await newFlowButton.click(); | ||
await page.getByText('From Scratch').click(); | ||
} | ||
}, | ||
} |
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
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,12 @@ | ||
import { test } from '@playwright/test'; | ||
import { authentication } from '../page/authentication'; | ||
import { faker } from '@faker-js/faker' | ||
import { globalConfig } from '../config'; | ||
|
||
test('Sign Up New Account', async ({ page }) => { | ||
const email = faker.internet.email(); | ||
await authentication.signUp(page, { | ||
email: email, | ||
password: globalConfig.password | ||
}) | ||
}); |
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,30 @@ | ||
import { test } from '@playwright/test'; | ||
import { builder } from '../page/builder'; | ||
import { flows } from '../page/flows'; | ||
import { authentication } from '../page/authentication'; | ||
import { faker } from '@faker-js/faker' | ||
import { globalConfig } from '../config'; | ||
|
||
test('Test Execute Flow', async ({ page }) => { | ||
test.setTimeout(100000); | ||
const email = faker.internet.email(); | ||
await authentication.signUp(page, { | ||
email: email, | ||
password: globalConfig.password | ||
}) | ||
await flows.newFlowFromScratch(page); | ||
await builder.selectInitalTrigger(page, { | ||
piece: 'Schedule', | ||
trigger: 'Every Day' | ||
}); | ||
|
||
await builder.addAction(page, { | ||
piece: 'Data Mapper', | ||
action: 'Advanced Mapping' | ||
}); | ||
|
||
await builder.testFlowAndWaitForSuccess(page); | ||
await builder.clickHome(page); | ||
await flows.deleteFlow(page, { flowName: 'Untitled' }) | ||
|
||
}); |