Browse Source

test(cypress): Project operations

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/510/head
Pranav C 3 years ago
parent
commit
3188c29f70
  1. 4
      cypress.json
  2. 38
      cypress/integration/graphql/project_operations_spec.js
  3. 37
      cypress/integration/rest/project_operations_spec.js
  4. 10
      cypress/support/commands.js

4
cypress.json

@ -1 +1,3 @@
{}
{
"baseUrl": "http://localhost:3000"
}

38
cypress/integration/graphql/project_operations_spec.js

@ -0,0 +1,38 @@
describe('GraphQL Project operations', () => {
beforeEach(() => {
cy.waitForSpinners();
cy.signinOrSignup();
})
it('Create Project', () => {
// cy.visit('')
cy.contains('New Project').trigger('onmouseover').trigger('mouseenter');
cy.get('.create-external-db-project').click()
cy.url({timeout: 6000}).should('contain', '#/project/')
cy.contains('GRAPHQL APIs').closest('label').click()
cy.get('.database-field input').click().clear().type('dummy_db')
cy.contains('Test Database Connection').click()
cy.contains('Ok & Save Project', {timeout: 3000}).click()
cy.url({timeout: 12000}).should('contain', '#/nc/')
});
it('Stop Project', () => {
// cy.get('.nc-graphql-project-row .mdi-stop-circle-outline', {timeout: 10000}).last().trigger('onmouseover').trigger('mouseenter')
cy.get('.nc-graphql-project-row .mdi-stop-circle-outline', {timeout: 10000}).last().invoke('show').click();
cy.contains('Submit').closest('button').click();
});
it('Start Project', () => {
cy.get('.nc-graphql-project-row .mdi-play-circle-outline', {timeout: 10000}).last().invoke('show').click();
cy.contains('Submit').closest('button').click();
});
it('Restart Project', () => {
cy.get('.nc-graphql-project-row .mdi-restart', {timeout: 10000}).last().invoke('show').click();
cy.contains('Submit').closest('button').click();
});
it('Delete Project', () => {
cy.get('.nc-graphql-project-row .mdi-delete-circle-outline', {timeout: 10000}).last().invoke('show').click();
cy.contains('Submit').closest('button').click();
});
})

37
cypress/integration/rest/project_operations_spec.js

@ -0,0 +1,37 @@
describe('Rest Project operations', () => {
beforeEach(() => {
cy.waitForSpinners();
cy.signinOrSignup();
})
it('Create Project', () => {
// cy.visit('')
cy.contains('New Project').trigger('onmouseover').trigger('mouseenter');
cy.get('.create-external-db-project').click()
cy.url({timeout: 6000}).should('contain', '#/project')
cy.get('.database-field input').click().clear().type('dummy_db')
cy.contains('Test Database Connection').click()
cy.contains('Ok & Save Project', {timeout: 3000}).click()
cy.url({timeout: 12000}).should('contain', '#/nc/')
});
it('Stop Project', () => {
// cy.get('.nc-rest-project-row .mdi-stop-circle-outline', {timeout: 10000}).last().trigger('onmouseover').trigger('mouseenter')
cy.get('.nc-rest-project-row .mdi-stop-circle-outline', {timeout: 10000}).last().invoke('show').click();
cy.contains('Submit').closest('button').click();
});
it('Start Project', () => {
cy.get('.nc-rest-project-row .mdi-play-circle-outline', {timeout: 10000}).last().invoke('show').click();
cy.contains('Submit').closest('button').click();
});
it('Restart Project', () => {
cy.get('.nc-rest-project-row .mdi-restart', {timeout: 10000}).last().invoke('show').click();
cy.contains('Submit').closest('button').click();
});
it('Delete Project', () => {
cy.get('.nc-rest-project-row .mdi-delete-circle-outline', {timeout: 10000}).last().invoke('show').click();
cy.contains('Submit').closest('button').click();
});
})

10
cypress/support/commands.js

@ -26,7 +26,13 @@
// for waiting until page load
Cypress.Commands.add('waitForSpinners', () => {
cy.visit('http://localhost:3000', {retryOnNetworkFailure: true, timeout: 120000})
cy.visit('http://localhost:3000', {
retryOnNetworkFailure: true,
timeout: 1200000,
headers: {
"Accept-Encoding": "gzip, deflate"
}
})
cy.get('#nuxt-loading', {timeout: 10_000}).should('have.length', 0)
})
Cypress.Commands.add('signinOrSignup', () => {
@ -41,7 +47,7 @@ Cypress.Commands.add('signinOrSignup', () => {
cy.wait(8000);
cy.get('body').trigger('mousemove');
cy.contains('Let\'s Begin').click();
cy.get('input[type="text"]').type('pranavc@gmail.com');
cy.get('input[type="text"]', {timeout: 12000}).type('pranavc@gmail.com');
cy.get('input[type="password"]').type('Password123.');
cy.get('button:contains("SIGN UP")').click()

Loading…
Cancel
Save