-
Notifications
You must be signed in to change notification settings - Fork 159
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 #10374 from owncloud/test/design-system-docs-tests
[tests-only] test: add design system docs tests
- Loading branch information
Showing
10 changed files
with
154 additions
and
7 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
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,52 @@ | ||
import { defineConfig, devices } from '@playwright/test' | ||
|
||
export default defineConfig({ | ||
testDir: './', | ||
testMatch: /.*\.spec\.ts/, | ||
fullyParallel: true, | ||
forbidOnly: process.env.CI === 'true', | ||
retries: process.env.CI === 'true' ? 2 : 0, | ||
workers: process.env.CI === 'true' ? 1 : undefined, | ||
reporter: 'html', | ||
|
||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] } | ||
} | ||
|
||
// Running these browsers currently produces an error in drone CI due to missing deps (even when they are installed first) | ||
// { | ||
// name: 'firefox', | ||
// use: { ...devices['Desktop Firefox'] } | ||
// }, | ||
|
||
// { | ||
// name: 'webkit', | ||
// use: { ...devices['Desktop Safari'] } | ||
// } | ||
|
||
// The mobile view of docs is currently pretty junky and causes various false negatives on mobile tests | ||
// { | ||
// name: 'Mobile Chrome', | ||
// use: { ...devices['Pixel 5'] } | ||
// }, | ||
|
||
// { | ||
// name: 'Mobile Safari', | ||
// use: { ...devices['iPhone 12'] } | ||
// } | ||
], | ||
|
||
webServer: { | ||
command: 'NODE_ENV=production pnpm start', | ||
url: 'http://127.0.0.1:6060', | ||
reuseExistingServer: process.env.CI !== 'true', | ||
// Timeout is intentionally pretty high here due to the server boot taking a long time | ||
timeout: 5 * 60 * 1000 | ||
}, | ||
|
||
use: { | ||
baseURL: 'http://127.0.0.1:6060' | ||
} | ||
}) |
21 changes: 21 additions & 0 deletions
21
packages/design-system/tests/e2e/specs/component-example.spec.ts
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,21 @@ | ||
import { test, expect } from '@playwright/test' | ||
|
||
const SELECTORS = Object.freeze({ | ||
previewWrapper: '[data-testid="preview-wrapper"]', | ||
codemirrorHtml: '[data-testid="codemirror-html"]', | ||
// We're using class here instead of data attribute because we cannot adjust the default preview component | ||
// The class is coming from the specified theme | ||
codemirrorVue: '.cm-s-night', | ||
tabHtml: '[data-testid="preview-tab-html"]' | ||
}) | ||
|
||
test('Components preview is displayed', async ({ page, baseURL }) => { | ||
await page.goto((baseURL || '') + '/#/' + encodeURIComponent('oC Components') + '/OcButton') | ||
|
||
await expect(page.locator(SELECTORS.previewWrapper)).toBeVisible() | ||
await expect(page.locator(SELECTORS.codemirrorVue)).toBeVisible() | ||
|
||
await page.locator(SELECTORS.tabHtml).click() | ||
|
||
await expect(page.locator(SELECTORS.codemirrorHtml)).toBeVisible() | ||
}) |
13 changes: 13 additions & 0 deletions
13
packages/design-system/tests/e2e/specs/components-list.spec.ts
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,13 @@ | ||
import { test, expect } from '@playwright/test' | ||
|
||
const SELECTORS = Object.freeze({ | ||
listWrapper: '[data-testid="components-list"]', | ||
listRow: '[data-testid="component-list-row"]' | ||
}) | ||
|
||
test('Components list is loaded', async ({ page, baseURL }) => { | ||
await page.goto(baseURL || '') | ||
|
||
await expect(page.locator(SELECTORS.listWrapper)).toBeVisible() | ||
expect((await page.$$(SELECTORS.listRow)).length).toBeGreaterThan(10) | ||
}) |
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