Skip to content

Commit 9cd4cfb

Browse files
committed
add a basic test of the two documents in the bookmark tab
1 parent 53dc5ce commit 9cd4cfb

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

Diff for: cypress/e2e/functional/document_tests/bookmark_test_spec.js

+13
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,19 @@ context('Bookmarks', function () {
4747
resourcesPanel.getCanvasItemTitle('my-work', 'bookmarks').contains(copyDocumentTitle).should('exist');
4848
resourcesPanel.getCanvasItemTitle('my-work', 'bookmarks').contains(title).should('exist');
4949

50+
cy.log('verify second document can be opened in bookmarks panel');
51+
resourcesPanel.getFocusDocumentTitle().contains(title);
52+
resourcesPanel.getCanvasItemTitle('my-work', 'bookmarks').contains(copyDocumentTitle).click();
53+
// There is confusing behavior here where the first click on another document doesn't open this as the
54+
// the second document, instead it toggles the primary document to be this one. This happens
55+
// because there is no explicit primary document initially. So this first click tries to set this
56+
// secondary document but because there is no primary the persistent ui stores it as the primary doc.
57+
resourcesPanel.getFocusDocumentTitle().contains(copyDocumentTitle);
58+
// Now clicking back on the first document in the list should open it as the "secondary" document.
59+
resourcesPanel.getCanvasItemTitle('my-work', 'bookmarks').contains(title).click();
60+
resourcesPanel.getPrimaryFocusDocumentTitle().contains(copyDocumentTitle);
61+
resourcesPanel.getSecondaryFocusDocumentTitle().contains(title);
62+
5063
cy.log('verify publish personal document');
5164
canvas.publishCanvas("personal");
5265
resourcesPanel.openTopTab('class-work');

Diff for: cypress/support/elements/common/ResourcesPanel.js

+22
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,27 @@ class ResourcesPanel{
9999
// but the top level (navTab) of this sub tab is not active/selected.
100100
return cy.get('.nav-tab-panel .react-tabs__tab-panel--selected .react-tabs__tab-panel--selected .edit-button');
101101
}
102+
103+
getFocusDocument() {
104+
return cy.get('.focus-document');
105+
}
106+
107+
getFocusDocumentTitle() {
108+
return this.getFocusDocument().find('.document-title');
109+
}
110+
111+
// The Primary and Secondary documents are used in the bookmarks tab
112+
getPrimaryFocusDocument() {
113+
return cy.get('.focus-document.primary');
114+
}
115+
getPrimaryFocusDocumentTitle() {
116+
return this.getFocusDocument().find('.document-title');
117+
}
118+
getSecondaryFocusDocument() {
119+
return cy.get('.focus-document.secondary');
120+
}
121+
getSecondaryFocusDocumentTitle() {
122+
return this.getFocusDocument().find('.document-title');
123+
}
102124
}
103125
export default ResourcesPanel;

0 commit comments

Comments
 (0)