2024-01-31 14:35:41 +03:00
|
|
|
/** @file Test copying, moving, cutting and pasting. */
|
|
|
|
import * as test from '@playwright/test'
|
|
|
|
|
|
|
|
import * as actions from './actions'
|
|
|
|
|
2024-06-20 19:19:01 +03:00
|
|
|
// =================
|
|
|
|
// === Constants ===
|
|
|
|
// =================
|
|
|
|
|
|
|
|
/** The name of the uploaded file. */
|
|
|
|
const FILE_NAME = 'foo.txt'
|
|
|
|
/** The contents of the uploaded file. */
|
|
|
|
const FILE_CONTENTS = 'hello world'
|
|
|
|
/** The name of the created secret. */
|
|
|
|
const SECRET_NAME = 'a secret name'
|
|
|
|
/** The value of the created secret. */
|
|
|
|
const SECRET_VALUE = 'a secret value'
|
|
|
|
|
|
|
|
// =============
|
|
|
|
// === Tests ===
|
|
|
|
// =============
|
|
|
|
|
|
|
|
test.test('create folder', ({ page }) =>
|
2024-07-16 12:55:45 +03:00
|
|
|
actions
|
|
|
|
.mockAllAndLogin({ page })
|
|
|
|
.createFolder()
|
|
|
|
.driveTable.withRows(async (rows) => {
|
|
|
|
await test.expect(rows).toHaveCount(1)
|
|
|
|
await test.expect(rows.nth(0)).toBeVisible()
|
|
|
|
await test.expect(rows.nth(0)).toHaveText(/^New Folder 1/)
|
|
|
|
}),
|
2024-06-20 19:19:01 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
test.test('create project', ({ page }) =>
|
2024-07-16 12:55:45 +03:00
|
|
|
actions
|
|
|
|
.mockAllAndLogin({ page })
|
|
|
|
.newEmptyProject()
|
|
|
|
.do((thePage) => test.expect(actions.locateEditor(thePage)).toBeAttached())
|
|
|
|
.goToPage.drive()
|
|
|
|
.driveTable.withRows((rows) => test.expect(rows).toHaveCount(1)),
|
2024-06-20 19:19:01 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
test.test('upload file', ({ page }) =>
|
2024-07-16 12:55:45 +03:00
|
|
|
actions
|
|
|
|
.mockAllAndLogin({ page })
|
|
|
|
.uploadFile(FILE_NAME, FILE_CONTENTS)
|
|
|
|
.driveTable.withRows(async (rows) => {
|
|
|
|
await test.expect(rows).toHaveCount(1)
|
|
|
|
await test.expect(rows.nth(0)).toBeVisible()
|
|
|
|
await test.expect(rows.nth(0)).toHaveText(new RegExp('^' + FILE_NAME))
|
|
|
|
}),
|
2024-06-20 19:19:01 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
test.test('create secret', ({ page }) =>
|
2024-07-16 12:55:45 +03:00
|
|
|
actions
|
|
|
|
.mockAllAndLogin({ page })
|
|
|
|
.createSecret(SECRET_NAME, SECRET_VALUE)
|
|
|
|
.driveTable.withRows(async (rows) => {
|
|
|
|
await test.expect(rows).toHaveCount(1)
|
|
|
|
await test.expect(rows.nth(0)).toBeVisible()
|
|
|
|
await test.expect(rows.nth(0)).toHaveText(new RegExp('^' + SECRET_NAME))
|
|
|
|
}),
|
2024-06-20 19:19:01 +03:00
|
|
|
)
|