Skip to content

Commit

Permalink
Merge pull request frappe#14316 from shariquerik/flaky-ui-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
surajshetty3416 authored Sep 30, 2021
2 parents 6078cba + b9d6063 commit ccc3115
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 17 deletions.
13 changes: 8 additions & 5 deletions cypress/integration/dashboard_links.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,28 @@ context('Dashboard links', () => {
cy.clear_filters();

cy.visit('/app/user');
cy.get('.list-row-col > .level-item > .ellipsis').eq(0).click();
cy.get('.list-row-col > .level-item > .ellipsis').eq(0).click({ force: true });

//To check if initially the dashboard contains only the "Contact" link and there is no counter
cy.get('[data-doctype="Contact"]').should('contain', 'Contact');

//Adding a new contact
cy.get('.btn[data-doctype="Contact"]').click();
cy.get('.document-link-badge[data-doctype="Contact"]').click();
cy.wait(300);
cy.findByRole('button', {name: 'Add Contact'}).should('be.visible');
cy.findByRole('button', {name: 'Add Contact'}).click();
cy.get('[data-doctype="Contact"][data-fieldname="first_name"]').type('Admin');
cy.findByRole('button', {name: 'Save'}).click();
cy.visit('/app/user');
cy.get('.list-row-col > .level-item > .ellipsis').eq(0).click();
cy.get('.list-row-col > .level-item > .ellipsis').eq(0).click({ force: true });

//To check if the counter for contact doc is "1" after adding the contact
cy.get('[data-doctype="Contact"] > .count').should('contain', '1');
cy.get('[data-doctype="Contact"]').contains('Contact').click();

//Deleting the newly created contact
cy.visit('/app/contact');
cy.get('.list-subject > .select-like > .list-row-checkbox').eq(0).click();
cy.get('.list-subject > .select-like > .list-row-checkbox').eq(0).click({ force: true });
cy.findByRole('button', {name: 'Actions'}).click();
cy.get('.actions-btn-group [data-label="Delete"]').click();
cy.findByRole('button', {name: 'Yes'}).click({delay: 700});
Expand All @@ -36,7 +39,7 @@ context('Dashboard links', () => {
//To check if the counter from the "Contact" doc link is removed
cy.wait(700);
cy.visit('/app/user');
cy.get('.list-row-col > .level-item > .ellipsis').eq(0).click();
cy.get('.list-row-col > .level-item > .ellipsis').eq(0).click({ force: true });
cy.get('[data-doctype="Contact"]').should('contain', 'Contact');
});

Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/folder_navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ context('Folder Navigation', () => {
it('Deleting Test Folder from the home', () => {
//Deleting the Test Folder added in the home directory
cy.visit('/app/file/view/home');
cy.get('.level-left > .list-subject > .list-row-checkbox').eq(0).click({force: true, delay: 500});
cy.get('.level-left > .list-subject > .file-select >.list-row-checkbox').eq(0).click({force: true, delay: 500});
cy.findByRole('button', {name: 'Actions'}).click();
cy.get('.actions-btn-group [data-label="Delete"]').click();
cy.findByRole('button', {name: 'Yes'}).click();
Expand Down
5 changes: 4 additions & 1 deletion cypress/integration/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ context('Form', () => {
});
it('create a new form', () => {
cy.visit('/app/todo/new');
cy.fill_field('description', 'this is a test todo', 'Text Editor');
cy.get('[data-fieldname="description"] .ql-editor')
.first()
.click()
.type('this is a test todo');
cy.wait(300);
cy.get('.page-title').should('contain', 'Not Saved');
cy.intercept({
Expand Down
11 changes: 4 additions & 7 deletions cypress/integration/list_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ context('List View', () => {
cy.get('.dropdown-menu li:visible .dropdown-item .menu-item-label[data-label="Edit"]').click();

cy.get('.modal-body .form-control[data-fieldname="field"]').first().select('Due Date').wait(200);
cy.get('.modal-body .frappe-control[data-fieldname="value"] input:visible').first().focus();
cy.get('.datepickers-container .datepicker.active').should('be.visible');

cy.get('.datepickers-container .datepicker.active .datepicker--cell-day.-current-').click({force: true});
cy.get('.modal-body .frappe-control[data-fieldname="value"] input:visible').first().focus();
cy.get('.datepickers-container .datepicker.active .datepicker--cell-day.-current-').click({force: true});
cy.fill_field('value', '09-28-21', 'Date');

cy.get('.modal-footer .standard-actions .btn-primary').click();
cy.wait(500);
Expand All @@ -46,7 +41,9 @@ context('List View', () => {
}).as('real-time-update');
cy.wrap(elements).contains('Approve').click();
cy.wait(['@bulk-approval', '@real-time-update']);
cy.hide_dialog();
cy.wait(300);
cy.get_open_dialog().find('.btn-modal-close').click();
cy.reload();
cy.clear_filters();
cy.get('.list-row-container:visible').should('contain', 'Approved');
});
Expand Down
1 change: 1 addition & 0 deletions cypress/integration/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ context('Navigation', () => {

it.only('Navigate to previous page after login', () => {
cy.visit('/app/todo');
cy.findByTitle('To Do').should('be.visible');
cy.request('/api/method/logout');
cy.reload();
cy.get('.btn-primary').contains('Login').click();
Expand Down
1 change: 1 addition & 0 deletions cypress/integration/timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ context('Timeline', () => {
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();
Expand Down
8 changes: 6 additions & 2 deletions cypress/integration/timeline_email.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ context('Timeline Email', () => {
cy.visit('/app/todo');
});

it('Adding new ToDo, adding email and verifying timeline content for email attachment, deleting attachment and ToDo', () => {
//Adding new ToDo
it('Adding new ToDo', () => {
cy.click_listview_primary_button('Add ToDo');
cy.get('.custom-actions:visible > .btn').contains("Edit in full page").click({delay: 500});
cy.fill_field("description", "Test ToDo", "Text Editor");
cy.wait(500);
cy.get('.primary-action').contains('Save').click({force: true});
cy.wait(700);
});

it('Adding email and verifying timeline content for email attachment, deleting attachment and ToDo', () => {
cy.visit('/app/todo');
cy.get('.list-row > .level-left > .list-subject').eq(0).click();

Expand Down Expand Up @@ -41,11 +43,13 @@ context('Timeline Email', () => {
cy.get('#page-Communication > .page-head > .container > .row > .col > .standard-actions > .menu-btn-group > .btn').click();
cy.get('#page-Communication > .page-head > .container > .row > .col > .standard-actions > .menu-btn-group > .dropdown-menu > li > .grey-link').eq(9).click();
cy.get('.modal.show > .modal-dialog > .modal-content > .modal-footer > .standard-actions > .btn-primary').click();

cy.visit('/app/todo');
cy.get('.list-row > .level-left > .list-subject > .level-item.ellipsis > .ellipsis').eq(0).click();

//Removing the added attachment
cy.get('.attachment-row > .data-pill > .remove-btn > .icon').click();
cy.wait(500);
cy.get('.modal-footer:visible > .standard-actions > .btn-primary').contains('Yes').click();

//To check if the removed attachment is shown in the timeline content
Expand Down
2 changes: 1 addition & 1 deletion frappe/public/js/frappe/views/communication.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ frappe.views.CommunicationComposer = class {
minimizable: true
});

this.dialog.sections[0].wrapper.addClass('to_section');
$(this.dialog.$wrapper.find(".form-section").get(0)).addClass('to_section');

this.prepare();
this.dialog.show();
Expand Down

0 comments on commit ccc3115

Please sign in to comment.