[server-pro] tests: reduce flakiness of editor tests (#23963)

- Swap order of "oldContent" and "static" (apparently that makes the
  selection more reliable...)
- Turn off spellchecking outside the spellchecking test (avoid DOM
  changes from added underline on misspelled words)
- Swap order of opening file and switching to doc under test:
  The cy.findByText('static') was occasionally triggering an unhandled
  error in codemirror when it ran while the editor was getting swapped.
  (something along the lines of "cannot select out-of-dom range")
- Align source and visual editor tests, use ".findByText(oldContent)"
- Double down on waiting for doc switch to finish loading

GitOrigin-RevId: 8b201a6d78a60e3cfa92c22198f63e705d8880ec
This commit is contained in:
Jakob Ackermann
2025-02-28 09:06:07 +00:00
committed by Copybot
parent b37b409994
commit 18fb4effb1
2 changed files with 60 additions and 39 deletions
+4
View File
@@ -184,6 +184,9 @@ export function waitForMainDocToLoad() {
export function openFile(fileName: string, waitFor: string) {
// force: The file-tree pane is too narrow to display the full name.
cy.findByTestId('file-tree').findByText(fileName).click({ force: true })
// wait until we've switched to the selected file
cy.findByText('Loading…').should('not.exist')
cy.findByText(waitFor)
}
@@ -201,6 +204,7 @@ export function createNewFile() {
cy.findByTestId('file-tree').findByText(fileName).click({ force: true })
// wait until we've switched to the newly created empty file
cy.findByText('Loading…').should('not.exist')
cy.get('.cm-line').should('have.length', 1)
return fileName