-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests to distinguish editor vs viewer #57
Comments
@hfiguiere Any thoughts on this one? |
I figured out how to do it :) // Verify the read-only mode.
$readonly_indicator = $this->assertWaitForElement('.status-readonly-mode');
$this->assertSame('Read-only', $readonly_indicator->getText()); // Verify the edit mode.
// The button is always present when in edit mode, but it is only
// visible on a mobile / touch device.
$this->assertWaitForElement('#mobile-edit-button'); protected function assertWaitForElement(string|array $locator, string $selector = 'css'): NodeElement {
$element = $this->assertSession()->waitForElement($selector, $locator);
$this->assertNotNull($element, "The '$selector' element was not found after 10 seconds.");
return $element;
} |
This is probably subject to breaking in future versions. |
When it happens we can change the tests accordingly. |
I have added this to the list. So yes, in the meantime this is probably the best way to go about it. |
Hello @hfiguiere
I would like to add more tests that verify that the embedded editor works.
To do this, I need to distinguish readonly vs edit, using selenium javascript.
You can see examples of this here, https://github.com/CollaboraOnline/collabora-drupal/blob/main/tests/src/ExistingSiteJavascript/CollaboraIntegrationTest.php#L38
What I found so far when opening in a regular browser:
id="document-container"
."readonly"
class, and no"notebookbar-active"
class."notebookbar-active"
class, and no"readonly"
class.However, for some reason, in a test, the 'readonly' class won't go away when I open in edit mode, even though the "notebookbar-active" class does appear.
Is there a more reliable way to make this distinction?
Ideally a way that appears immediately on page load, without too much waiting.
The text was updated successfully, but these errors were encountered: