2023-03-02 08:51:15 +03:00
|
|
|
import { expect } from '@playwright/test';
|
|
|
|
|
2023-03-24 01:15:40 +03:00
|
|
|
import { openHomePage } from '../libs/load-page';
|
2023-03-28 08:25:16 +03:00
|
|
|
import { newPage, waitMarkdownImported } from '../libs/page-logic';
|
2023-03-24 01:15:40 +03:00
|
|
|
import { test } from '../libs/playwright';
|
|
|
|
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
2023-03-02 08:51:15 +03:00
|
|
|
|
|
|
|
test.describe('Local first create page', () => {
|
|
|
|
test('should create a page with a local first avatar', async ({ page }) => {
|
2023-03-24 01:15:40 +03:00
|
|
|
await openHomePage(page);
|
2023-03-28 08:25:16 +03:00
|
|
|
await waitMarkdownImported(page);
|
2023-03-02 08:51:15 +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 });
|
|
|
|
await page.getByTestId('create-workspace-button').click();
|
|
|
|
await page.getByTestId('workspace-name').click();
|
|
|
|
await page.getByTestId('workspace-card').nth(1).click();
|
2023-03-05 05:11:15 +03:00
|
|
|
await page.getByTestId('slider-bar-workspace-setting-button').click();
|
2023-03-02 08:51:15 +03:00
|
|
|
await page
|
|
|
|
.getByTestId('upload-avatar')
|
|
|
|
.setInputFiles('./tests/fixtures/smile.png');
|
|
|
|
await page.getByTestId('workspace-name').click();
|
|
|
|
await page.getByTestId('workspace-card').nth(0).click();
|
|
|
|
await page.waitForTimeout(1000);
|
|
|
|
const text = await page.getByTestId('workspace-avatar').textContent();
|
|
|
|
// default avatar for default workspace
|
2023-03-08 10:44:50 +03:00
|
|
|
expect(text).toBe('D');
|
2023-03-02 08:51:15 +03:00
|
|
|
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:');
|
2023-03-23 07:22:29 +03:00
|
|
|
await assertCurrentWorkspaceFlavour('local', page);
|
2023-03-02 08:51:15 +03:00
|
|
|
});
|
|
|
|
});
|