Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TESTS-85: feat(tests): added issues.spec.ts test #4025

Merged
merged 6 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,13 @@ jobs:
with:
name: playwright-results
path: ./tests/sanity/playwright-report/
- name: Get Allure history
uses: actions/checkout@v2
if: ${{ github.ref == 'refs/heads/main' }}
continue-on-error: true
with:
ref: gh-pages
path: gh-pages
- name: Generates Allure Report
uses: simple-elf/allure-report-action@master
if: always()
Expand Down
4 changes: 4 additions & 0 deletions tests/create-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ 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
node ../dev/tool/bundle.js confirm-email user1
# Create second user record in accounts
node ../dev/tool/bundle.js create-account user2 -f Kainin -l Numoin -p 1234
node ../dev/tool/bundle.js confirm-email user2


# Restore workspace contents in mongo/elastic
Expand All @@ -21,6 +24,7 @@ node ../dev/tool/bundle.js upgrade-workspace sanity-ws

# Re-assign user to workspace.
node ../dev/tool/bundle.js assign-workspace user1 sanity-ws
node ../dev/tool/bundle.js assign-workspace user2 sanity-ws

node ../dev/tool/bundle.js configure sanity-ws --enable=*
node ../dev/tool/bundle.js configure sanity-ws --list
3 changes: 3 additions & 0 deletions tests/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ docker-compose -p sanity up -d --force-recreate --renew-anon-volumes
./tool.sh create-workspace sanity-ws -o SanityTest
# Create user record in accounts
./tool.sh create-account user1 -f John -l Appleseed -p 1234
./tool.sh create-account user2 -f Kainin -l Dirak -p 1234
# Make user the workspace maintainer
./tool.sh set-user-role user1 sanity-ws 1
./tool.sh confirm-email user1
./tool.sh set-user-role user2 sanity-ws 1
./tool.sh confirm-email user2

./restore-workspace.sh
1 change: 1 addition & 0 deletions tests/restore-workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

# Re-assign user to workspace.
./tool.sh assign-workspace user1 sanity-ws
./tool.sh assign-workspace user2 sanity-ws

./tool.sh configure sanity-ws --enable=*
./tool.sh configure sanity-ws --list
1 change: 1 addition & 0 deletions tests/sanity/.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
PLATFORM_URI='http://localhost:8083'
PLATFORM_TRANSACTOR='ws://localhost:3334'
PLATFORM_USER='user1'
PLATFORM_USER_SECOND='user2'
PLATFORM_TOKEN='eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6InVzZXIxIiwid29ya3NwYWNlIjoic2FuaXR5LXdzIn0.hfUCqePHO-WNps2by4B-CYGKIpDpLG0WVCUUtU-SVI4'
SETTING=storage.json
77 changes: 77 additions & 0 deletions tests/sanity/tests/collaborative/issues.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { test } from '@playwright/test'
import { generateId, PlatformURI, PlatformUser, PlatformUserSecond } from '../utils'
import { SelectWorkspacePage } from '../model/select-workspace-page'
import { allure } from 'allure-playwright'
import { LoginPage } from '../model/login-page'
import { NewIssue } from '../model/tracker/types'
import { IssuesPage } from '../model/tracker/issues-page'
import { LeftSideMenuPage } from '../model/left-side-menu-page'
import { IssuesDetailsPage } from '../model/tracker/issues-details-page'

test.describe('Collaborative test for issue', () => {
test.beforeEach(async ({ page }) => {
await allure.parentSuite('Collaborative test')
await (await page.goto(`${PlatformURI}/workbench/sanity-ws/tracker/`))?.finished()
})

test('Issues can be assigned to another users', async ({ browser }) => {
const userFirstContext = await browser.newContext()
haiodo marked this conversation as resolved.
Show resolved Hide resolved
const userSecondContext = await browser.newContext()

const userFirstPage = await userFirstContext.newPage()
const userSecondPage = await userSecondContext.newPage()

// create issue
const loginPage = new LoginPage(userFirstPage)
await loginPage.goto()
await loginPage.login(PlatformUser, '1234')

const selectWorkspacePage = new SelectWorkspacePage(userFirstPage)
await selectWorkspacePage.selectWorkspace('sanity-ws')

const newIssue: NewIssue = {
title: `Collaborative test for issue-${generateId()}`,
description: 'Collaborative test for issue',
status: 'Backlog',
priority: 'Urgent',
assignee: 'Appleseed John',
createLabel: true,
labels: `CREATE-ISSUE-${generateId()}`,
component: 'No component',
estimation: '2',
milestone: 'No Milestone',
duedate: 'today',
filePath: 'cat.jpeg'
}

const leftSideMenuPage = new LeftSideMenuPage(userFirstPage)
await leftSideMenuPage.buttonTracker.click()

const issuesPage = new IssuesPage(userFirstPage)
await issuesPage.modelSelectorAll.click()
await issuesPage.createNewIssue(newIssue)

// check by another user
const loginPageSecond = new LoginPage(userSecondPage)
await loginPageSecond.goto()
await loginPageSecond.login(PlatformUserSecond, '1234')

const selectWorkspacePageSecond = new SelectWorkspacePage(userSecondPage)
await selectWorkspacePageSecond.selectWorkspace('sanity-ws')

const leftSideMenuPageSecond = new LeftSideMenuPage(userSecondPage)
await leftSideMenuPageSecond.buttonTracker.click()

const issuesPageSecond = new IssuesPage(userSecondPage)
await issuesPageSecond.modelSelectorAll.click()
await issuesPageSecond.searchIssueByName(newIssue.title)
await issuesPageSecond.openIssueByName(newIssue.title)

const issuesDetailsPageSecond = new IssuesDetailsPage(userSecondPage)
await issuesDetailsPageSecond.checkIssue({
...newIssue,
milestone: 'Milestone',
estimation: '2h'
})
})
})
1 change: 1 addition & 0 deletions tests/sanity/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Locator, Page } from '@playwright/test'
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 PlatformUserSecond = process.env.PLATFORM_USER_SECOND as string
export const PlatformToken = process.env.PLATFORM_TOKEN as string
export const PlatformSetting = process.env.SETTING as string

Expand Down