Skip to content

Commit

Permalink
adding cypress spec for content preview feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Juraci committed Jul 23, 2024
1 parent 9f2a8f5 commit 453b628
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
17 changes: 17 additions & 0 deletions cypress/e2e/nodes_spec.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,23 @@ describe('Solution Navigator', () => {
cy.url().should('include', `/nodes/${leafNodeUuid}`);
});

it('shows the content preview of a child node on hover', () => {
cy.visit(`/nodes/${rootNodeUuid}`, {
onBeforeLoad(win) {
win.localStorage.setItem('NodeStore', JSON.stringify(initialState));
},
});

cy.intercept('/node_modules/primeicons/fonts/primeicons*').as('primeicons');
cy.wait('@primeicons', { requestTimeout: 10000, responseTimeout: 10000 });

cy.get('[data-test-child-node-item]').eq(1).as('childNode');
cy.get('@childNode').realMouseWheel({ deltaY: 200 });
cy.get('@childNode').realHover();

cy.get('[data-test-content-preview]').should('have.text', 'my content level 1');
});

context('when the node does not exist', () => {
it('displays a not found message', () => {
cy.visit('/nodes/62090d47-3104-4d50-b384-54728a0208dd');
Expand Down
1 change: 1 addition & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// ***********************************************************

// Import commands.js using ES2015 syntax:
import 'cypress-real-events';
import './commands';

// Alternatively you can use CommonJS syntax:
Expand Down
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@vue/eslint-config-prettier": "^9.0.0",
"@vue/test-utils": "^2.4.6",
"cypress": "^13.13.1",
"cypress-real-events": "^1.13.0",
"eslint": "^9.7.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-cypress": "^3.3.0",
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChildNode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const hideContentPreview = (event) => {
</div>
</Chip>
</div>
<Popover ref="contentPreview">
<Popover ref="contentPreview" data-test-content-preview>
<div class="content-preview">
<p>{{ node.content }}</p>
</div>
Expand Down

0 comments on commit 453b628

Please sign in to comment.