Skip to content

Conversation

@max-nextcloud
Copy link
Collaborator

This is a regression tests for #2104.

Signed-off-by: Max [email protected]

  • Target version: master

@max-nextcloud
Copy link
Collaborator Author

interesting failure... sigh

@julien-nc
Copy link
Member

The failure happens there:

} else if (e.response.status === 403 && e.response.data.document.currentVersion === this._authority.document.currentVersion) {

The response when requesting apps/text/public/session/push with valid parameters is [].
Here is an example of passed parameters:

{
    "documentId": 26558,
    "sessionId": 1395,
    "sessionToken": "i7RyQF6rPyhJwmYZLrEi7BKeNBf9/OGVKHwun3cUVykoyDvZn3b+MNclmj1jwlCL",
    "steps": [
        {
            "stepType": "replace",
            "from": 13,
            "to": 13,
            "slice": {
                "content": [
                    {
                        "type": "paragraph"
                    }
                ]
            }
        }
    ],
    "version": 0,
    "token": "JgAkDesDfxG2Wtk",
    "filePath": "//test.md"
}

I'll dig deeper on the server side code to see if it's expected to get an empty array in the response or if it's a bug.

@juliusknorr juliusknorr added 2. developing tests If you write them we ♥ you labels Feb 23, 2022
@max-nextcloud
Copy link
Collaborator Author

0f59c20 fixes the issue in question. It also has an explanation in the commit message:

Cypress tests were failing because they triggered editor.focus on a read only doc.
Focus seems to cause sendable steps - maybe because the current cursor changes.

Prevent this on various levels:

  • Do not autofocus read only docs.
  • Do not send steps to read only docs.
  • Handle server response with 403 without content gracefully when sending steps.

The last response originated here:
https://github.com/nextcloud/text/blob/master/lib/Service/ApiService.php#L158
So wither the session was not valid or the document read only.

Not entirely sure what best to do in this situation.
Logging to console.error for now.

This is a regression tests for #2104.

Signed-off-by: Max <[email protected]>
@max-nextcloud max-nextcloud force-pushed the test/regression/2104 branch from 0a723a2 to bc22e33 Compare March 2, 2022 09:46
@max-nextcloud max-nextcloud merged commit 36912b1 into master Mar 2, 2022
@delete-merged-branch delete-merged-branch bot deleted the test/regression/2104 branch March 2, 2022 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing tests If you write them we ♥ you

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants