Browse Source

test(cypress): test correction

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/510/head
Pranav C 3 years ago
parent
commit
ac34f32c46
  1. 98
      cypress/integration/app_gql_api_project_spec.js
  2. 103
      cypress/integration/app_rest_api_project_spec.js
  3. 1
      cypress/integration/graphql/create_table_spec.js
  4. 3
      cypress/integration/graphql/open_existing_table_spec.js
  5. 3
      cypress/integration/graphql/open_existing_table_with_m2m_spec.js
  6. 1
      cypress/integration/rest/create_table_spec.js
  7. 3
      cypress/integration/rest/open_existing_table_spec.js
  8. 3
      cypress/integration/rest/open_existing_table_with_m2m_spec.js
  9. 63
      cypress/support/commands.js

98
cypress/integration/app_gql_api_project_spec.js

@ -1,98 +0,0 @@
describe('GraphQL api project test', () => {
/*
before(() => {
cy.visit('http://localhost:3000', {retryOnNetworkFailure: true, timeout: 120000})
cy.waitForSpinners();
})
it('Sign Up / Sign In', () => {
// console.log('=====',cy.$$(cy.get('body')).find('.welcome-page').length)
cy.get('body').then(($body) => {
if ($body.find('.welcome-page').length > 0) {
// if (cy.get('body').find('.welcome-page').should('exist')) {
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="password"]').type('Password123.');
cy.get('button:contains("SIGN UP")').click()
// cy.url().shou
} else {
cy.get('input[type="text"]').type('pranavc@gmail.com');
cy.get('input[type="password"]').type('Password123.');
cy.get('button:contains("SIGN IN")').click()
}
});
});
it('Create Project', () => {
cy.wait(1500);
cy.get('body').then($el => {
if ($el.find('.project-row').length) {
cy.get('.project-row').first().click();
} else {
cy.contains('New Project').trigger('onmouseover').trigger('mouseenter');
cy.get('.create-external-db-project').click()
cy.wait(1500);
cy.url().should('contain', '#/project')
cy.get('.database-field input').click().clear().type('sakila')
cy.contains('Test Database Connection').click()
cy.wait(1500);
cy.contains('Ok & Save Project').click()
}
cy.wait(5000);
cy.url().should('contain', '#/nc/')
})
});
it('Create Table', () => {
cy.get('.add-btn').click();
const name = 'Test' + Date.now();
cy.get('.nc-create-table-card .nc-table-name input[type="text"]').first().click().clear().type(name)
cy.get('.nc-create-table-card .nc-table-name-alias input[type="text"]').first().should('have.value', name.toLowerCase())
cy.wait(5000)
cy.get('.nc-create-table-card .nc-create-table-submit').first().click()
cy.get(`.project-tab:contains(${name})`).should('exist')
cy.url().should('contain', `?name=${name}&`)
});
it('Open and check country table', () => {
cy.contains('Country').click();
cy.get(`.project-tab:contains(Country)`).should('exist')
cy.url().should('contain', `?name=Country&`)
cy.get('td[data-col="Country => City"] div').first().click()
cy.get('td[data-col="Country => City"] div .mdi-arrow-expand').first().click()
cy.get(":contains(Link to 'City')").should('exist')
cy.get(":contains(Link to 'City'):visible").click()
});
it('Open and check actor table for m2m', () => {
cy.contains('Actor').click();
cy.get(`.project-tab:contains(Actor)`).should('exist')
cy.url().should('contain', `?name=Actor&`)
cy.get('td[data-col="Actor <=> Film"] div').first().click()
cy.get('td[data-col="Actor <=> Film"] div .mdi-arrow-expand').first().click()
//
// cy.get(":contains(Link to 'City')").should('exist')
//
// cy.get(":contains(Link to 'City'):visible").click()
});
*/
})

103
cypress/integration/app_rest_api_project_spec.js

