enso/app/ide-desktop/lib/dashboard/e2e/createAsset.spec.ts
Sergei Garin e4da96e943
Fix opening projects (#10433)
#### Tl;dr
- Closes: enso-org/cloud-v2#1338
This PR fixes bugs with opened projects. Now all projects close/open properly and list of opened projects stored in the single place

---

#### Context:
Few sentences on the high level context for the change. Link to relevant design docs or discussion.

#### This Change:
What this change does in the larger context. Specific details to highlight for review:
1. Removes a bunch of useEffects across the Dashboard page
2. Project status now a react-query state, can be reused across the app
3. Eliminated the need of `waitIntilProjectIsOpened`

---
2024-07-09 14:47:46 +00:00

66 lines
2.0 KiB
TypeScript

/** @file Test copying, moving, cutting and pasting. */
import * as test from '@playwright/test'
import * as actions from './actions'
// =================
// === 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 }) =>
actions.mockAllAndLogin({ page }).then(
async ({ pageActions }) =>
await pageActions.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/)
})
)
)
test.test('create project', ({ page }) =>
actions.mockAllAndLogin({ page }).then(
async ({ pageActions }) =>
await pageActions
.newEmptyProject()
.do(thePage => test.expect(actions.locateEditor(thePage)).toBeAttached())
.goToPage.drive()
.driveTable.withRows(rows => test.expect(rows).toHaveCount(1))
)
)
test.test('upload file', ({ page }) =>
actions.mockAllAndLogin({ page }).then(
async ({ pageActions }) =>
await pageActions.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))
})
)
)
test.test('create secret', ({ page }) =>
actions.mockAllAndLogin({ page }).then(
async ({ pageActions }) =>
await pageActions.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))
})
)
)