ToolJet/cypress/integration/dashboard/dashboard.spec.js
Mohini Dahiya b333c8949a
Cypress: Added 'createAppIfEmptyDashboard' method to before hook and fixed widget tests. (#704)
* Added 'createAppIfEmptyDashboard' method to before hook

1. Added 'createAppIfEmptyDashboard()' method to before hook.
2. Fixed Widget tests.
3. Added ///<reference types="cypress" /> to index.js

* Test fix for Toggle switch

Capitalised first letters 'Toggle Switch' to search for exact text

* Fixes 'apps-page-operations' tests

1. Updated test for Launch button when no version is deployed.
2. Added test for Launch button when single version of App is deployed.
3. Added test to check message on app deletion.
4. Added custom method for Deploy App with single version.

* Moved import command to support/index.js file

1. Moved "import '@4tw/cypress-drag-drop'" statement to support/index.js file .
2. Updated viewport config "cypress.json" to override default viewport for my device macbook-pro

* Updated 'editor-navigation-bar.spec.js' tests

1. Removes test for hiding left sidebar.
2. Fixes test - resize canvas
3. Fixes test - switch to dark theme

* Revert "Updated 'editor-navigation-bar.spec.js' tests"

This reverts commit 70143c3020.
2021-09-12 09:52:29 +05:30

50 lines
1.8 KiB
JavaScript

describe('Dashboard', () => {
beforeEach(() => {
//read data from fixtures
cy.fixture('login-data').then(function (testdata) {
cy.login(testdata.email, testdata.password);
});
cy.wait(1000);
cy.createAppIfEmptyDashboard();
});
it('should show site header with nav items', () => {
cy.get('.navbar').find('.navbar-nav').should('be.visible');
});
it('should navigate to users page using users tab', () => {
cy.get('.navbar').find('.navbar-nav').find('li').not('.active').click();
cy.location('pathname').should('equal', '/users');
cy.get('.page-title').should('have.text', 'Users & Permissions');
cy.get('[data-testid="usersTable"]').should('be.visible');
});
it('should navigate to apps page using apps tab', () => {
cy.get('.navbar').find('.navbar-nav').find('li.active').click();
cy.location('pathname').should('equal', '/');
cy.get('.page-title').should('have.text', 'All applications');
cy.get('[data-testid="appsTable"]').should('be.visible');
});
it('should show user avatar and logout the user when user clicks logout', () => {
cy.get('[data-testid="userAvatarHeader"]').should('be.visible');
// TODO - Add functionality to detect when user hovers over the avatar,
// Issues with hover functionality and hide/show of dom elements
});
it('should show list of application folders', () => {
cy.get('[data-testid="applicationFoldersList"]').should('be.visible');
});
it('should show correct number of applications in the count bubble of "All Applications" list', () => {
cy.get('[data-testid="allApplicationsCount"]').then(($countBubble) => {
cy.get('[data-testid="appsTable"]')
.wait(500)
.find('tr')
.then((row) => {
expect(Number($countBubble.text())).to.equal(row.length);
});
});
});
});