@ -1,103 +0,0 @@
describe('Rest api project test', () => {
/* before(() => {
cy.visit('http://localhost:3000', {retryOnNetworkFailure: true, timeout: 120000})
cy.waitForSpinners();
})
it('Sign Up / Sign In', () => {
// console.log('=====',cy.$$(cy.get('body')).find('.welcome-page').length)
cy.get('body').then(($body) => {
if ($body.find('.welcome-page').length > 0) {
// if (cy.get('body').find('.welcome-page').should('exist')) {
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="password"]').type('Password123.');
cy.get('button:contains("SIGN UP")').click()
// cy.url().shou
} else {
cy.get('input[type="text"]').type('pranavc@gmail.com');
cy.get('input[type="password"]').type('Password123.');
cy.get('button:contains("SIGN IN")').click()
}
});
});
it('Create Project', () => {
cy.wait(1500);
cy.get('body').then($el => {
if ($el.find('.project-row').length) {
cy.get('.project-row').first().click();
} else {
cy.contains('New Project').trigger('onmouseover').trigger('mouseenter');
cy.get('.create-external-db-project').click()
cy.wait(1500);
cy.url().should('contain', '#/project')
cy.get('.database-field input').click().clear().type('sakila')
cy.contains('Test Database Connection').click()
cy.wait(1500);
cy.contains('Ok & Save Project').click()
}
cy.wait(5000);
cy.url().should('contain', '#/nc/')
})
});
it('Create Table', () => {
cy.get('.add-btn').click();
const name = 'Test' + Date.now();
cy.get('.nc-create-table-card .nc-table-name input[type="text"]').first().click().clear().type(name)
cy.get('.nc-create-table-card .nc-table-name-alias input[type="text"]').first().should('have.value', name.toLowerCase())
cy.wait(5000)
cy.get('.nc-create-table-card .nc-create-table-submit').first().click()
cy.get(`.project-tab:contains(${name})`).should('exist')
cy.url().should('contain', `?name=${name}&`)
});
it('Open and check country table', () => {
cy.contains('Country').first().click({force: true});
cy.get(`.project-tab:contains(Country):visible`).should('exist')
cy.url().should('contain', `?name=Country&`)
cy.get('td[data-col="Country => City"] div:visible').first().click()
cy.get('td[data-col="Country => City"] div .mdi-arrow-expand:visible').first().click()
cy.get(":contains(Link to 'City'):visible").should('exist')
cy.get(":contains(Link to 'City'):visible").first().click()
});
//
it('Open and check actor table for m2m', () => {
cy.contains('Actor').first().click({force: true});
cy.get(`.project-tab:contains(Actor)`).should('exist')
cy.url().should('contain', `?name=Actor&`)
cy.get('td[data-col="Actor <=> Film"] div').first().click({force: true})
cy.get('td[data-col="Actor <=> Film"] div .mdi-arrow-expand').first().click({force: true})
//
// cy.get(":contains(Link to 'City')").should('exist')
//
// cy.get(":contains(Link to 'City'):visible").click()
cy.get('.child-card:visible').should('exist').first().click()
cy.contains('Save Row').should('exist');
cy.contains('Save Row').should('exist');
});*/
})

1
cypress/integration/graphql/create_table_spec.js

