ToolJet/cypress/integration/dashboard/empty-state-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

35 lines
1.3 KiB
JavaScript

describe('Empty state of dashboard', () => {
beforeEach(() => {
//read data from fixtures
cy.fixture('login-data').then(function (testdata) {
cy.login(testdata.email, testdata.password);
});
});
it('should show empty screen when there are no apps', () => {
cy.wait(1000);
cy.get('body').then(($title) => {
//if user has not created any app yet
if ($title.text().includes("You haven't created any apps yet.")) {
//image for empty state should be visible
cy.get('.empty-img').should('be.visible');
//empty title should be visible
cy.log('Testing empty state dashboard view.');
cy.get('.empty-title').should('be.visible').and('have.text', "You haven't created any apps yet.");
//Read Documentation button should be present and working
cy.get('a.btn')
.eq(1)
.should('have.attr', 'href', 'https://docs.tooljet.io')
.and('have.text', 'Read documentation');
//test Create your first app button should be visible and working
cy.get('a.btn').eq(0).should('be.visible').and('have.text', 'Create your first app').click();
cy.get('title').should('have.text', 'ToolJet - Dashboard');
} else {
cy.log('User has already created few apps hence this test will be skipped.');
}
});
});
});