Bläddra i källkod

test: fixed failing test(timeline, recorder, navigation)

version-14
Shariq Ansari 3 år sedan
förälder
incheckning
7a6bee9dab
4 ändrade filer med 50 tillägg och 45 borttagningar
  1. +2
    -2
      cypress/integration/navigation.js
  2. +13
    -13
      cypress/integration/recorder.js
  3. +26
    -29
      cypress/integration/timeline.js
  4. +9
    -1
      cypress/support/commands.js

+ 2
- 2
cypress/integration/navigation.js Visa fil

@@ -13,10 +13,10 @@ context('Navigation', () => {

it.only('Navigate to previous page after login', () => {
cy.visit('/app/todo');
cy.findByTitle('To Do').should('be.visible');
cy.get('.page-head').findByTitle('To Do').should('be.visible');
cy.request('/api/method/logout');
cy.reload();
cy.get('.btn-primary').contains('Login').click();
cy.get('.page-card .btn-primary').contains('Login').click();
cy.location('pathname').should('eq', '/login');
cy.login();
cy.visit('/app');


+ 13
- 13
cypress/integration/recorder.js Visa fil

@@ -14,48 +14,48 @@ context('Recorder', () => {
});

it('Recorder Empty State', () => {
cy.findByTitle('Recorder').should('exist');
cy.get('.page-head').findByTitle('Recorder').should('exist');

cy.get('.indicator-pill').should('contain', 'Inactive').should('have.class', 'red');

cy.findByRole('button', {name: 'Start'}).should('exist');
cy.findByRole('button', {name: 'Clear'}).should('exist');
cy.get('.page-actions').findByRole('button', {name: 'Start'}).should('exist');
cy.get('.page-actions').findByRole('button', {name: 'Clear'}).should('exist');

cy.get('.msg-box').should('contain', 'Inactive');
cy.findByRole('button', {name: 'Start Recording'}).should('exist');
cy.get('.msg-box').should('contain', 'Recorder is Inactive');
cy.get('.msg-box').findByRole('button', {name: 'Start Recording'}).should('exist');
});

it('Recorder Start', () => {
cy.findByRole('button', {name: 'Start'}).click();
cy.get('.page-actions').findByRole('button', {name: 'Start'}).click();
cy.get('.indicator-pill').should('contain', 'Active').should('have.class', 'green');

cy.get('.msg-box').should('contain', 'No Requests');
cy.get('.msg-box').should('contain', 'No Requests found');

cy.visit('/app/List/DocType/List');
cy.intercept('POST', '/api/method/frappe.desk.reportview.get').as('list_refresh');
cy.wait('@list_refresh');

cy.get('.title-text').should('contain', 'DocType');
cy.get('.page-head').findByTitle('DocType').should('exist');
cy.get('.list-count').should('contain', '20 of ');

cy.visit('/app/recorder');
cy.findByTitle('Recorder').should('exist');
cy.get('.result-list').should('contain', '/api/method/frappe.desk.reportview.get');
cy.get('.page-head').findByTitle('Recorder').should('exist');
cy.get('.frappe-list .result-list').should('contain', '/api/method/frappe.desk.reportview.get');
});

it('Recorder View Request', () => {
cy.findByRole('button', {name: 'Start'}).click();
cy.get('.page-actions').findByRole('button', {name: 'Start'}).click();

cy.visit('/app/List/DocType/List');
cy.intercept('POST', '/api/method/frappe.desk.reportview.get').as('list_refresh');
cy.wait('@list_refresh');

cy.get('.title-text').should('contain', 'DocType');
cy.get('.page-head').findByTitle('DocType').should('exist');
cy.get('.list-count').should('contain', '20 of ');

cy.visit('/app/recorder');

cy.get('.list-row-container span').contains('/api/method/frappe').click();
cy.get('.frappe-list .list-row-container span').contains('/api/method/frappe').should('be.visible').click();

cy.url().should('include', '/recorder/request');
cy.get('form').should('contain', '/api/method/frappe');


+ 26
- 29
cypress/integration/timeline.js Visa fil

@@ -8,22 +8,18 @@ context('Timeline', () => {

it('Adding new ToDo, adding new comment, verifying comment addition & deletion and deleting ToDo', () => {
//Adding new ToDo
cy.visit('/app/todo/new-todo-1');
cy.get('[data-fieldname="description"] .ql-editor.ql-blank').type('Test ToDo', {force: true}).wait(200);
cy.get('.page-head .page-actions').findByRole('button', {name: 'Save'}).click();

cy.visit('/app/todo');
cy.click_listview_primary_button('Add ToDo');
cy.findByRole('button', {name: 'Edit in full page'}).click();
cy.findByTitle('New ToDo').should('be.visible');
cy.get('[data-fieldname="description"] .ql-editor').eq(0).type('Test ToDo', {force: true});
cy.wait(200);
cy.findByRole('button', {name: 'Save'}).click();
cy.wait(700);
cy.visit('/app/todo');
cy.get('.level-item.ellipsis').eq(0).click();
cy.click_first_row_in_list();

//To check if the comment box is initially empty and tying some text into it
cy.get('[data-fieldname="comment"] .ql-editor').should('contain', '').type('Testing Timeline');

//Adding new comment
cy.findByRole('button', {name: 'Comment'}).click();
cy.get('.comment-box').findByRole('button', {name: 'Comment'}).click();

//To check if the commented text is visible in the timeline content
cy.get('.timeline-content').should('contain', 'Testing Timeline');
@@ -38,21 +34,21 @@ context('Timeline', () => {

//Discarding comment
cy.click_timeline_action_btn("Edit");
cy.findByRole('button', {name: 'Dismiss'}).click();
cy.click_timeline_action_btn("Dismiss");

//To check if after discarding the timeline content is same as previous
cy.get('.timeline-content').should('contain', 'Testing Timeline 123');

//Deleting the added comment
cy.get('.more-actions > .action-btn').click();
cy.get('.more-actions .dropdown-item').contains('Delete').click();
cy.findByRole('button', {name: 'Yes'}).click();
cy.get('.timeline-message-box .more-actions > .action-btn').click(); //Menu button in timeline item
cy.get('.timeline-message-box .more-actions .dropdown-item').contains('Delete').click();
cy.get_open_dialog().findByRole('button', {name: 'Yes'}).click();
cy.click_modal_primary_button('Yes');

//Deleting the added ToDo
cy.get('[id="page-ToDo"] .menu-btn-group [data-original-title="Menu"]').click();
cy.get('[id="page-ToDo"] .menu-btn-group .dropdown-item').contains('Delete').click();
cy.findByRole('button', {name: 'Yes'}).click();
cy.get('[id="page-ToDo"] .page-actions .menu-btn-group [data-original-title="Menu"]').click();
cy.get('[id="page-ToDo"] .page-actions .menu-btn-group .dropdown-item').contains('Delete').click();
cy.get_open_dialog().findByRole('button', {name: 'Yes'}).click();
});

it('Timeline should have submit and cancel activity information', () => {
@@ -66,31 +62,32 @@ context('Timeline', () => {

//Adding a new entry for the created custom doctype
cy.fill_field('title', 'Test');
cy.findByRole('button', {name: 'Save'}).click();
cy.findByRole('button', {name: 'Submit'}).click();
cy.click_modal_primary_button('Save');
cy.click_modal_primary_button('Submit');

cy.visit('/app/custom-submittable-doctype');
cy.get('.list-subject > .bold > .ellipsis').eq(0).click();
cy.click_first_row_in_list();

//To check if the submission of the documemt is visible in the timeline content
cy.get('.timeline-content').should('contain', 'Administrator submitted this document');
cy.findByRole('button', {name: 'Cancel'}).click({delay: 900});
cy.findByRole('button', {name: 'Yes'}).click();
cy.get('[id="page-Custom Submittable DocType"] .page-actions').findByRole('button', {name: 'Cancel'}).click();
cy.get_open_dialog().findByRole('button', {name: 'Yes'}).click();

//To check if the cancellation of the documemt is visible in the timeline content
cy.get('.timeline-content').should('contain', 'Administrator cancelled this document');

//Deleting the document
cy.visit('/app/custom-submittable-doctype');
cy.get('.list-subject > .select-like > .list-row-checkbox').eq(0).click();
cy.findByRole('button', {name: 'Actions'}).click();
cy.get('.actions-btn-group > .dropdown-menu > li > .dropdown-item').contains("Delete").click();
cy.click_modal_primary_button('Yes', {force: true, delay: 700});
cy.select_first_row_checkbox();
cy.get('.page-actions').findByRole('button', {name: 'Actions'}).click();
cy.get('.page-actions .actions-btn-group [data-label="Delete"]').click();
cy.click_modal_primary_button('Yes');

//Deleting the custom doctype
cy.visit('/app/doctype');
cy.get('.list-subject > .select-like > .list-row-checkbox').eq(0).click();
cy.findByRole('button', {name: 'Actions'}).click();
cy.get('.actions-btn-group [data-label="Delete"]').click();
cy.select_first_row_checkbox();
cy.get('.page-actions').findByRole('button', {name: 'Actions'}).click();
cy.get('.page-actions .actions-btn-group [data-label="Delete"]').click();
cy.click_modal_primary_button('Yes');
});
});

+ 9
- 1
cypress/support/commands.js Visa fil

@@ -353,5 +353,13 @@ Cypress.Commands.add('click_listview_primary_button', (btn_name) => {
});

Cypress.Commands.add('click_timeline_action_btn', (btn_name) => {
cy.get('.timeline-message-box .custom-actions > .btn').contains(btn_name).click();
cy.get('.timeline-message-box .actions .action-btn').contains(btn_name).click();
});

Cypress.Commands.add('click_first_row_in_list', () => {
cy.get('.frappe-list .list-row-container .level-item.ellipsis').first().click();
});

Cypress.Commands.add('select_first_row_checkbox', () => {
cy.get('.frappe-list .select-like > .list-row-checkbox').first().click();
});

Laddar…
Avbryt
Spara