@ -1,7 +1,6 @@
describe('Rest api project test', () => {
before(() => {
cy.visit('http://localhost:3000', {retryOnNetworkFailure: true, timeout: 120000})
cy.waitForSpinners();
cy.openOrCreateGqlProject();
})

3
cypress/integration/graphql/open_existing_table_spec.js

@ -1,7 +1,6 @@
describe('GraphQL api - Existing table', () => {
before(() => {
cy.visit('http://localhost:3000', {retryOnNetworkFailure: true, timeout: 120000})
cy.waitForSpinners();
cy.openOrCreateGqlProject();
})
@ -15,7 +14,7 @@ describe('GraphQL api - Existing table', () => {
cy.get(`.project-tab:contains(Country):visible`).should('exist')
cy.url().should('contain', `?name=Country&`)
cy.get('td[data-col="Country => City"] div:visible', {timeout: 6000}).first().click()
cy.get('td[data-col="Country => City"] div:visible', {timeout: 12000}).first().click()
cy.get('td[data-col="Country => City"] div .mdi-arrow-expand:visible').first().click()
cy.get(":contains(Link to 'City'):visible").should('exist')

3
cypress/integration/graphql/open_existing_table_with_m2m_spec.js

@ -1,7 +1,6 @@
describe('GraphQL api - Existing table with M2M', () => {
before(() => {
cy.visit('http://localhost:3000', {retryOnNetworkFailure: true, timeout: 120000})
cy.waitForSpinners();
cy.openOrCreateGqlProject();
})
@ -16,7 +15,7 @@ describe('GraphQL api - Existing table with M2M', () => {
cy.get(`.project-tab:contains(Actor)`).should('exist')
cy.url().should('contain', `?name=Actor&`)
cy.get('td[data-col="Actor <=> Film"] div').first().click({force: true})
cy.get('td[data-col="Actor <=> Film"] div', {timeout:12000}).first().click({force: true})
cy.get('td[data-col="Actor <=> Film"] div .mdi-arrow-expand').first().click({force: true})
//
// cy.get(":contains(Link to 'City')").should('exist')

1
cypress/integration/rest/create_table_spec.js

@ -1,7 +1,6 @@
describe('Rest api - New table', () => {
before(() => {
cy.visit('http://localhost:3000', {retryOnNetworkFailure: true, timeout: 120000})
cy.waitForSpinners();
cy.openOrCreateRestProject();
})

3
cypress/integration/rest/open_existing_table_spec.js

@ -1,7 +1,6 @@
describe('Rest api - Existing table', () => {
before(() => {
cy.visit('http://localhost:3000', {retryOnNetworkFailure: true, timeout: 120000})
cy.waitForSpinners();
cy.openOrCreateRestProject();
})
@ -15,7 +14,7 @@ describe('Rest api - Existing table', () => {
cy.get(`.project-tab:contains(Country):visible`).should('exist')
cy.url().should('contain', `?name=Country&`)
cy.get('td[data-col="Country => City"] div:visible', {timeout: 6000}).first().click()
cy.get('td[data-col="Country => City"] div:visible', {timeout: 12000}).first().click()
cy.get('td[data-col="Country => City"] div .mdi-arrow-expand:visible').first().click()
cy.get(":contains(Link to 'City'):visible").should('exist')

3
cypress/integration/rest/open_existing_table_with_m2m_spec.js

@ -1,7 +1,6 @@
describe('Rest api - Existing table with M2M', () => {
before(() => {
cy.visit('http://localhost:3000', {retryOnNetworkFailure: true, timeout: 120000})
cy.waitForSpinners();
cy.openOrCreateRestProject();
})
@ -16,7 +15,7 @@ describe('Rest api - Existing table with M2M', () => {
cy.get(`.project-tab:contains(Actor)`).should('exist')
cy.url().should('contain', `?name=Actor&`)
cy.get('td[data-col="Actor <=> Film"] div').first().click({force: true})
cy.get('td[data-col="Actor <=> Film"] div', {timeout:12000}).first().click({force: true})
cy.get('td[data-col="Actor <=> Film"] div .mdi-arrow-expand').first().click({force: true})
//
// cy.get(":contains(Link to 'City')").should('exist')

63
cypress/support/commands.js

@ -26,28 +26,41 @@
// for waiting until page load
Cypress.Commands.add('waitForSpinners', () => {
cy.visit('http://localhost:3000', {retryOnNetworkFailure: true, timeout: 120000})
cy.get('#nuxt-loading', {timeout: 10_000}).should('have.length', 0)
})
Cypress.Commands.add('signinOrSignup', () => {
// signin/signup
cy.get('body').then(($body) => {
cy.wait(1000)
cy.url().then(url => {
if (!url.includes('/projects')) {
// handle initial load
if ($body.find('.welcome-page').length > 0) {
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="password"]').type('Password123.');
cy.get('button:contains("SIGN UP")').click()
// handle signin
} else {
cy.get('input[type="text"]').type('pranavc@gmail.com');
cy.get('input[type="password"]').type('Password123.');
cy.get('button:contains("SIGN IN")').click()
}
}
})
})
});
// for opening/creating a rest project
Cypress.Commands.add('openOrCreateRestProject', () => {
// signin/signup
cy.get('body').then(($body) => {
// handle initial load
if ($body.find('.welcome-page').length > 0) {
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="password"]').type('Password123.');
cy.get('button:contains("SIGN UP")').click()
} else {
cy.get('input[type="text"]').type('pranavc@gmail.com');
cy.get('input[type="password"]').type('Password123.');
cy.get('button:contains("SIGN IN")').click()
}
});
cy.signinOrSignup()
cy.wait(2000);
cy.get('body').then($body => {
// if project exist open
@ -66,27 +79,13 @@ Cypress.Commands.add('openOrCreateRestProject', () => {
cy.url({timeout: 20000}).should('contain', '#/nc/')
})
Cypress.Commands.add('openOrCreateGqlProject', () => {
cy.signinOrSignup()
// signin/signup
cy.get('body').then(($body) => {
// handle initial load
if ($body.find('.welcome-page').length > 0) {
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="password"]').type('Password123.');
cy.get('button:contains("SIGN UP")').click()
// handle signin
} else {
cy.get('input[type="text"]').type('pranavc@gmail.com');
cy.get('input[type="password"]').type('Password123.');
cy.get('button:contains("SIGN IN")').click()
}
});
cy.wait(2000);
cy.get('body').then($body => {
// if project exist open

Loading…
Cancel
Save