2023-07-13 12:05:01 +03:00
|
|
|
import { resolve } from 'node:path';
|
2023-03-02 08:51:15 +03:00
|
|
|
|
2023-07-13 12:05:01 +03:00
|
|
|
import { rootDir, test } from '@affine-test/kit/playwright';
|
|
|
|
import { openHomePage } from '@affine-test/kit/utils/load-page';
|
|
|
|
import { newPage, waitEditorLoad } from '@affine-test/kit/utils/page-logic';
|
|
|
|
import { assertCurrentWorkspaceFlavour } from '@affine-test/kit/utils/workspace';
|
|
|
|
import { expect } from '@playwright/test';
|
2023-03-02 08:51:15 +03:00
|
|
|
|
2023-04-17 00:02:41 +03:00
|
|
|
test('should create a page with a local first avatar', async ({ page }) => {
|
|
|
|
await openHomePage(page);
|
2023-06-07 12:31:54 +03:00
|
|
|
await waitEditorLoad(page);
|
2023-04-17 00:02:41 +03:00
|
|
|
await newPage(page);
|
|
|
|
await page.getByTestId('workspace-name').click();
|
|
|
|
await page.getByTestId('new-workspace').click({ delay: 50 });
|
|
|
|
await page
|
|
|
|
.getByTestId('create-workspace-input')
|
|
|
|
.type('Test Workspace 1', { delay: 50 });
|
2023-05-09 10:30:01 +03:00
|
|
|
await page.getByTestId('create-workspace-create-button').click();
|
2023-04-17 00:02:41 +03:00
|
|
|
await page.getByTestId('workspace-name').click();
|
|
|
|
await page.getByTestId('workspace-card').nth(1).click();
|
2023-07-03 13:59:23 +03:00
|
|
|
await page.getByTestId('settings-modal-trigger').click();
|
|
|
|
await page.getByText('current').click();
|
2023-04-17 00:02:41 +03:00
|
|
|
await page
|
|
|
|
.getByTestId('upload-avatar')
|
2023-07-13 12:05:01 +03:00
|
|
|
.setInputFiles(resolve(rootDir, 'tests', 'fixtures', 'smile.png'));
|
2023-07-03 13:59:23 +03:00
|
|
|
await page.mouse.click(0, 0);
|
2023-04-17 00:02:41 +03:00
|
|
|
await page.getByTestId('workspace-name').click();
|
|
|
|
await page.getByTestId('workspace-card').nth(0).click();
|
|
|
|
await page.waitForTimeout(1000);
|
|
|
|
await page.getByTestId('workspace-name').click();
|
|
|
|
await page.getByTestId('workspace-card').nth(1).click();
|
|
|
|
const blobUrl = await page
|
|
|
|
.getByTestId('workspace-avatar')
|
|
|
|
.locator('img')
|
|
|
|
.getAttribute('src');
|
|
|
|
// out user uploaded avatar
|
|
|
|
expect(blobUrl).toContain('blob:');
|
|
|
|
await assertCurrentWorkspaceFlavour('local', page);
|
2023-03-02 08:51:15 +03:00
|
|
|
});
|