Skip to content

Commit

Permalink
add e2e tests for copying files
Browse files Browse the repository at this point in the history
  • Loading branch information
thecodingwizard committed Aug 23, 2023
1 parent 94dee67 commit ff2ac69
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions e2e/copies_files.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { test, expect, Page } from '@playwright/test';
import { host } from './helpers';

test.describe('Basic Functionality', () => {
test('should copy files', async ({ page, context }) => {
await page.goto(`${host}/n`);
await page.waitForSelector('button:has-text("Run Code")');

// let monaco load
await page.waitForTimeout(500);

await page.click('[data-test-id="input-editor"]');
await page.keyboard.type('1 2 3');

await page.evaluate(
`this.monaco.editor.getModels().find(x => x.getLanguageId() === "cpp").setValue(\`code_value\`)`
);
await page.evaluate(
`this.monaco.editor.getModels().find(x => x.getLanguageId() === "plaintext").setValue(\`input_value\`)`
);

// sync with yjs server
await page.waitForTimeout(1500);

await page.goto(page.url() + '/copy');
await page.waitForSelector('button:has-text("Run Code")');

expect(await page.$('text="code_value"')).toBeTruthy();
expect(await page.$('text="input_value"')).toBeTruthy();
});
});

0 comments on commit ff2ac69

Please sign in to comment.