mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-27 16:37:42 +00:00
* Test try git * Updated 'editor-navigation-bar.spec.js' tests Fixes #718 1. Removes test for hiding left sidebar. 2. Fixes test - resize canvas 3. Fixes test - switch to dark theme * Updated index.js and cypress.json files 1. Added viewport to cypress.json file to support macbook pro 16. 2. Updated index.js file to do golobal import of cypress-drag-drop. 3. Merged custom method from dev branch to command.js file. * Add cypress. reference type to index.js * Fixes 'editor-datasource-postgres.spec.js' 1. Updated test with new UI changes. 2. Updated 'addPostgresDataSource' method in 'command.js' file to mark SSL box unchecked.
100 lines
2.9 KiB
JavaScript
100 lines
2.9 KiB
JavaScript
Cypress.Commands.add('login', (email, password) => {
|
|
cy.visit('/login');
|
|
cy.get('[data-testid="emailField"]').type(email);
|
|
cy.get('[data-testid="passwordField"]').type(password);
|
|
cy.get('[data-testid="loginButton"').click();
|
|
})
|
|
|
|
|
|
|
|
Cypress.Commands.add('checkToastMessage', (toastId, message) => {
|
|
cy.get(`[id=${toastId}]`).should('contain', message);
|
|
});
|
|
|
|
Cypress.Commands.add('addPostgresDataSource', fn => {
|
|
|
|
cy.get('div[class="modal-title h4"] span[class="text-muted"]')
|
|
.should('have.text', 'Add new datasource')
|
|
.and('be.visible')
|
|
|
|
cy.get('.modal-body')
|
|
.find('div[class="row row-deck"]')
|
|
.find('h4[class="text-muted mb-2"]')
|
|
.should('have.text', 'DATABASES')
|
|
|
|
cy.get('.modal-body')
|
|
.find('.col-md-2')
|
|
.contains('PostgreSQL')
|
|
.and('be.visible')
|
|
.click()
|
|
|
|
cy.get('.row.mt-3')
|
|
.find('.col-md-4')
|
|
.find('.form-label')
|
|
.contains('Database Name')
|
|
|
|
cy.get('div[class="row mt-3"] div:nth-child(1)')
|
|
.find('.form-control')
|
|
.should('have.attr', 'type', 'text')
|
|
.type(Cypress.env('TEST_PG_DB'))
|
|
|
|
cy.get('.row.mt-3')
|
|
.find('.col-md-4')
|
|
.find('.form-label')
|
|
.contains('Username')
|
|
|
|
cy.get('div[class="row mt-3"] div:nth-child(2)')
|
|
.find('.form-control')
|
|
.should('have.attr', 'type', 'text')
|
|
.type(Cypress.env('TEST_PG_USERNAME'))
|
|
|
|
cy.get('.row.mt-3')
|
|
.find('.col-md-4')
|
|
.find('.form-label')
|
|
.contains('Password')
|
|
|
|
cy.get('div[class="row mt-3"] div:nth-child(3)')
|
|
.find('.form-control')
|
|
.should('have.attr', 'type', 'password')
|
|
.type(Cypress.env('TEST_PG_PASSWORD'))
|
|
|
|
cy.get('input[type="checkbox"]')
|
|
.uncheck()
|
|
|
|
cy.get('button[class="m-2 btn btn-success"]')
|
|
.should('have.text', 'Test Connection')
|
|
.click()
|
|
|
|
cy.get('.badge')
|
|
.should('have.text', 'connection verified')
|
|
|
|
cy.get('div[class="col-auto"] button[type="button"]')
|
|
.should('have.text', 'Save')
|
|
.click()
|
|
});
|
|
Cypress.Commands.add('createAppIfEmptyDashboard', fn => {
|
|
cy.get('body').then(($title => {
|
|
//check you are not running tests on empty dashboard state
|
|
if ($title.text().includes('You haven\'t created any apps yet.')) {
|
|
cy.get('a.btn').eq(0).should('have.text', 'Create your first app')
|
|
.click()
|
|
cy.go('back')
|
|
}
|
|
}))
|
|
});
|
|
|
|
Cypress.Commands.add('deployAppWithSingleVersion', fn => {
|
|
cy.get('.navbar')
|
|
.find('.navbar-nav')
|
|
.find('.nav-item')
|
|
.find('button[class="btn btn-primary btn-sm"]')
|
|
.should('have.text', 'Deploy')
|
|
.and('be.visible')
|
|
.click();
|
|
|
|
cy.get('.modal-title.h4').should('have.text', 'Versions and deployments').and('be.visible');
|
|
cy.get('.btn.btn-primary.btn-sm.mx-2').contains('+ Version').click();
|
|
cy.get('input[placeholder="version name"]').type('1.0');
|
|
cy.get('button[class="btn btn-primary"]').should('have.text', 'Create').click();
|
|
cy.get('table').contains('td', 'save').click().contains('td', 'deploy').click();
|
|
});
|