Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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: 3 additions & 4 deletions distribution/images/playwright/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ FROM ubuntu:noble

RUN apt-get update && apt-get install -y docker-compose nodejs npm jq curl zstd libasound2t64

RUN mkdir playwright
RUN mkdir /playwright

WORKDIR playwright
WORKDIR /playwright

COPY package*.json ./

Expand All @@ -13,7 +13,6 @@ RUN npm i && \

WORKDIR /

RUN rm -rf playwright
RUN rm -rf /playwright

LABEL org.opencontainers.image.source="https://github.com/dyrector-io/dyrectorio/tree/develop/distribution/images/playwright"

62 changes: 18 additions & 44 deletions distribution/images/playwright/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions distribution/images/playwright/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"homepage": "https://github.com/dyrector-io/playwright#readme",
"dependencies": {
"@playwright/test": "^1.56.1",
"playwright": "^1.56.1"
"@playwright/test": "^1.59.1",
"playwright": "^1.59.1"
}
}
5 changes: 2 additions & 3 deletions web/crux-ui/e2e/utils/common.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable import/no-cycle */
/* eslint-disable import-x/no-cycle */
import { ATTRIB_CSRF, HEADER_SET_COOKIE } from '@app/const'
import { UpdateLoginWithPassword } from '@app/models'
import { TeamRoutes } from '@app/routes'
Expand Down Expand Up @@ -156,7 +155,7 @@ export const getUserSessionToken = async (frontend: FrontendApi) => {
cookie,
})

const sessionCookieHeader = kratosRes.headers[HEADER_SET_COOKIE] as string[]
const sessionCookieHeader = kratosRes.headers[HEADER_SET_COOKIE]
return sessionCookieHeader.find(it => it.startsWith('ory_kratos_session'))
}

Expand Down
5 changes: 2 additions & 3 deletions web/crux-ui/e2e/utils/config-bundle.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable import/prefer-default-export */
import { PatchConfigMessage, WS_TYPE_PATCH_CONFIG } from '@app/models'
import { Page, expect } from '@playwright/test'
import { TEAM_ROUTES } from './common'
import { waitSocketRef, wsPatchSent } from './websocket'
import { PatchConfigMessage, WS_TYPE_PATCH_CONFIG } from '@app/models'

const matchPatchEnvironment = (expected: Record<string, string>) => (message: PatchConfigMessage) =>
Object.entries(expected).every(([key, value]) =>
message.config?.environment?.find(it => it.key === key && it.value === value),
)

