Skip to content

Commit

Permalink
[MS] Added e2e tests for greet/join user
Browse files Browse the repository at this point in the history
  • Loading branch information
Max-7 committed Jan 22, 2025
1 parent d88880d commit 0973246
Show file tree
Hide file tree
Showing 6 changed files with 256 additions and 202 deletions.
1 change: 0 additions & 1 deletion client/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export default defineConfig({
testIgnore: [
'**/device_greet.spec.ts',
'**/device_join_organization.spec.ts',
'**/user_greet.spec.ts',
'**/user_join.spec.ts',
'**/create_organization*.spec.ts',
'**/workspace_sharing.spec.ts',
Expand Down
2 changes: 1 addition & 1 deletion client/src/views/users/GreetUserModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<!-- give code step -->
<div
v-show="pageStep === GreetUserStep.ProvideHostSasCode"
class="step"
class="step host-code"
>
<sas-code-provide :code="greeter.hostSASCode" />
</div>
Expand Down
35 changes: 33 additions & 2 deletions client/tests/e2e/helpers/fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS

import { Locator, Page, TestInfo, test as base } from '@playwright/test';
import { BrowserContext, Locator, Page, TestInfo, test as base } from '@playwright/test';
import { expect } from '@tests/e2e/helpers/assertions';
import { MockBms } from '@tests/e2e/helpers/bms';
import { DEFAULT_ORGANIZATION_INFORMATION, DEFAULT_USER_INFORMATION, UserData } from '@tests/e2e/helpers/data';
Expand All @@ -9,7 +9,9 @@ import { createWorkspace, dismissToast, dragAndDropFile, fillInputModal, fillIon
import path from 'path';

export const msTest = base.extend<{
context: BrowserContext;
home: Page;
secondTab: Page;
connected: Page;
workspaces: Page;
documents: Page;
Expand All @@ -25,7 +27,36 @@ export const msTest = base.extend<{
clientArea: Page;
clientAreaCustomOrder: Page;
}>({
home: async ({ page, context }, use) => {
context: async ({ browser }, use) => {
const context = await browser.newContext();
await use(context);
await context.close();
},

home: async ({ context }, use) => {
const page = await context.newPage();

page.on('console', (msg) => console.log('> ', msg.text()));
await context.grantPermissions(['clipboard-read']);

await page.addInitScript(() => {
(window as any).TESTING = true;
});
await page.goto('/');
await page.waitForLoadState('domcontentloaded');

await expect(page.locator('#app')).toHaveAttribute('app-state', 'initializing');

await newTestbed(page);

await expect(page.locator('#app')).toHaveAttribute('app-state', 'ready');
await use(page);
await dropTestbed(page);
},

secondTab: async ({ context }, use) => {
const page = await context.newPage();

page.on('console', (msg) => console.log('> ', msg.text()));
await context.grantPermissions(['clipboard-read']);

Expand Down
2 changes: 0 additions & 2 deletions client/tests/e2e/helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ export async function fillInputModal(root: Locator | Page, text: string, clear?:
await fillIonInput(modal.locator('ion-input'), '');
}
const okButton = modal.locator('.ms-modal-footer-buttons').locator('#next-button');
await expect(okButton).toHaveDisabledAttribute();
await fillIonInput(modal.locator('ion-input'), text);
await expect(okButton).not.toHaveDisabledAttribute();
await okButton.click();
await expect(modal).toBeHidden();
}
Expand Down
Loading

0 comments on commit 0973246

Please sign in to comment.