-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: frontend test framework setup with playwright
- Loading branch information
Showing
18 changed files
with
1,491 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules/ | ||
/test-results/ | ||
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { defineConfig, devices } from "@playwright/test"; | ||
|
||
export default defineConfig({ | ||
testDir: "./tests", | ||
fullyParallel: false, | ||
forbidOnly: !!process.env.CI, | ||
retries: process.env.CI ? 2 : 0, | ||
workers: 1, | ||
reporter: "html", | ||
use: { | ||
baseURL: "http://127.0.0.1:7357", | ||
trace: "on-first-retry", | ||
}, | ||
|
||
projects: [ | ||
{ | ||
name: "chromium", | ||
use: { ...devices["Desktop Chrome"] }, | ||
}, | ||
|
||
{ | ||
name: "firefox", | ||
use: { ...devices["Desktop Firefox"] }, | ||
}, | ||
|
||
{ | ||
name: "webkit", | ||
use: { ...devices["Desktop Safari"] }, | ||
}, | ||
], | ||
|
||
webServer: { | ||
command: "cd ../ui_test_app && npm i && npm run dev", | ||
url: "http://localhost:7357", | ||
reuseExistingServer: true, | ||
}, | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { test, expect } from "@playwright/test"; | ||
|
||
const loadPreset = async (preset) => { | ||
await fetch(`http://localhost:7358/${preset}`); | ||
} | ||
|
||
test.describe("button", () => { | ||
const TYPE = "button"; | ||
const COMPONENT_LOCATOR = `button.CoreButton.component`; | ||
|
||
test.beforeAll(async() => { | ||
await loadPreset('base'); | ||
}); | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.goto("/"); | ||
test.setTimeout(5000); | ||
}); | ||
|
||
test("configure", async ({ page }) => { | ||
await page | ||
.locator(`div.component.button[data-component-type="${TYPE}"]`) | ||
.dragTo(page.locator(".CoreSection .ChildlessPlaceholder")); | ||
await page.locator(COMPONENT_LOCATOR).click(); | ||
await page | ||
.locator('.BuilderFieldsText[data-key="text"] input') | ||
.fill("Hello, World!"); | ||
await expect(page.locator(COMPONENT_LOCATOR)).toContainText( | ||
"Hello, World!", | ||
); | ||
}); | ||
}); |
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,81 @@ | ||
import { test, expect } from "@playwright/test"; | ||
|
||
test.setTimeout(50000); | ||
|
||
const components = [ | ||
{ type: "sidebar", locator: `div.CoreSidebar.component` }, | ||
{ type: "button", locator: `button.CoreButton.component` }, | ||
{ type: "text", locator: `div.CoreText.component` }, | ||
//{ type: "section", locator: `div.CoreSection.component` }, | ||
{ type: "header", locator: `div.CoreHeader.component` }, | ||
{ type: "heading", locator: `div.CoreHeading.component` }, | ||
{ type: "dataframe", locator: `div.CoreDataframe.component` }, | ||
{ type: "html", locator: `div.CoreHTML.component` }, | ||
{ type: "pagination", locator: `div.pagination.component` }, | ||
{ type: "repeater", locator: `div.CoreRepeater.component` }, | ||
//{ type: "column", locator: `div.CoreColumn.component` }, | ||
{ type: "columns", locator: `div.CoreColumns.component` }, | ||
//{ type: "tab", locator: `div.CoreTab.component` }, | ||
{ type: "tabs", locator: `div.CoreTabs.component` }, | ||
{ type: "horizontalstack", locator: `div.CoreHorizontalStack.component` }, | ||
{ type: "separator", locator: `div.CoreSeparator.component` }, | ||
{ type: "image", locator: `div.CoreImage.component` }, | ||
{ type: "pdf", locator: `div.CorePDF.component` }, | ||
{ type: "iframe", locator: `div.CoreIFrame.component` }, | ||
{ type: "googlemaps", locator: `div.CoreGoogleMaps.component` }, | ||
{ type: "icon", locator: `div.icon.component` }, | ||
{ type: "timer", locator: `div.CoreTimer.component` }, | ||
{ type: "textinput", locator: `div.CoreTextInput.component` }, | ||
{ type: "textareainput", locator: `div.CoreTextareaInput.component` }, | ||
{ type: "numberinput", locator: `div.CoreNumberInput.component` }, | ||
{ type: "sliderinput", locator: `div.CoreSliderInput.component` }, | ||
{ type: "dateinput", locator: `div.CoreDateInput.component` }, | ||
{ type: "radioinput", locator: `div.CoreRadioInput.component` }, | ||
{ type: "checkboxinput", locator: `div.CoreCheckboxInput.component` }, | ||
{ type: "dropdowninput", locator: `div.CoreDropdownInput.component` }, | ||
{ type: "selectinput", locator: `div.CoreSelectInput.component` }, | ||
{ type: "multiselectinput", locator: `div.CoreMultiselectInput.component` }, | ||
{ type: "fileinput", locator: `div.CoreFileInput.component` }, | ||
{ type: "webcamcapture", locator: `div.CoreWebcamCapture.component` }, | ||
{ type: "vegalitechart", locator: `div.CoreVegaLiteChart.component` }, | ||
{ type: "plotlygraph", locator: `div.CorePlotlyGraph.component` }, | ||
{ type: "metric", locator: `div.CoreMetric.component` }, | ||
{ type: "message", locator: `div.CoreMessage.component` }, | ||
{ type: "videoplayer", locator: `div.CoreVideoPlayer.component` }, | ||
]; | ||
|
||
const loadPreset = async (preset) => { | ||
await fetch(`http://localhost:7358/${preset}`); | ||
} | ||
|
||
components.forEach(({ type, locator }) => { | ||
test.describe(type, () => { | ||
const TYPE = type; | ||
const COMPONENT_LOCATOR = locator; | ||
|
||
test.beforeAll(async() => { | ||
await loadPreset('base'); | ||
}); | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.goto("/"); | ||
}); | ||
|
||
test("create", async ({ page }) => { | ||
await page | ||
.locator(`div.component.button[data-component-type="${TYPE}"]`) | ||
.dragTo(page.locator(".CoreSection .ChildlessPlaceholder")); | ||
}); | ||
|
||
test("remove", async ({ page }) => { | ||
await page.locator(COMPONENT_LOCATOR).click({timeout: 1000}); | ||
await page | ||
.locator( | ||
'.BuilderComponentShortcuts .actionButton[data-action="delete"]', | ||
) | ||
.click({timeout: 1000}); | ||
await expect(page.locator(COMPONENT_LOCATOR)).not.toBeVisible({timeout: 1000}); | ||
await expect(page.locator(COMPONENT_LOCATOR)).toHaveCount(0, {timeout: 1000}); | ||
}); | ||
}); | ||
}); |
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,31 @@ | ||
import { test, expect } from "@playwright/test"; | ||
|
||
const loadPreset = async (preset) => { | ||
await fetch(`http://localhost:7358/${preset}`); | ||
} | ||
|
||
test.describe("image", () => { | ||
const TYPE = "image"; | ||
const COMPONENT_LOCATOR = `div.CoreImage.component`; | ||
|
||
test.beforeAll(async() => { | ||
await loadPreset('base'); | ||
}); | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.goto("/"); | ||
}); | ||
|
||
test("configure", async ({ page }) => { | ||
await page | ||
.locator(`div.component.button[data-component-type="${TYPE}"]`) | ||
.dragTo(page.locator(".CoreSection .ChildlessPlaceholder")); | ||
await page.locator(COMPONENT_LOCATOR).click(); | ||
await page | ||
.locator('.BuilderFieldsText[data-key="caption"] input') | ||
.fill("Hello, World!"); | ||
await expect(page.locator(COMPONENT_LOCATOR)).toContainText( | ||
"Hello, World!", | ||
); | ||
}); | ||
}); |
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 @@ | ||
runtime/ |
Oops, something went wrong.