-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #124 from cpinitiative/codemirror
Add mobile support
- Loading branch information
Showing
32 changed files
with
817 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# used for copying files | ||
# e2e tests use this | ||
YJS_SECURITY_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,28 @@ | ||
import { test, expect, Page } from '@playwright/test'; | ||
import { host } from './helpers'; | ||
import { test, expect } from '@playwright/test'; | ||
import { | ||
host, | ||
setInputEditorValue, | ||
setMainEditorValue, | ||
waitForEditorToLoad, | ||
} from './helpers'; | ||
|
||
test.describe('Basic Functionality', () => { | ||
test('should copy files', async ({ page, context }) => { | ||
test('should copy files', async ({ page }) => { | ||
await page.goto(`${host}/n`); | ||
await page.waitForSelector('button:has-text("Run Code")'); | ||
|
||
// let monaco load | ||
await page.waitForTimeout(500); | ||
await waitForEditorToLoad(page); | ||
|
||
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\`)` | ||
); | ||
await setMainEditorValue(page, 'code_value', 'cpp'); | ||
await setInputEditorValue(page, '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(); | ||
await expect(page.getByText('code_value')).toHaveCount(1); | ||
await expect(page.getByText('input_value')).toHaveCount(1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { host, isMonaco, waitForEditorToLoad } from './helpers'; | ||
|
||
test.describe('Mobile Specific Checks', () => { | ||
test('should load monaco for desktop and codemirror for mobile', async ({ | ||
page, | ||
isMobile, | ||
}) => { | ||
await page.goto(`${host}/n`); | ||
await page.waitForSelector('button:has-text("Run Code")'); | ||
await waitForEditorToLoad(page); | ||
|
||
if (isMobile) { | ||
expect(await isMonaco(page)).toBeFalsy(); | ||
} else { | ||
expect(await isMonaco(page)).toBeTruthy(); | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
1fb41f5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
ide – ./
ide-git-master-cpinitiative.vercel.app
ide-cpinitiative.vercel.app
ide-psi.vercel.app
beta.ide.usaco.guide
ide.usaco.guide