// eslint-disable-next-line import-x/prefer-default-export
export const createConfigBundle = async (page: Page, name: string, data: Record<string, string>): Promise<string> => {
await page.goto(TEAM_ROUTES.configBundle.list())
await page.waitForSelector('h2:text-is("Config bundles")')
Expand Down
3 changes: 1 addition & 2 deletions web/crux-ui/e2e/utils/container-config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/* eslint-disable import/prefer-default-export */
// eslint-disable-next-line import/no-extraneous-dependencies
import { expect, Page } from '@playwright/test'
import { WebSocketRef, wsPatchSent } from './websocket'
import { wsPatchMatchPorts } from './websocket-match'

// eslint-disable-next-line import-x/prefer-default-export
export const addPortsToContainerConfig = async (
page: Page,
ws: WebSocketRef,
Expand Down
3 changes: 1 addition & 2 deletions web/crux-ui/e2e/utils/global.setup.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/no-extraneous-dependencies */
import { ROUTE_LOGIN, ROUTE_TEAMS_CREATE } from '@app/routes'
import { test } from './test.fixture'
import { BASE_URL, STORAGE_STATE } from '../../playwright.config'
Expand Down Expand Up @@ -45,7 +44,7 @@ test('global setup', async ({ page }) => {
await page.waitForSelector('h2:text-is("Dashboard")')

logInfo('saving storage state')
await page.context().storageState({ path: STORAGE_STATE as string })
await page.context().storageState({ path: STORAGE_STATE })

logInfo('changing registry to ghcr')
await page.goto(TEAM_ROUTES.registry.list())
Expand Down
1 change: 0 additions & 1 deletion web/crux-ui/e2e/utils/global.teardown.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/no-extraneous-dependencies */
import { internalError } from '@app/error-responses'
import { UserMeta } from '@app/models'
import { API_USERS_ME, teamApiUrl } from '@app/routes'
Expand Down
2 changes: 1 addition & 1 deletion web/crux-ui/e2e/utils/mail-slurper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable import/no-cycle */
/* eslint-disable import-x/no-cycle */
import { MAILSLURPER_TIMEOUT } from './common'

// further info: https://github.com/mailslurper/mailslurper/wiki/Email-Endpoints
Expand Down
1 change: 0 additions & 1 deletion web/crux-ui/e2e/utils/node-helper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { expect, Page } from '@playwright/test'
import { ExecOptions } from 'child_process'
import { DAGENT_NODE, execAsync, getExecOptions, screenshotPath, TEAM_ROUTES } from './common'
Expand Down
3 changes: 1 addition & 2 deletions web/crux-ui/e2e/utils/nodes.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { expect, Page } from '@playwright/test'
import { TEAM_ROUTES } from './common'

// eslint-disable-next-line import/prefer-default-export
// eslint-disable-next-line import-x/prefer-default-export
export const createNode = async (page: Page, name: string) => {
await page.goto(TEAM_ROUTES.node.list())
await page.waitForSelector('h2:text-is("Nodes")')
Expand Down
3 changes: 1 addition & 2 deletions web/crux-ui/e2e/utils/projects.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable @typescript-eslint/no-use-before-define */
/* eslint-disable import/no-extraneous-dependencies */
import { ProjectType } from '@app/models'
import { expect, Page } from '@playwright/test'
import { GHCR_PREFIX, REGISTRY_NAME, TEAM_ROUTES } from './common'
Expand Down Expand Up @@ -217,7 +216,7 @@ export const copyDeployment = async (page: Page, deploymentId: string, newName:
await page.waitForSelector('h2:text-is("Deployments")')

await page.locator('button:has-text("Copy")').click()
await fillDeploymentPrefix(page, `${newName}`)
await fillDeploymentPrefix(page, newName)
await page.locator('button:has-text("Copy")').click()
await expect(page.locator(`label:has-text('${newName}')`)).toBeVisible()

Expand Down
3 changes: 1 addition & 2 deletions web/crux-ui/e2e/utils/storages.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { Page } from 'playwright'
import { TEAM_ROUTES } from './common'

Expand All @@ -24,5 +23,5 @@ export const deleteStorage = async (page: Page, storageId: string) => {

await page.locator('button:has-text("Delete")').click()
await page.locator('div[role="dialog"] button:has-text("Delete")').click()
await page.waitForURL(`${TEAM_ROUTES.storage.list()}`)
await page.waitForURL(TEAM_ROUTES.storage.list())
}
1 change: 0 additions & 1 deletion web/crux-ui/e2e/utils/teams.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/no-extraneous-dependencies */
import { ROUTE_TEAMS, teamUrl } from '@app/routes'
import { Page } from 'playwright'

Expand Down
3 changes: 1 addition & 2 deletions web/crux-ui/e2e/utils/templates.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* eslint-disable import/prefer-default-export */
/* eslint-disable import/no-extraneous-dependencies */
import { ProjectType } from '@app/models'
import { ROUTE_TEMPLATES } from '@app/routes'
import { Page } from '@playwright/test'
import { TEAM_ROUTES } from './common'

// eslint-disable-next-line import-x/prefer-default-export
export const createProjectFromTemplate = async (
page: Page,
templateName: string,
Expand Down
2 changes: 0 additions & 2 deletions web/crux-ui/e2e/utils/test.fixture.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable import/no-extraneous-dependencies */
import { ChromiumBrowserContext, Page, TestInfo, test as base } from '@playwright/test'

const CPU_THROTTLE = process.env.CPUTHROTTLE
Expand All @@ -7,7 +6,6 @@ const DEBUG = !!process.env.REQUESTTHROTTLE

const LOG_LEVELS = DEBUG ? ['error', 'warning', 'info', 'debug', 'trace'] : ['error', 'warning']

// eslint-disable-next-line import/prefer-default-export
export const test = base.extend({})

export const hookTestPageEvents = (page: Page, testInfo: TestInfo) => {
Expand Down
3 changes: 1 addition & 2 deletions web/crux-ui/e2e/utils/websocket.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { WS_TYPE_PATCH_RECEIVED } from '@app/models'
import { WsMessage } from '@app/websockets/common'
// eslint-disable-next-line import/no-extraneous-dependencies
import { Page, WebSocket } from 'playwright'

export type WebSocketRef = {
Expand Down Expand Up @@ -51,7 +50,7 @@ export const waitSocketReceived = async (
!type && !match
? undefined
: (data: { payload: string }) => {
const message: WsMessage = JSON.parse(data.payload as string)
const message: WsMessage = JSON.parse(data.payload)

if (type && message.type !== `${route}/${type}`) {
return false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { WS_TYPE_PATCH_CONFIG } from '@app/models'
import { expect, Page } from '@playwright/test'
import { test } from '../../utils/test.fixture'
import { NGINX_TEST_IMAGE_WITH_TAG, TEAM_ROUTES } from 'e2e/utils/common'
import { waitSocketRef, wsPatchSent } from 'e2e/utils/websocket'
import {
Expand All @@ -10,7 +10,7 @@ import {
wsPatchMatchRestartPolicy,
} from 'e2e/utils/websocket-match'
import { createImage, createProject, createVersion } from '../../utils/projects'
import { WS_TYPE_PATCH_CONFIG } from '@app/models'
import { test } from '../../utils/test.fixture'

const setup = async (
page: Page,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { WS_TYPE_PATCH_CONFIG } from '@app/models'
import { expect, Page } from '@playwright/test'
import { test } from '../../utils/test.fixture'
import { NGINX_TEST_IMAGE_WITH_TAG, TEAM_ROUTES } from 'e2e/utils/common'
import { waitSocketRef, wsPatchSent } from 'e2e/utils/websocket'
import {
Expand All @@ -10,7 +10,7 @@ import {
wsPatchMatchRestartPolicy,
} from 'e2e/utils/websocket-match'
import { createImage, createProject, createVersion } from '../../utils/projects'
import { WS_TYPE_PATCH_CONFIG } from '@app/models'
import { test } from '../../utils/test.fixture'

const setup = async (
page: Page,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HealthCheckProbe, WS_TYPE_PATCH_CONFIG } from '@app/models'
import { expect, Page } from '@playwright/test'
import { test } from '../../utils/test.fixture'
import { NGINX_TEST_IMAGE_WITH_TAG, TEAM_ROUTES } from 'e2e/utils/common'
import {
wsPatchMatchCorsHeader,
Expand All @@ -19,8 +19,8 @@ import {
wsPatchMatchServiceLabel,
} from 'e2e/utils/websocket-match'
import { createImage, createProject, createVersion } from '../../utils/projects'
import { test } from '../../utils/test.fixture'
import { waitSocketRef, wsPatchSent } from '../../utils/websocket'
import { HealthCheckProbe, WS_TYPE_PATCH_CONFIG } from '@app/models'

const setup = async (
page: Page,
Expand Down
2 changes: 1 addition & 1 deletion web/crux-ui/e2e/with-login/dashboard.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { API_USERS_ME_PREFERENCES_ONBOARDING, ROUTE_PROFILE } from '@app/routes'
import { expect } from '@playwright/test'
import { test } from '../utils/test.fixture'
import { TEAM_ROUTES } from 'e2e/utils/common'
import { test } from '../utils/test.fixture'

test.describe('Onboarding', () => {
test('should be toggleable', async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { WS_TYPE_PATCH_CONFIG } from '@app/models'
import { expect } from '@playwright/test'
import { test } from '../../utils/test.fixture'
import { NGINX_TEST_IMAGE_WITH_TAG, TEAM_ROUTES } from 'e2e/utils/common'
import { deployWithDagent } from '../../utils/node-helper'
import { addImageToVersion, createImage, createProject, createVersion } from '../../utils/projects'
import { test } from '../../utils/test.fixture'
import { waitSocketRef, wsPatchSent } from '../../utils/websocket'
import { WS_TYPE_PATCH_CONFIG } from '@app/models'

test('In progress deployment should be not deletable', async ({ page }) => {
const projectName = 'project-delete-test-1'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { expect } from '@playwright/test'
import { test } from '../../utils/test.fixture'
import { DAGENT_NODE, TEAM_ROUTES } from 'e2e/utils/common'
import { deploy } from 'e2e/utils/node-helper'
import {
Expand All @@ -10,6 +9,7 @@ import {
createProject,
createVersion,
} from '../../utils/projects'
import { test } from '../../utils/test.fixture'

test('Protecting a deployment should fail while an incremental protected deployment exists in a different version with the same node and prefix', async ({
page,
Expand Down
2 changes: 1 addition & 1 deletion web/crux-ui/e2e/with-login/storage.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from '@playwright/test'
import { test } from '../utils/test.fixture'
import { TEAM_ROUTES } from 'e2e/utils/common'
import { createStorage, deleteStorage } from 'e2e/utils/storages'
import { test } from '../utils/test.fixture'

const TEST_URL = 'https://test.storage.com'
const TEST_ACCESS_KEY = '1234'
Expand Down
2 changes: 1 addition & 1 deletion web/crux-ui/e2e/with-login/team.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ROUTE_TEAMS, teamUrl } from '@app/routes'
import { expect } from '@playwright/test'
import { test } from '../utils/test.fixture'
import { createTeam, deleteTeam } from 'e2e/utils/teams'
import { test } from '../utils/test.fixture'

test('Can create team', async ({ page }) => {
const teamName = 'create-test-team'
Expand Down
Loading
Loading