Few fixes and uitest local setup (#1698)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2022-05-10 14:31:46 +07:00 committed by GitHub
parent b8e942a145
commit e6a69e0012
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 279 additions and 88 deletions

View File

@ -221,6 +221,7 @@ specifiers:
cross-env: ~7.0.3
css-loader: ^5.2.1
deep-equal: ^2.0.5
dotenv: ~16.0.0
dotenv-webpack: ^7.0.2
elastic-apm-node: ~3.26.0
esbuild: ^0.12.26
@ -499,6 +500,7 @@ dependencies:
cross-env: 7.0.3
css-loader: 5.2.7_webpack@5.72.0
deep-equal: 2.0.5
dotenv: 16.0.0
dotenv-webpack: 7.1.0_webpack@5.72.0
elastic-apm-node: 3.26.0
esbuild: 0.12.29
@ -3986,6 +3988,10 @@ packages:
which: 2.0.2
dev: false
/crossenv/0.0.2-security:
resolution: {integrity: sha512-Zet/ldwzo70I+vUnjM9yHCWo2iqK/RM2s2VnZDNPE/fN062UXYXGqu9Hd7HlhNVhnYGclPcjNoySWhug5lctHw==}
dev: false
/crypto-browserify/3.12.0:
resolution: {integrity: sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==}
dependencies:
@ -4362,6 +4368,11 @@ packages:
webpack: 5.72.0_7c84ffaa370635508ab32134092fd9e6
dev: false
/dotenv/16.0.0:
resolution: {integrity: sha512-qD9WU0MPM4SWLPJy/r2Be+2WgQj8plChsyrCNQzW/0WjvcJQiKQJ9mH3ZgB3fxbUUxgc/11ZJ0Fi5KiimWGz2Q==}
engines: {node: '>=12'}
dev: false
/dotenv/8.6.0:
resolution: {integrity: sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==}
engines: {node: '>=10'}
@ -11345,7 +11356,7 @@ packages:
dev: false
file:projects/lead-resources.tgz_3b42a51b6c974062237d417c554d9dd7:
resolution: {integrity: sha512-DJcccWBN2NZjSzA9BIYJ9e97T5uI4gloTq7kv5OBp7mhb11PxOkyhjDUYb1Gt4Nansb/sKY47PGM7DQMdpM/fA==, tarball: file:projects/lead-resources.tgz}
resolution: {integrity: sha512-5M9TPnl9Wl//MlBtIqp8diRMslpjOO0pdoq++OxgKqxG5+MUXq+TRQ6hmllrwWrEaC4olqeWng8QwoL/3InoUw==, tarball: file:projects/lead-resources.tgz}
id: file:projects/lead-resources.tgz
name: '@rush-temp/lead-resources'
version: 0.0.0
@ -11690,7 +11701,7 @@ packages:
dev: false
file:projects/model-gmail.tgz_typescript@4.6.4:
resolution: {integrity: sha512-RdbwzeNq4CCj2gmLcX2yEuRIJ75Ef9D3X6uvvUuphtptIyHwoBSN9KhyYECOdmGENPMZ91vcN2nIQ/kcfJ3dSg==, tarball: file:projects/model-gmail.tgz}
resolution: {integrity: sha512-XTdDMP11w2lLg0pv8xOojS11EOVLMuNWuYHfV4aUDtOaxymw54JThBmjtQMjnX5J2egfYPOzkMT4j21jWilG7A==, tarball: file:projects/model-gmail.tgz}
id: file:projects/model-gmail.tgz
name: '@rush-temp/model-gmail'
version: 0.0.0
@ -12109,7 +12120,7 @@ packages:
dev: false
file:projects/model-server-tags.tgz_typescript@4.6.4:
resolution: {integrity: sha512-3gYd9Fqn14RrH+ggOuN5xm649WX+T0TneAzeCSHir9SQ/xFoKfDFGt2ZXqpoKsSzoj0S+xiLFcCwJRuQBZSIiw==, tarball: file:projects/model-server-tags.tgz}
resolution: {integrity: sha512-AUDCjZU0pshZbC3MJebYSdN3rYk1b26NBvK4i4i3bGigNTk87iMcsklvAV7ELzpDmdK8X2y5yefVTjIuSzV99g==, tarball: file:projects/model-server-tags.tgz}
id: file:projects/model-server-tags.tgz
name: '@rush-temp/model-server-tags'
version: 0.0.0
@ -12193,7 +12204,7 @@ packages:
dev: false
file:projects/model-tags.tgz_typescript@4.6.4:
resolution: {integrity: sha512-GQBqrjSFtAqLpHOqF5ghBDAT7gicvAvjidrcPWSep8qxdtCfMQeod+kK84Wwa8GyqKWwJXPpdGJ3wr7JJ/iSSA==, tarball: file:projects/model-tags.tgz}
resolution: {integrity: sha512-Jtn9TqYJBOU0QorXLkQ0m4WUbPMMwp3ShWwgK2WWqChNY3YXPn75iPze7K2ks6HRcX1Kv5i8pE5Rx4kLngT0Vw==, tarball: file:projects/model-tags.tgz}
id: file:projects/model-tags.tgz
name: '@rush-temp/model-tags'
version: 0.0.0
@ -12235,7 +12246,7 @@ packages:
dev: false
file:projects/model-telegram.tgz_typescript@4.6.4:
resolution: {integrity: sha512-GEtDeiXxFFRQHNv9bk0z1Gkxhoc5xxkjJ+WzG1S13dtyJGIyk1fFs5YH4JgdTdZab3hSEh/wPCopcQGJNbfBfQ==, tarball: file:projects/model-telegram.tgz}
resolution: {integrity: sha512-bUv6bj9v/QZo85UlGkLqoZpjBScI5tWt603H89gChID6GMWWf1MPcAcSzf1A9y++cf6rBfzkJGxPDR/Lyqqf/w==, tarball: file:projects/model-telegram.tgz}
id: file:projects/model-telegram.tgz
name: '@rush-temp/model-telegram'
version: 0.0.0
@ -12722,7 +12733,7 @@ packages:
dev: false
file:projects/prod.tgz_de7e4eae5aef826b485231087765ce17:
resolution: {integrity: sha512-oip9hXWG+aDfTCcHHdQJUl7f5d7972yiDkuty9M6wJsoO8QYNqksNZdEGOfXZ9KRVLptZzF2YIrD9vLkVKsCBg==, tarball: file:projects/prod.tgz}
resolution: {integrity: sha512-QATm8tinHt8huisQGumkIxn/Ew4j8Bez88PjoKLuXhybtp5uhZh67ooqqvbN9V+RPaR/827nktjzSzS1vZ6ZQQ==, tarball: file:projects/prod.tgz}
id: file:projects/prod.tgz
name: '@rush-temp/prod'
version: 0.0.0
@ -12811,7 +12822,7 @@ packages:
dev: false
file:projects/recruit-resources.tgz_3b42a51b6c974062237d417c554d9dd7:
resolution: {integrity: sha512-iWq9sg+XXzoC3ecYPwYAhInnaBIm98dLhvOpbEWjbcKFOmLSf4ztq5m4nmboSk5QXcdrYABCW35P+J0MzWLP4Q==, tarball: file:projects/recruit-resources.tgz}
resolution: {integrity: sha512-OxF1ziRrkx3riQOXPd/WddVOsuCIYIfnDQu3MkK3WdddvaqiQKx0H5X9FKJ9NsNGjiibzCUll/CxaY8fKJSbCw==, tarball: file:projects/recruit-resources.tgz}
id: file:projects/recruit-resources.tgz
name: '@rush-temp/recruit-resources'
version: 0.0.0
@ -13140,7 +13151,7 @@ packages:
dev: false
file:projects/server-gmail.tgz:
resolution: {integrity: sha512-g+TzFaM45DkhmqUz0+7HF58CYRdLnMFab0RE+bDewPUqdrCoC3e030mOCfLt1ENC300vTDg6f/ah25U2D5A+iw==, tarball: file:projects/server-gmail.tgz}
resolution: {integrity: sha512-9NU+Kd3Z88tm8NDGrF2EQ1m3iVEgOIJJMe2039gshXre3b1C+1kffuOVpAqw1VQ2wWnv/YCXfSXDSxjL1fxAhQ==, tarball: file:projects/server-gmail.tgz}
name: '@rush-temp/server-gmail'
version: 0.0.0
dependencies:
@ -13387,7 +13398,7 @@ packages:
dev: false
file:projects/server-tags-resources.tgz:
resolution: {integrity: sha512-E2iqmW0oKyUdpwMW7P5UohGfGRpF2W9q5waJaveJ3rJrWAGO5rXlYXTQZlJYXah504IyZTvFHx3qA9vujyHjYg==, tarball: file:projects/server-tags-resources.tgz}
resolution: {integrity: sha512-CY3E48W6RJebCBO7JKfbY8F4XsnnHAMs58cZQ0iP6vTroqlh6W6gIAlY1FhgnwWmJ4rme4P+Pr32f2swj5v/mA==, tarball: file:projects/server-tags-resources.tgz}
name: '@rush-temp/server-tags-resources'
version: 0.0.0
dependencies:
@ -13489,7 +13500,7 @@ packages:
dev: false
file:projects/server-telegram.tgz:
resolution: {integrity: sha512-F573/9FLQ7a889bKv3Nu0lhSpgtepSKUDYnlWkZbw/tXDCQi1YkcIckMXj4cDswrokSEOYUsPlLFVcVhQR060A==, tarball: file:projects/server-telegram.tgz}
resolution: {integrity: sha512-b1TXvzhjCNsQd8Cjkf15fhXc+rhVIR/sBFV8LfPhUIyIWAwyiuETlxQyK4frA6V+KxSFxpYvHdWJfpg1GvGasA==, tarball: file:projects/server-telegram.tgz}
name: '@rush-temp/server-telegram'
version: 0.0.0
dependencies:
@ -13693,7 +13704,7 @@ packages:
dev: false
file:projects/tags-assets.tgz:
resolution: {integrity: sha512-k6wSMXFCynhIS5HHOUidG/NOcCmiknZQq3dTtkPxoTo5Ozp8z2IA0RnXObLmU3vW1g2Xjvvin28jS7zbFtD9Dg==, tarball: file:projects/tags-assets.tgz}
resolution: {integrity: sha512-qNvxnKOAEkdjQdv8hiRrflumwk/hUIZIIEhrbOVgwTi0YDZzBQpR+J65TpvXq+R1ZokUx1+wW7PtGfmnU53BjQ==, tarball: file:projects/tags-assets.tgz}
name: '@rush-temp/tags-assets'
version: 0.0.0
dependencies:
@ -13714,7 +13725,7 @@ packages:
dev: false
file:projects/tags-resources.tgz_3b42a51b6c974062237d417c554d9dd7:
resolution: {integrity: sha512-0y4GuvYo3baQBbXOdZCnnzZEPqenSU84lxUXllG1Pj0ryRtqLu/gbhsvP9nsTMdJ603cKwOLqi3tzQ6rIxWVoQ==, tarball: file:projects/tags-resources.tgz}
resolution: {integrity: sha512-zcvJZS/Xb8SBYoEDWoDc0QD/O3cCu5a1DciPIPX0fhcq3qDWOBETmQ8LI4b1cSthT2Af++RGYK/n6IwkjnqPnA==, tarball: file:projects/tags-resources.tgz}
id: file:projects/tags-resources.tgz
name: '@rush-temp/tags-resources'
version: 0.0.0
@ -13792,7 +13803,7 @@ packages:
dev: false
file:projects/task-resources.tgz_8aa3038c4a34f0944bc8ec8757e97eb6:
resolution: {integrity: sha512-YnDw17gb0l23sVvN43GwXTuLuGulcsUTrEEuSPYzmdyDBYHwE0hJk9LGnfMGXB/JceV9CZtXKpjMmYAsLcAWQQ==, tarball: file:projects/task-resources.tgz}
resolution: {integrity: sha512-gMHNRt5fk0W1lbysFRezfyS9gnvspaqSpTUHouTjzhK1+xEXGo1awhwS77ABQarzbB75ahuv7Ue74qxi3SZ51Q==, tarball: file:projects/task-resources.tgz}
id: file:projects/task-resources.tgz
name: '@rush-temp/task-resources'
version: 0.0.0
@ -14000,7 +14011,7 @@ packages:
dev: false
file:projects/tests-sanity.tgz:
resolution: {integrity: sha512-Xfx91DlPr7eglDH44tKLyGmYLIh271jtLyjTkiFmRPbjd/lFtvrkv94JpE93pc7Pi41SDeLtcMz7Wn3rbMO/Ag==, tarball: file:projects/tests-sanity.tgz}
resolution: {integrity: sha512-r+nwe5kymwtXB8TylNdjVZ2NSxDyEHqMj/HQbYz/+AmCEAQ/KnWZCdO8HiIkL4/E75gGCwmMo6b8N7GsoIs69A==, tarball: file:projects/tests-sanity.tgz}
name: '@rush-temp/tests-sanity'
version: 0.0.0
dependencies:
@ -14009,6 +14020,9 @@ packages:
'@types/node': 16.11.33
'@typescript-eslint/eslint-plugin': 5.22.0_27efc1da00e78084f5aa1809ff6483a1
'@typescript-eslint/parser': 5.22.0_eslint@7.32.0+typescript@4.6.4
cross-env: 7.0.3
crossenv: 0.0.2-security
dotenv: 16.0.0
eslint: 7.32.0
eslint-config-standard-with-typescript: 21.0.1_d91f81f4c73639e41ff8a6e8953d9ef2
eslint-plugin-import: 2.26.0_eslint@7.32.0
@ -14103,7 +14117,7 @@ packages:
dev: false
file:projects/tool.tgz:
resolution: {integrity: sha512-BIlpIxU05/vO7Eq24gI3FhzeurLfpWc2dMCwULFBogj1jO1/TEVQRbD+K9lA0xgEvoeLDTPY/AU0ZXgL4m/Dnw==, tarball: file:projects/tool.tgz}
resolution: {integrity: sha512-F55vTTO/9oh6IInFdnFBe1RJdOJ5RG7R++gf7t46Eo7l4T7XLFLRpXssTqi0ZVMFF3qIctlhcFJ/8TJKGr7XfQ==, tarball: file:projects/tool.tgz}
name: '@rush-temp/tool'
version: 0.0.0
dependencies:
@ -14280,7 +14294,7 @@ packages:
dev: false
file:projects/view-resources.tgz_3b42a51b6c974062237d417c554d9dd7:
resolution: {integrity: sha512-wkPu+bhL6wDElSzInn+jTlRWK9o9whs2S0j8n3JF5OORAhkjDtteCKRy8XI3ox3TOm8EIY6jPKwGqxrqYShUCQ==, tarball: file:projects/view-resources.tgz}
resolution: {integrity: sha512-3wR1mN5HyfqA1Kl5zeGA3dZf6UAu35FXWL/RYZN9/wvKAehyLH01K3nEUwI3cDXhghyPirrZ4MSEfs1x5/PBSw==, tarball: file:projects/view-resources.tgz}
id: file:projects/view-resources.tgz
name: '@rush-temp/view-resources'
version: 0.0.0

View File

@ -37,6 +37,7 @@
export let click: boolean = false
export let title: string | undefined = undefined
export let borderStyle: 'solid' | 'dashed' = 'solid'
export let id: string | undefined = undefined
export let input: HTMLButtonElement | undefined = undefined
@ -75,6 +76,7 @@
on:focus
on:blur
on:mousemove
{id}
>
{#if icon && !loading}
<div

View File

@ -183,6 +183,7 @@
>
{#each displayItems as item, i}
<Button
id={item.label}
bind:input={btns[i]}
icon={item.icon}
{kind}
@ -204,6 +205,7 @@
{/each}
{#if actions.length > 0 && editable}
<Button
id={presentation.string.AddSocialLinks}
bind:input={addBtn}
icon={contact.icon.SocialEdit}
label={displayItems.length === 0 ? presentation.string.AddSocialLinks : undefined}

View File

@ -27,6 +27,7 @@
export let attachedClass: Ref<Class<Doc>>
export let integrations: Set<Ref<Doc>> | undefined = undefined
export let editable = true
export let allowOpen = true
export let kind: ButtonKind = 'link-bordered'
export let size: ButtonSize = 'small'
@ -107,7 +108,7 @@
function _open (ev: any) {
if (ev.detail.presenter !== undefined && Array.isArray(channels)) {
const channel = channels[0]
if (channel !== undefined) {
if (channel !== undefined && allowOpen) {
closeTooltip()
showPopup(ev.detail.presenter, { _id: channel.attachedTo, _class: channel.attachedToClass }, 'float')
}

View File

@ -108,7 +108,7 @@
</div>
</div>
<div class="separator" />
<ChannelsEditor attachedTo={employee._id} attachedClass={employee._class} />
<ChannelsEditor attachedTo={employee._id} attachedClass={employee._class} allowOpen={false} />
</div>
</div>
{/if}

View File

@ -124,7 +124,7 @@
{
key: '$lookup.category',
presenter: tags.component.CategoryPresenter,
sortingKey: '$lookup.category',
sortingKey: 'category',
label: tags.string.CategoryLabel
}
]

19
tests/create-local.sh Executable file
View File

@ -0,0 +1,19 @@
export MINIO_ACCESS_KEY=minioadmin
export MINIO_SECRET_KEY=minioadmin
export MINIO_ENDPOINT=localhost:9000
export MONGO_URL=mongodb://localhost:27017
export TRANSACTOR_URL=ws:/localhost:3333
export ELASTIC_URL=http://localhost:9200
# Create workspace record in accounts
node ../dev/tool/bundle.js create-workspace sanity-ws -o SanityTest
# Create user record in accounts
node ../dev/tool/bundle.js create-account user1 -f John -l Appleseed -p 1234
# Restore workspace contents in mongo/elastic
node ../dev/tool/bundle.js restore-workspace sanity-ws sanity-ws/
# Re-assign user to workspace.
node ../dev/tool/bundle.js assign-workspace user1 sanity-ws

63
tests/readme.md Normal file
View File

@ -0,0 +1,63 @@
# UI Sanity testing using play-wright
## Prepare environment with docker to test final product.
```bash
rush update
rush build
rush bundle
rush docker:build
./prepare.sh
```
### Restore to pure DB
To purge content of sanity workspace following command could be used.
```bash
./restore-workdspace.sh
```
## Prepare local dev enviornment
```bash
rush update
rush build
rush bundle
./create-local.sh
```
### Restore to pure DB for Local setup
To purge content of sanity workspace following command could be used.
```bash
./restore-local.sh
```
## Running UI tests
```bash
cd ./sanity
rushx uitest # for docker setup
rushx dev-uitest # for dev setup
```
## Debugging UI tests
```bash
cd ./sanity
rushx debug -g test-name # for docker setup
rushx dev-debug -g test-name # for local setup
```
## Capturing new testing scenarios
```bash
rushx codegen # for docker setup
ruwhx dev-codegen # for local setup
```
## Test authoring.
Please update all navigation with using PlatformURI for CI and dev environment compatible testing.

14
tests/restore-local.sh Executable file
View File

@ -0,0 +1,14 @@
export MINIO_ACCESS_KEY=minioadmin
export MINIO_SECRET_KEY=minioadmin
export MINIO_ENDPOINT=localhost:9000
export MONGO_URL=mongodb://localhost:27017
export TRANSACTOR_URL=ws:/localhost:3333
export ELASTIC_URL=http://localhost:9200
# Restore workspace contents in mongo/elastic
node ../dev/tool/bundle.js restore-workspace sanity-ws sanity-ws/
# Re-assign user to workspace.
node ../dev/tool/bundle.js assign-workspace user1 sanity-ws

5
tests/sanity/.env Normal file
View File

@ -0,0 +1,5 @@
PLATFORM_URI='http://localhost:8083'
PLATFORM_TRANSACTOR='ws://localhost:3334'
PLATFORM_USER='user1'
PLATFORM_TOKEN='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InVzZXIxIiwid29ya3NwYWNlIjoic2FuaXR5LXdzIn0.hfUCqePHO-WNps2by4B-CYGKIpDpLG0WVCUUtU-SVI4'
SETTING=storage.json

View File

@ -13,8 +13,11 @@
"ci": "playwright install --with-deps chromium",
"test": "",
"uitest": "playwright test --browser chromium --reporter list,html -c ./tests/playwright.config.ts",
"dev-uitest": "cross-env PLATFORM_URI=http://localhost:8080 PLATFORM_TRANSACTOR=ws://localhost:3333 SETTING=storage-dev.json playwright test --browser chromium --reporter list,html -c ./tests/playwright.config.ts",
"debug": "playwright test --browser chromium -c ./tests/playwright.config.ts --debug --headed",
"codegen": "playwright codegen --load-storage storage.json http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp"
"dev-debug": "cross-env PLATFORM_URI=http://localhost:8080 PLATFORM_TRANSACTOR=ws://localhost:3333 SETTING=storage-dev.json playwright test --browser chromium -c ./tests/playwright.config.ts --debug --headed",
"codegen": "playwright codegen --load-storage storage.json http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp",
"dev-codegen": "cross-env playwright codegen --load-storage storage-dev.json http://localhost:8080/workbench%3Acomponent%3AWorkbenchApp"
},
"devDependencies": {
"@anticrm/platform-rig": "~0.6.0",
@ -30,5 +33,9 @@
"prettier": "^2.4.1",
"typescript": "^4.3.5",
"@playwright/test": "~1.18.0"
},
"dependencies": {
"dotenv": "~16.0.0",
"cross-env": "~7.0.3"
}
}

View File

@ -0,0 +1,26 @@
{
"cookies": [],
"origins": [
{
"origin": "http://localhost:8080",
"localStorage": [
{
"name": "login:metadata:LoginEmail",
"value": "user1"
},
{
"name": "login:metadata:LoginToken",
"value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InVzZXIxIiwid29ya3NwYWNlIjoic2FuaXR5LXdzIn0.hfUCqePHO-WNps2by4B-CYGKIpDpLG0WVCUUtU-SVI4"
},
{
"name": "login:metadata:CurrentWorkspace",
"value": "sanity-ws"
},
{
"name": "login:metadata:LoginEndpoint",
"value": "ws://localhost:3333"
}
]
}
]
}

View File

@ -1,10 +1,14 @@
import { expect, test } from '@playwright/test'
import { generateId, openWorkbench } from './utils'
import { generateId, PlatformSetting, PlatformURI } from './utils'
test.use({
storageState: PlatformSetting
})
test.describe('contact tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await openWorkbench(page)
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
})
test('create-contact', async ({ page }) => {
// Create a new context with the saved storage state.

View File

@ -1,4 +1,5 @@
import { test, expect } from '@playwright/test'
import { expect, test } from '@playwright/test'
import { PlatformURI, PlatformUser } from './utils'
test.describe('login test', () => {
test('check login', async ({ page }) => {
@ -8,11 +9,11 @@ test.describe('login test', () => {
})
// Create user and workspace
await page.goto('http://localhost:8083/login%3Acomponent%3ALoginApp/login')
await page.goto(`${PlatformURI}/login%3Acomponent%3ALoginApp/login`)
const emaillocator = page.locator('[name=email]')
await emaillocator.click()
await emaillocator.fill('user1')
await emaillocator.fill(PlatformUser)
const password = page.locator('[name=current-password]')
await password.click()

View File

@ -1,4 +1,7 @@
import { PlaywrightTestConfig } from '@playwright/test'
import { config as dotenvConfig } from 'dotenv'
dotenvConfig()
const config: PlaywrightTestConfig = {
use: {
screenshot: 'only-on-failure'

View File

@ -1,10 +1,14 @@
import { expect, test } from '@playwright/test'
import { generateId, openWorkbench } from './utils'
import { generateId, PlatformSetting, PlatformURI } from './utils'
test.use({
storageState: PlatformSetting
})
test.describe('recruit tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await openWorkbench(page)
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
})
test('create-candidate', async ({ page, context }) => {
await page.locator('[id="app-recruit\\:string\\:RecruitApplication"]').click()

View File

@ -1,55 +1,57 @@
import { expect, test } from '@playwright/test'
import { generateId, openWorkbench } from './utils'
import { generateId, PlatformSetting, PlatformURI } from './utils'
test.use({
storageState: PlatformSetting
})
test.describe('contact tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await openWorkbench(page)
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
})
test('update-profile', async ({ page, context }) => {
// Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp
await page.goto('http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp')
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
// Click #profile-button
await page.click('#profile-button')
// Click text=Setting
await page.click('text=Setting')
await expect(page).toHaveURL(
'http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/setting%3Aids%3ASettingApp/setting'
`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/setting%3Aids%3ASettingApp/setting`
)
// Click text=Edit profile
await page.click('text=Edit profile')
await expect(page).toHaveURL(
'http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/setting%3Aids%3ASettingApp/profile'
`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/setting%3Aids%3ASettingApp/profile`
)
// Click [placeholder="Location"]
await page.click('[placeholder="Location"]')
// Fill [placeholder="Location"]
await page.fill('[placeholder="Location"]', 'LoPlaza')
// Click .flex-center.icon-button
await page.click('text=Edit profile John Appleseed LoPlaza >> button')
// await page.click('button:has-text("Add social links")')
// Click [placeholder="john\.appleseed\@apple\.com"]
await page.click('button:has-text("Email")')
// Fill [placeholder="john\.appleseed\@apple\.com"]
if ((await page.locator('[id="gmail:string:Email"]').count()) === 0) {
await page.click('[id="presentation:string:AddSocialLinks"]')
await page.click('button:has-text("Email")')
}
await page.hover('[id="gmail:string:Email"]')
await page.click('text=Edit profile John Appleseed LoPlaza >> button')
await page.fill('[placeholder="john\\.appleseed\\@apple\\.com"]', 'wer@qwe.com')
// Click text=Apply
await page.click('button:nth-child(3)')
await page.click('button:nth-child(4)')
})
test('create-template', async ({ page }) => {
// Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp
await page.goto('http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp')
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
// Click #profile-button
await page.click('#profile-button')
// Click text=Templates
await page.click('text=Templates')
await expect(page).toHaveURL(
'http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/setting%3Aids%3ASettingApp/message-templates'
`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/setting%3Aids%3ASettingApp/message-templates`
)
// Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/setting%3Aids%3ASettingApp/message-templates
await page.goto(
'http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/setting%3Aids%3ASettingApp/message-templates'
)
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/setting%3Aids%3ASettingApp/message-templates`)
// Click .flex-center.icon-button
await page.click('#create-template >> .flex-center.icon-button')
// Click [placeholder="New\ template"]
@ -74,13 +76,13 @@ test.describe('contact tests', () => {
test('manage-status-templates', async ({ page }) => {
// Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp
await page.goto('http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp')
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
// Click #profile-button
await page.click('#profile-button')
// Click text=Manage Statuses
await page.click('text=Manage Statuses')
await expect(page).toHaveURL(
'http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/setting%3Aids%3ASettingApp/statuses'
`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/setting%3Aids%3ASettingApp/statuses`
)
// Click text=Vacancies
await page.click('text=Vacancies')

View File

@ -1,21 +1,25 @@
import { expect, test } from '@playwright/test'
import { generateId, openWorkbench } from './utils'
import { generateId, PlatformSetting, PlatformURI } from './utils'
test.use({
storageState: PlatformSetting
})
test.describe('recruit tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await openWorkbench(page)
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
})
test('create-candidate-with-skill', async ({ page }) => {
// Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp
await page.goto('http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp')
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
// Click [id="app-recruit\:string\:RecruitApplication"]
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
await expect(page).toHaveURL('http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit')
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit`)
// Click text=Candidates
await page.click('text=Candidates')
await expect(page).toHaveURL(
'http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit/candidates'
`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit/candidates`
)
// Click button:has-text("Candidate")
await page.click('button:has-text("Candidate")')
@ -45,15 +49,13 @@ test.describe('recruit tests', () => {
test('create-tag-candidate', async ({ page }) => {
// Go to http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp
await page.goto('http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp')
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
// Click [id="app-recruit\:string\:RecruitApplication"]
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
await expect(page).toHaveURL('http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit')
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit`)
// Click text=Skills
await page.click('text=Skills')
await expect(page).toHaveURL(
'http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit/skills'
)
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit/skills`)
// Click button:has-text("Skill")
await page.click('button:has-text("Skill")')
// Click [placeholder="Please\ type\ skill\ title"]
@ -77,7 +79,7 @@ test.describe('recruit tests', () => {
// Click text=Candidates
await page.click('text=Candidates')
await expect(page).toHaveURL(
'http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit/candidates'
`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit/candidates`
)
// Click button:has-text("Candidate")
await page.click('button:has-text("Candidate")')

View File

@ -0,0 +1,36 @@
import { test, expect } from '@playwright/test'
import { PlatformSetting, PlatformURI } from './utils'
test.use({
storageState: PlatformSetting
})
test('create-issue', async ({ page }) => {
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
// Click [id="app-tracker\:string\:TrackerApplication"]
await page.click('[id="app-tracker\\:string\\:TrackerApplication"]')
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/tracker%3Aapp%3ATracker`)
// Click button:has-text("New issue")
await page.click('button:has-text("New issue")')
// Click [placeholder="Issue\ title"]
await page.click('[placeholder="Issue\\ title"]')
// Fill [placeholder="Issue\ title"]
await page.fill('[placeholder="Issue\\ title"]', 'test-issue')
// Click p
await page.fill('.ProseMirror', 'some description')
// Click button:has-text("Backlog")
await page.click('button:has-text("Backlog")')
// Click button:has-text("Todo")
await page.click('button:has-text("Todo")')
// Click button:has-text("No priority")
await page.click('button:has-text("No priority")')
// Click button:has-text("Urgent")
await page.click('button:has-text("Urgent")')
// Click button:has-text("Save issue")
await page.click('button:has-text("Save issue")')
// Click text=Issues Active Backlog Board Projects >> span
await page.click('text=Issues Active Backlog Board Projects >> span')
await expect(page).toHaveURL(
`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/tracker%3Aapp%3ATracker/tracker%3Ateam%3ADefaultTeam/issues`
)
// Click text=TSK-1
await page.click('text=TSK-1')
})

View File

@ -1,25 +1,8 @@
import { Page } from '@playwright/test'
export async function openWorkbench (page: Page): Promise<void> {
page.on('pageerror', (exception) => {
console.log('Uncaught exception:')
console.log(exception.message)
})
await page.goto('http://localhost:8083/login%3Acomponent%3ALoginApp/login')
await page.evaluate(() => {
localStorage.setItem(
'login:metadata:LoginToken',
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InVzZXIxIiwid29ya3NwYWNlIjoic2FuaXR5LXdzIn0.hfUCqePHO-WNps2by4B-CYGKIpDpLG0WVCUUtU-SVI4'
)
localStorage.setItem('login:metadata:LoginEmail', 'user1')
localStorage.setItem('login:metadata:LoginEndpoint', 'ws://localhost:3334')
})
await page.goto('http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp')
await page.waitForSelector('[id="app-contact\\:string\\:Contacts"]')
}
export const PlatformURI = process.env.PLATFORM_URI as string
export const PlatformTransactor = process.env.PLATFORM_TRANSACTOR as string
export const PlatformUser = process.env.PLATFORM_USER as string
export const PlatformToken = process.env.PLATFORM_TOKEN as string
export const PlatformSetting = process.env.SETTING as string
function toHex (value: number, chars: number): string {
const result = value.toString(16)

View File

@ -1,28 +1,31 @@
import { expect, test } from '@playwright/test'
import { openWorkbench } from './utils'
import { PlatformSetting, PlatformURI } from './utils'
test.use({
storageState: PlatformSetting
})
test.describe('workbench tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await openWorkbench(page)
await page.goto(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp`)
})
test('navigator', async ({ page }) => {
// Click [id="app-recruit\:string\:RecruitApplication"]
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
await expect(page).toHaveURL('http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit')
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit`)
// Click text=Applications
await page.click('text=Applications')
await expect(page).toHaveURL(
'http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit/applicants'
`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit/applicants`
)
// Click text=Applications Application >> span
await expect(page.locator('text=Applications Application')).toBeVisible()
await expect(page.locator('text=APP-1')).toBeVisible()
await expect(page.locator('text="APP-1')).toBeDefined()
// Click text=Candidates
await page.click('text=Candidates')
await expect(page).toHaveURL(
'http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit/candidates'
`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit/candidates`
)
await expect(page.locator('text=Candidates Candidate')).toBeVisible()
@ -31,17 +34,17 @@ test.describe('workbench tests', () => {
// Click text=Vacancies
await page.click('text=Vacancies')
await expect(page).toHaveURL(
'http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit/vacancies'
`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit/vacancies`
)
// Click text=Software Engineer
await page.click('text=Software Engineer')
await expect(page.locator('text=Software Engineer')).toBeVisible()
await expect(page.locator('text=APP-1')).toBeVisible()
await expect(page.locator('text="APP-1"')).toBeDefined()
await page.click('[name="tooltip-task:string:Kanban"]')
// Click [id="app-chunter\:string\:ApplicationLabelChunter"]
await page.click('[id="app-chunter\\:string\\:ApplicationLabelChunter"]')
await expect(page).toHaveURL('http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/chunter%3Aapp%3AChunter')
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/chunter%3Aapp%3AChunter`)
await page.click('text=general')
@ -49,7 +52,7 @@ test.describe('workbench tests', () => {
await expect(page.locator('.textInput')).toBeVisible()
await page.click('[id="app-contact\\:string\\:Contacts"]')
await expect(page).toHaveURL('http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/contact%3Aapp%3AContacts')
await expect(page).toHaveURL(`${PlatformURI}/workbench%3Acomponent%3AWorkbenchApp/contact%3Aapp%3AContacts`)
// Click text=John Appleseed
await expect(page.locator('text=John Appleseed')).toBeVisible()
})