-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First setup of e2e testing with playwright including github workflow.
- Loading branch information
Showing
14 changed files
with
232 additions
and
6 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,21 @@ | ||
{ | ||
"name": "crossmodel-e2e-tests", | ||
"version": "0.0.0", | ||
"private": true, | ||
"license": "AGPL-3.0-or-later", | ||
"author": { | ||
"name": "CrossBreeze", | ||
"email": "[email protected]" | ||
}, | ||
"scripts": { | ||
"build": "tsc --incremental && npx playwright install chromium", | ||
"clean": "rimraf lib tsconfig.tsbuildinfo", | ||
"lint": "eslint -c ../.eslintrc.js --ext .ts ./src", | ||
"prepare": "yarn clean && yarn build && yarn lint", | ||
"test": "yarn playwright test" | ||
}, | ||
"dependencies": { | ||
"@playwright/test": "^1.37.1", | ||
"@theia/playwright": "1.43.1" | ||
} | ||
} |
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,33 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2023 CrossBreeze. | ||
********************************************************************************/ | ||
import { defineConfig } from '@playwright/test'; | ||
|
||
export default defineConfig({ | ||
testDir: './src/tests', | ||
testMatch: ['**/*.test.ts'], | ||
workers: process.env.CI ? 1 : 2, | ||
retries: process.env.CI ? 1 : 0, | ||
// The number of times to repeat each test, useful for debugging flaky tests | ||
repeatEach: 1, | ||
// Timeout for each test in milliseconds. | ||
timeout: 30 * 1000, | ||
use: { | ||
baseURL: 'http://localhost:3000', | ||
browserName: 'chromium', | ||
screenshot: 'only-on-failure', | ||
viewport: { width: 1920, height: 1080 } | ||
}, | ||
snapshotDir: './src/tests/snapshots', | ||
expect: { | ||
toMatchSnapshot: { threshold: 0.01 } | ||
}, | ||
preserveOutput: 'failures-only', | ||
reporter: process.env.CI ? [['list'], ['html'], ['github']] : [['list'], ['html']], | ||
/* Run your local dev server before starting the tests */ | ||
webServer: { | ||
command: 'yarn --cwd ../../ start:browser', | ||
url: 'http://localhost:3000', | ||
reuseExistingServer: !process.env.CI | ||
} | ||
}); |
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,6 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2023 CrossBreeze. | ||
********************************************************************************/ | ||
import { TheiaApp } from '@theia/playwright'; | ||
|
||
export class CrossModelApp extends TheiaApp {} |
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,6 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2023 CrossBreeze. | ||
********************************************************************************/ | ||
import { TheiaWorkspace } from '@theia/playwright'; | ||
|
||
export class CrossModelWorkspace extends TheiaWorkspace {} |
14 changes: 14 additions & 0 deletions
14
e2e-tests/src/resources/sample-workspace/example-entity.cm
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,14 @@ | ||
entity: | ||
id: "ExampleEntity" | ||
name: "Example Entity" | ||
description: "An example entity" | ||
attributes: | ||
- id: "Id" | ||
name: "Id" | ||
datatype: "Integer" | ||
- id: "FirstAttribute" | ||
name: "First Attribute" | ||
datatype: "Varchar" | ||
- id: "SecondAttribute" | ||
name: "Second Attribute" | ||
datatype: "Varchar" |
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,49 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2023 CrossBreeze. | ||
********************************************************************************/ | ||
import { test, expect, Page } from '@playwright/test'; | ||
import { CrossModelApp } from '../page-objects/crossmodel-app'; | ||
|
||
let page: Page; | ||
let app: CrossModelApp; | ||
|
||
test.beforeAll(async ({ browser }) => { | ||
page = await browser.newPage(); | ||
app = await CrossModelApp.loadApp(page, CrossModelApp); | ||
}); | ||
|
||
test.describe('CrossModel is visible', () => { | ||
test('should show main content panel', async () => { | ||
expect(await app.isMainContentPanelVisible()).toBe(true); | ||
}); | ||
}); | ||
|
||
// test('Create new entity from workspace toolbar', async ({ page }) => { | ||
// const exampleEntityname = 'ExampleEntity'; | ||
// const exampleFileName = '${exampleEntityname}.entity.cm'; | ||
|
||
// await page.goto('http://localhost:3000/#/c:/git/GitHub/crossmodel/examples/yaml-example'); | ||
// await page.getByText('View').click(); | ||
// await page.getByText('Explorer').nth(3).click(); | ||
|
||
// // Store the location to the files list. | ||
// const explorerFilesList = await page.locator('#files'); | ||
|
||
// // The example file should not be in the workspace yet. | ||
// await expect(explorerFilesList).not.toContainText(exampleFileName); | ||
|
||
// // Create the entity. | ||
// await page.getByTitle('New Entity...').click(); | ||
// await page.getByPlaceholder('New Entity').fill(exampleEntityname); | ||
// await page.getByRole('button', { name: 'OK' }).click(); | ||
|
||
// // Expect the new file to be in the files list. | ||
// await expect(explorerFilesList.getByText(exampleFileName)).toBeVisible(); | ||
|
||
// // Now we delete the file. | ||
// await explorerFilesList.getByText(exampleFileName).click({ | ||
// button: 'right' | ||
// }); | ||
// await page.getByText('Delete').first().click(); | ||
// await page.getByRole('button', { name: 'OK' }).click(); | ||
// }); |
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 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2023 CrossBreeze. | ||
********************************************************************************/ | ||
import { test, expect, Page } from '@playwright/test'; | ||
import { CrossModelApp } from '../page-objects/crossmodel-app'; | ||
import { CrossModelWorkspace } from '../page-objects/crossmodel-workspace'; | ||
import { TheiaExplorerView } from '@theia/playwright'; | ||
|
||
let page: Page; | ||
let app: CrossModelApp; | ||
let explorer: TheiaExplorerView; | ||
|
||
test.describe('CrossModel Explorer View', () => { | ||
test.beforeAll(async ({ browser }) => { | ||
page = await browser.newPage(); | ||
const ws = new CrossModelWorkspace(['src/resources/sample-workspace']); | ||
app = await CrossModelApp.load(page, ws); | ||
explorer = await app.openView(TheiaExplorerView); | ||
await explorer.waitForVisibleFileNodes(); | ||
}); | ||
|
||
test('should open context menu on "example-entity.cm"', async () => { | ||
const file = await explorer.getFileStatNodeByLabel('example-entity.cm'); | ||
const menu = await file.openContextMenu(); | ||
expect(await menu.isOpen()).toBe(true); | ||
|
||
const menuItems = await menu.visibleMenuItems(); | ||
expect(menuItems).toContain('Open With...'); | ||
}); | ||
}); |
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 @@ | ||
{ | ||
"extends": "../configs/base.tsconfig.json", | ||
"compilerOptions": { | ||
"composite": true, | ||
"baseUrl": ".", | ||
"rootDir": ".", | ||
"outDir": "lib" | ||
}, | ||
"include": ["src/tests", "src/page-objects", "src/resources"] | ||
} |
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 |
---|---|---|
|
@@ -35,6 +35,9 @@ | |
}, | ||
{ | ||
"path": "packages/protocol" | ||
}, | ||
{ | ||
"path": "e2e-tests" | ||
} | ||
] | ||
} |
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 |
---|---|---|
|
@@ -1914,6 +1914,13 @@ | |
picocolors "^1.0.0" | ||
tslib "^2.6.0" | ||
|
||
"@playwright/test@^1.37.1": | ||
version "1.39.0" | ||
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.39.0.tgz#d10ba8e38e44104499e25001945f07faa9fa91cd" | ||
integrity sha512-3u1iFqgzl7zr004bGPYiN/5EZpRUSFddQBra8Rqll5N0/vfpqlP9I9EXqAoGacuAbX6c9Ulg/Cjqglp5VkK6UQ== | ||
dependencies: | ||
playwright "1.39.0" | ||
|
||
"@popperjs/core@^2.11.8": | ||
version "2.11.8" | ||
resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.8.tgz#6b79032e760a0899cd4204710beede972a3a185f" | ||
|
@@ -2423,6 +2430,14 @@ | |
"@theia/request" "1.43.1" | ||
semver "^7.5.4" | ||
|
||
"@theia/[email protected]": | ||
version "1.43.1" | ||
resolved "https://registry.yarnpkg.com/@theia/playwright/-/playwright-1.43.1.tgz#283b60c16b20b2ca4f3d206cb1f3df3addb41677" | ||
integrity sha512-g7CVN9rXJCRXN69m/GEo2VfAnvOupFgtMyIwS9VApmDbUI6oaVu159ekIiFxPI2pIReIbOsaeYlaJm7EWIPxHw== | ||
dependencies: | ||
"@playwright/test" "^1.37.1" | ||
fs-extra "^9.0.8" | ||
|
||
"@theia/[email protected]": | ||
version "1.43.1" | ||
resolved "https://registry.yarnpkg.com/@theia/plugin-ext-vscode/-/plugin-ext-vscode-1.43.1.tgz#4921f70116af1953af6bd93b9d36e9fa0c316166" | ||
|
@@ -7450,7 +7465,7 @@ fs-extra@^8.1.0: | |
jsonfile "^4.0.0" | ||
universalify "^0.1.0" | ||
|
||
fs-extra@^9.0.0, fs-extra@^9.0.1: | ||
fs-extra@^9.0.0, fs-extra@^9.0.1, fs-extra@^9.0.8: | ||
version "9.1.0" | ||
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.1.0.tgz#5954460c764a8da2094ba3554bf839e6b9a7c86d" | ||
integrity sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ== | ||
|
@@ -7488,6 +7503,11 @@ fs.realpath@^1.0.0: | |
resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" | ||
integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== | ||
|
||
[email protected]: | ||
version "2.3.2" | ||
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" | ||
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== | ||
|
||
fsevents@^2.3.2, fsevents@~2.3.2: | ||
version "2.3.3" | ||
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" | ||
|
@@ -11221,6 +11241,20 @@ [email protected]: | |
resolved "https://registry.yarnpkg.com/pkginfo/-/pkginfo-0.4.1.tgz#b5418ef0439de5425fc4995042dced14fb2a84ff" | ||
integrity sha512-8xCNE/aT/EXKenuMDZ+xTVwkT8gsoHN2z/Q29l80u0ppGEXVvsKRzNMbtKhg8LS8k1tJLAHHylf6p4VFmP6XUQ== | ||
|
||
[email protected]: | ||
version "1.39.0" | ||
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.39.0.tgz#efeaea754af4fb170d11845b8da30b2323287c63" | ||
integrity sha512-+k4pdZgs1qiM+OUkSjx96YiKsXsmb59evFoqv8SKO067qBA+Z2s/dCzJij/ZhdQcs2zlTAgRKfeiiLm8PQ2qvw== | ||
|
||
[email protected]: | ||
version "1.39.0" | ||
resolved "https://registry.yarnpkg.com/playwright/-/playwright-1.39.0.tgz#184c81cd6478f8da28bcd9e60e94fcebf566e077" | ||
integrity sha512-naE5QT11uC/Oiq0BwZ50gDmy8c8WLPRTEWuSSFVG2egBka/1qMoSqYQcROMT9zLwJ86oPofcTH2jBY/5wWOgIw== | ||
dependencies: | ||
playwright-core "1.39.0" | ||
optionalDependencies: | ||
fsevents "2.3.2" | ||
|
||
plist@^3.0.1, plist@^3.0.4: | ||
version "3.1.0" | ||
resolved "https://registry.yarnpkg.com/plist/-/plist-3.1.0.tgz#797a516a93e62f5bde55e0b9cc9c967f860893c9" | ||
|