From 6bdcae1201de560971dc882c901ad18eb7f71f26 Mon Sep 17 00:00:00 2001 From: Kenneth Sequeira Date: Fri, 28 May 2021 21:19:21 +0530 Subject: [PATCH 01/37] feat: add number format parameter in doc.get_formatted --- frappe/model/base_document.py | 4 ++-- frappe/utils/formatters.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frappe/model/base_document.py b/frappe/model/base_document.py index 54d77ba988..1ac07f5fb7 100644 --- a/frappe/model/base_document.py +++ b/frappe/model/base_document.py @@ -862,7 +862,7 @@ class BaseDocument(object): return self._precision[cache_key][fieldname] - def get_formatted(self, fieldname, doc=None, currency=None, absolute_value=False, translated=False): + def get_formatted(self, fieldname, doc=None, currency=None, absolute_value=False, translated=False, format=None): from frappe.utils.formatters import format_value df = self.meta.get_field(fieldname) @@ -886,7 +886,7 @@ class BaseDocument(object): if (absolute_value or doc.get('absolute_value')) and isinstance(val, (int, float)): val = abs(self.get(fieldname)) - return format_value(val, df=df, doc=doc, currency=currency) + return format_value(val, df=df, doc=doc, currency=currency, format=format) def is_print_hide(self, fieldname, df=None, for_print=True): """Returns true if fieldname is to be hidden for print. diff --git a/frappe/utils/formatters.py b/frappe/utils/formatters.py index 7913413878..c0c7e4bca0 100644 --- a/frappe/utils/formatters.py +++ b/frappe/utils/formatters.py @@ -9,7 +9,7 @@ from frappe.model.meta import get_field_currency, get_field_precision import re from six import string_types -def format_value(value, df=None, doc=None, currency=None, translated=False): +def format_value(value, df=None, doc=None, currency=None, translated=False, format=None): '''Format value based on given fieldtype, document reference, currency reference. If docfield info (df) is not given, it will try and guess based on the datatype of the value''' if isinstance(df, string_types): @@ -58,7 +58,7 @@ def format_value(value, df=None, doc=None, currency=None, translated=False): elif df.get("fieldtype") == "Currency": default_currency = frappe.db.get_default("currency") currency = currency or get_field_currency(df, doc) or default_currency - return fmt_money(value, precision=get_field_precision(df, doc), currency=currency) + return fmt_money(value, precision=get_field_precision(df, doc), currency=currency, format=format) elif df.get("fieldtype") == "Float": precision = get_field_precision(df, doc) From 4bafae6e38d898096c49ce2bf5600f0772f05f17 Mon Sep 17 00:00:00 2001 From: Kenneth Sequeira Date: Sat, 12 Jun 2021 22:04:00 +0530 Subject: [PATCH 02/37] fix: add test cases --- frappe/tests/test_document.py | 26 ++++++++++++++++++++++++++ frappe/tests/test_fmt_money.py | 3 +++ frappe/tests/test_formatter.py | 23 ++++++++++++++++++++++- 3 files changed, 51 insertions(+), 1 deletion(-) diff --git a/frappe/tests/test_document.py b/frappe/tests/test_document.py index 1a5a8721fd..eca547e9bd 100644 --- a/frappe/tests/test_document.py +++ b/frappe/tests/test_document.py @@ -229,3 +229,29 @@ class TestDocument(unittest.TestCase): self.assertEqual(frappe.db.get_value("Currency", d.name), d.name) frappe.delete_doc_if_exists("Currency", "Frappe Coin", 1) + + def test_get_formatted(self): + frappe.get_doc({ + 'doctype': 'DocType', + 'name': 'Test Formatted', + 'module': 'Custom', + 'custom': 1, + 'istable': 1, + 'fields': [ + {'label': 'Currency', 'fieldname': 'currency', 'reqd': 1, 'fieldtype': 'Currency'}, + ] + }).insert() + + frappe.delete_doc_if_exists("Currency", "INR", 1) + + d = frappe.get_doc({ + 'doctype': 'Currency', + 'currency_name': 'INR', + 'symbol': '₹', + }).insert() + + d = frappe.get_doc({ + 'doctype': 'Test Formatted', + 'currency': 100000 + }) + self.assertEquals(d.get_formatted('curency', currency='INR', format="#,###.##"), '₹ 100,000.00') \ No newline at end of file diff --git a/frappe/tests/test_fmt_money.py b/frappe/tests/test_fmt_money.py index a1321658b7..8d76b4dcb4 100644 --- a/frappe/tests/test_fmt_money.py +++ b/frappe/tests/test_fmt_money.py @@ -94,6 +94,9 @@ class TestFmtMoney(unittest.TestCase): self.assertEqual(fmt_money(1000.456), "1.000,456") frappe.db.set_default("currency_precision", "") + def test_custom_fmt_money_format(self): + self.assertEqual(fmt_money(100000, format="#,###.##"), '100,000.00') + if __name__=="__main__": frappe.connect() unittest.main() \ No newline at end of file diff --git a/frappe/tests/test_formatter.py b/frappe/tests/test_formatter.py index 5257e1c717..5423d92520 100644 --- a/frappe/tests/test_formatter.py +++ b/frappe/tests/test_formatter.py @@ -22,4 +22,25 @@ class TestFormatter(unittest.TestCase): doc.currency = 'USD' self.assertEqual(format(100, df, doc), "$ 100.00") - frappe.db.set_default("currency", None) \ No newline at end of file + frappe.db.set_default("currency", None) + + def test_custom_currency_formatting(self): + df = frappe._dict({ + 'fieldname': 'amount', + 'fieldtype': 'Currency', + 'options': 'currency' + }) + + doc = frappe._dict({ + 'amount': 5 + }) + frappe.db.set_default("currency", 'INR') + + # if currency field is not passed then default currency should be used. + self.assertEqual(format(100000, df, doc, format="#,###.##"), '₹ 100,000.00') + + doc.currency = 'USD' + self.assertEqual(format(100000, df, doc, format="#,###.##"), '$ 100,000.00') + + frappe.db.set_default("currency", None) + \ No newline at end of file From 3336915dae72836ff85396f2c344422348bc9e8d Mon Sep 17 00:00:00 2001 From: Kenneth Sequeira Date: Sat, 12 Jun 2021 23:15:47 +0530 Subject: [PATCH 03/37] fix: test_document test --- frappe/tests/test_document.py | 1 - 1 file changed, 1 deletion(-) diff --git a/frappe/tests/test_document.py b/frappe/tests/test_document.py index eca547e9bd..a70f99aaad 100644 --- a/frappe/tests/test_document.py +++ b/frappe/tests/test_document.py @@ -236,7 +236,6 @@ class TestDocument(unittest.TestCase): 'name': 'Test Formatted', 'module': 'Custom', 'custom': 1, - 'istable': 1, 'fields': [ {'label': 'Currency', 'fieldname': 'currency', 'reqd': 1, 'fieldtype': 'Currency'}, ] From 13caf6910a4bc041a863db0106a9ec1b7b62668b Mon Sep 17 00:00:00 2001 From: Kenneth Sequeira Date: Tue, 15 Jun 2021 22:33:06 +0530 Subject: [PATCH 04/37] fix: test_document test fix --- frappe/tests/test_document.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/tests/test_document.py b/frappe/tests/test_document.py index a70f99aaad..ed4901a79a 100644 --- a/frappe/tests/test_document.py +++ b/frappe/tests/test_document.py @@ -253,4 +253,4 @@ class TestDocument(unittest.TestCase): 'doctype': 'Test Formatted', 'currency': 100000 }) - self.assertEquals(d.get_formatted('curency', currency='INR', format="#,###.##"), '₹ 100,000.00') \ No newline at end of file + self.assertEquals(d.get_formatted('currency', currency='INR', format="#,###.##"), '₹ 100,000.00') \ No newline at end of file From f5e40141af794ae770df3c39ee130a8509b07f50 Mon Sep 17 00:00:00 2001 From: Kenneth Sequeira Date: Tue, 15 Jun 2021 22:46:05 +0530 Subject: [PATCH 05/37] fix: readding test for test_formatter --- frappe/tests/test_formatter.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frappe/tests/test_formatter.py b/frappe/tests/test_formatter.py index 5423d92520..636f3d970d 100644 --- a/frappe/tests/test_formatter.py +++ b/frappe/tests/test_formatter.py @@ -40,7 +40,6 @@ class TestFormatter(unittest.TestCase): self.assertEqual(format(100000, df, doc, format="#,###.##"), '₹ 100,000.00') doc.currency = 'USD' - self.assertEqual(format(100000, df, doc, format="#,###.##"), '$ 100,000.00') + self.assertEqual(format(100000, df, doc, format="#,###.##"), "$ 100,000.00") frappe.db.set_default("currency", None) - \ No newline at end of file From bfc7c6b10c4dd234f9534e6de5089a4bcbb8cc6b Mon Sep 17 00:00:00 2001 From: shariquerik Date: Mon, 21 Jun 2021 14:42:19 +0530 Subject: [PATCH 06/37] fix: datetime field form validation fix --- frappe/public/js/frappe/form/controls/base_control.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/form/controls/base_control.js b/frappe/public/js/frappe/form/controls/base_control.js index d6c268a28a..ee40bbe43d 100644 --- a/frappe/public/js/frappe/form/controls/base_control.js +++ b/frappe/public/js/frappe/form/controls/base_control.js @@ -160,7 +160,13 @@ frappe.ui.form.Control = class BaseControl { validate_and_set_in_model(value, e) { var me = this; let force_value_set = (this.doc && this.doc.__run_link_triggers); - let is_value_same = (this.get_model_value() === value); + let model_value = this.get_model_value(); + + if (this.df && this.df.fieldtype == 'Datetime') { + model_value = frappe.datetime.get_datetime_as_string(model_value); + } + + let is_value_same = (model_value === value); if (this.inside_change_event || (!force_value_set && is_value_same)) { return Promise.resolve(); From 61deecbd7c1267d170206969b60e326e217ef6fa Mon Sep 17 00:00:00 2001 From: Mohammad Hasnain Mohsin Rajan Date: Mon, 28 Jun 2021 18:30:55 +0530 Subject: [PATCH 07/37] chore: fix tests --- frappe/tests/test_formatter.py | 1 + 1 file changed, 1 insertion(+) diff --git a/frappe/tests/test_formatter.py b/frappe/tests/test_formatter.py index 636f3d970d..a837573dbc 100644 --- a/frappe/tests/test_formatter.py +++ b/frappe/tests/test_formatter.py @@ -37,6 +37,7 @@ class TestFormatter(unittest.TestCase): frappe.db.set_default("currency", 'INR') # if currency field is not passed then default currency should be used. + print(doc.currency) self.assertEqual(format(100000, df, doc, format="#,###.##"), '₹ 100,000.00') doc.currency = 'USD' From 4b0c67f57cd68ec591ecf100eb2ec7de77b025ba Mon Sep 17 00:00:00 2001 From: Mohammad Hasnain Mohsin Rajan Date: Mon, 28 Jun 2021 18:43:03 +0530 Subject: [PATCH 08/37] chore: debug tests --- frappe/tests/test_formatter.py | 1 + 1 file changed, 1 insertion(+) diff --git a/frappe/tests/test_formatter.py b/frappe/tests/test_formatter.py index a837573dbc..5ebfb3ee6d 100644 --- a/frappe/tests/test_formatter.py +++ b/frappe/tests/test_formatter.py @@ -37,6 +37,7 @@ class TestFormatter(unittest.TestCase): frappe.db.set_default("currency", 'INR') # if currency field is not passed then default currency should be used. + print("doc.currency") print(doc.currency) self.assertEqual(format(100000, df, doc, format="#,###.##"), '₹ 100,000.00') From 64e37d6ab9ba7b9d3b9804d34b65a280b0b2a74b Mon Sep 17 00:00:00 2001 From: Mohammad Hasnain Mohsin Rajan Date: Tue, 29 Jun 2021 10:16:32 +0530 Subject: [PATCH 09/37] chore: debug tests --- frappe/tests/test_formatter.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frappe/tests/test_formatter.py b/frappe/tests/test_formatter.py index 5ebfb3ee6d..cd7b8add9d 100644 --- a/frappe/tests/test_formatter.py +++ b/frappe/tests/test_formatter.py @@ -39,6 +39,9 @@ class TestFormatter(unittest.TestCase): # if currency field is not passed then default currency should be used. print("doc.currency") print(doc.currency) + print("frappe.db.get_default('currency')") + print(frappe.db.get_default("currency")) + self.assertEqual(format(100000, df, doc, format="#,###.##"), '₹ 100,000.00') doc.currency = 'USD' From 75cb917a7beee86d1d22a100f083a77b6f7ba925 Mon Sep 17 00:00:00 2001 From: shariquerik Date: Tue, 13 Jul 2021 21:31:03 +0530 Subject: [PATCH 10/37] test: UI test for datetime field form validation --- .../datetime_field_form_validation.js | 18 ++++++++++++++++++ frappe/tests/ui_test_helpers.py | 12 ++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 cypress/integration/datetime_field_form_validation.js diff --git a/cypress/integration/datetime_field_form_validation.js b/cypress/integration/datetime_field_form_validation.js new file mode 100644 index 0000000000..6a6ea4c7af --- /dev/null +++ b/cypress/integration/datetime_field_form_validation.js @@ -0,0 +1,18 @@ +context('Datetime Validation', () => { + before(() => { + cy.login(); + cy.visit('/app/communication'); + cy.window().its('frappe').then(frappe => { + frappe.call("frappe.tests.ui_test_helpers.create_communication_records"); + }); + }); + + it('datetime field form validation', () => { + cy.visit('/app/communication'); + cy.get('a[title="Test Form Communication 1"]').invoke('attr', 'data-name') + .then((name) => { + cy.visit(`/app/communication/${name}`); + cy.get('.indicator-pill').should('contain', 'Open').should('have.class', 'red'); + }) + }); +}); \ No newline at end of file diff --git a/frappe/tests/ui_test_helpers.py b/frappe/tests/ui_test_helpers.py index f56311b2e3..f4a6f474ce 100644 --- a/frappe/tests/ui_test_helpers.py +++ b/frappe/tests/ui_test_helpers.py @@ -60,6 +60,18 @@ def create_todo_records(): "description": "this is fourth todo" }).insert() +@frappe.whitelist() +def create_communication_records(): + if frappe.db.get_all('Communication', {'subject': 'Test Form Communication 1'}): + return + + frappe.get_doc({ + "doctype": "Communication", + "recipients": "test@gmail.com", + "subject": "Test Form Communication 1", + "communication_date": frappe.utils.now_datetime(), + }).insert() + @frappe.whitelist() def setup_workflow(): from frappe.workflow.doctype.workflow.test_workflow import create_todo_workflow From 98f33b59811f2cdcf9b66f1736e5bedfb77735cc Mon Sep 17 00:00:00 2001 From: shariquerik Date: Tue, 13 Jul 2021 21:56:57 +0530 Subject: [PATCH 11/37] fix: sider fix --- cypress/integration/datetime_field_form_validation.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cypress/integration/datetime_field_form_validation.js b/cypress/integration/datetime_field_form_validation.js index 6a6ea4c7af..dff1f0562c 100644 --- a/cypress/integration/datetime_field_form_validation.js +++ b/cypress/integration/datetime_field_form_validation.js @@ -10,9 +10,9 @@ context('Datetime Validation', () => { it('datetime field form validation', () => { cy.visit('/app/communication'); cy.get('a[title="Test Form Communication 1"]').invoke('attr', 'data-name') - .then((name) => { - cy.visit(`/app/communication/${name}`); - cy.get('.indicator-pill').should('contain', 'Open').should('have.class', 'red'); - }) + .then((name) => { + cy.visit(`/app/communication/${name}`); + cy.get('.indicator-pill').should('contain', 'Open').should('have.class', 'red'); + }); }); }); \ No newline at end of file From e3a1f6f1d09c4973a20c6a562697cb850cb3bc03 Mon Sep 17 00:00:00 2001 From: shariquerik Date: Wed, 14 Jul 2021 13:25:17 +0530 Subject: [PATCH 12/37] chore: Added comment --- cypress/integration/datetime_field_form_validation.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cypress/integration/datetime_field_form_validation.js b/cypress/integration/datetime_field_form_validation.js index dff1f0562c..66fdde6863 100644 --- a/cypress/integration/datetime_field_form_validation.js +++ b/cypress/integration/datetime_field_form_validation.js @@ -1,4 +1,4 @@ -context('Datetime Validation', () => { +context('Datetime Field Validation', () => { before(() => { cy.login(); cy.visit('/app/communication'); @@ -7,6 +7,7 @@ context('Datetime Validation', () => { }); }); + // validating datetime field value when value is set from backend and get validated on form load. it('datetime field form validation', () => { cy.visit('/app/communication'); cy.get('a[title="Test Form Communication 1"]').invoke('attr', 'data-name') From 4a546942e4711ce5e25c78970faa8e4b016d9137 Mon Sep 17 00:00:00 2001 From: Kenneth Sequeira Date: Tue, 20 Jul 2021 20:09:18 +0530 Subject: [PATCH 13/37] fix: currency test --- frappe/tests/test_currency_formatter.py | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 frappe/tests/test_currency_formatter.py diff --git a/frappe/tests/test_currency_formatter.py b/frappe/tests/test_currency_formatter.py new file mode 100644 index 0000000000..75cb42dc49 --- /dev/null +++ b/frappe/tests/test_currency_formatter.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +import frappe +from frappe import format +import unittest + +class TestFormatter(unittest.TestCase): + def test_custom_currency_formatting(self): + df = frappe._dict({ + 'fieldname': 'amount', + 'fieldtype': 'Currency', + 'options': 'currency' + }) + + doc = frappe._dict({ + 'amount': 5 + }) + frappe.db.set_default("currency", 'INR') + + # if currency field is not passed then default currency should be used. + print("doc.currency") + print(doc.currency) + print("frappe.db.get_default('currency')") + print(frappe.db.get_default("currency")) + + self.assertEqual(format(100000, df, doc, format="#,###.##"), '₹ 100,000.00') + + doc.currency = 'USD' + self.assertEqual(format(100000, df, doc, format="#,###.##"), "$ 100,000.00") + + frappe.db.set_default("currency", None) From e0e1c15d760e71c78ac2a415a91f69a491a7d4c4 Mon Sep 17 00:00:00 2001 From: Kenneth Sequeira Date: Tue, 20 Jul 2021 20:10:15 +0530 Subject: [PATCH 14/37] fix: remove redundant code --- frappe/tests/test_formatter.py | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/frappe/tests/test_formatter.py b/frappe/tests/test_formatter.py index cd7b8add9d..5257e1c717 100644 --- a/frappe/tests/test_formatter.py +++ b/frappe/tests/test_formatter.py @@ -22,29 +22,4 @@ class TestFormatter(unittest.TestCase): doc.currency = 'USD' self.assertEqual(format(100, df, doc), "$ 100.00") - frappe.db.set_default("currency", None) - - def test_custom_currency_formatting(self): - df = frappe._dict({ - 'fieldname': 'amount', - 'fieldtype': 'Currency', - 'options': 'currency' - }) - - doc = frappe._dict({ - 'amount': 5 - }) - frappe.db.set_default("currency", 'INR') - - # if currency field is not passed then default currency should be used. - print("doc.currency") - print(doc.currency) - print("frappe.db.get_default('currency')") - print(frappe.db.get_default("currency")) - - self.assertEqual(format(100000, df, doc, format="#,###.##"), '₹ 100,000.00') - - doc.currency = 'USD' - self.assertEqual(format(100000, df, doc, format="#,###.##"), "$ 100,000.00") - - frappe.db.set_default("currency", None) + frappe.db.set_default("currency", None) \ No newline at end of file From e7e8fcd6221dc662feb7b5421ef40f7eb7b9414d Mon Sep 17 00:00:00 2001 From: Kenneth Sequeira Date: Tue, 20 Jul 2021 20:32:24 +0530 Subject: [PATCH 15/37] fix: old currency test --- frappe/tests/test_currency_formatter.py | 4 ---- frappe/tests/test_formatter.py | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/frappe/tests/test_currency_formatter.py b/frappe/tests/test_currency_formatter.py index 75cb42dc49..c85f2d3c40 100644 --- a/frappe/tests/test_currency_formatter.py +++ b/frappe/tests/test_currency_formatter.py @@ -17,10 +17,6 @@ class TestFormatter(unittest.TestCase): frappe.db.set_default("currency", 'INR') # if currency field is not passed then default currency should be used. - print("doc.currency") - print(doc.currency) - print("frappe.db.get_default('currency')") - print(frappe.db.get_default("currency")) self.assertEqual(format(100000, df, doc, format="#,###.##"), '₹ 100,000.00') diff --git a/frappe/tests/test_formatter.py b/frappe/tests/test_formatter.py index 5257e1c717..701e81bb9a 100644 --- a/frappe/tests/test_formatter.py +++ b/frappe/tests/test_formatter.py @@ -20,6 +20,8 @@ class TestFormatter(unittest.TestCase): self.assertEqual(format(100, df, doc), '₹ 100.00') doc.currency = 'USD' + print('doc.currency') + print(doc.currency) self.assertEqual(format(100, df, doc), "$ 100.00") frappe.db.set_default("currency", None) \ No newline at end of file From 48d1d11656a61c737427dc7d488d5ce639b9ed15 Mon Sep 17 00:00:00 2001 From: Kenneth Sequeira Date: Tue, 20 Jul 2021 21:06:27 +0530 Subject: [PATCH 16/37] fix: modified original test --- frappe/tests/test_currency_formatter.py | 26 ------------------------- frappe/tests/test_formatter.py | 6 ++---- 2 files changed, 2 insertions(+), 30 deletions(-) delete mode 100644 frappe/tests/test_currency_formatter.py diff --git a/frappe/tests/test_currency_formatter.py b/frappe/tests/test_currency_formatter.py deleted file mode 100644 index c85f2d3c40..0000000000 --- a/frappe/tests/test_currency_formatter.py +++ /dev/null @@ -1,26 +0,0 @@ -# -*- coding: utf-8 -*- -import frappe -from frappe import format -import unittest - -class TestFormatter(unittest.TestCase): - def test_custom_currency_formatting(self): - df = frappe._dict({ - 'fieldname': 'amount', - 'fieldtype': 'Currency', - 'options': 'currency' - }) - - doc = frappe._dict({ - 'amount': 5 - }) - frappe.db.set_default("currency", 'INR') - - # if currency field is not passed then default currency should be used. - - self.assertEqual(format(100000, df, doc, format="#,###.##"), '₹ 100,000.00') - - doc.currency = 'USD' - self.assertEqual(format(100000, df, doc, format="#,###.##"), "$ 100,000.00") - - frappe.db.set_default("currency", None) diff --git a/frappe/tests/test_formatter.py b/frappe/tests/test_formatter.py index 701e81bb9a..5454c2b1cd 100644 --- a/frappe/tests/test_formatter.py +++ b/frappe/tests/test_formatter.py @@ -17,11 +17,9 @@ class TestFormatter(unittest.TestCase): frappe.db.set_default("currency", 'INR') # if currency field is not passed then default currency should be used. - self.assertEqual(format(100, df, doc), '₹ 100.00') + self.assertEqual(format(100000, df, doc, format="#,###.##"), '₹ 100,000.00') doc.currency = 'USD' - print('doc.currency') - print(doc.currency) - self.assertEqual(format(100, df, doc), "$ 100.00") + self.assertEqual(format(100000, df, doc, format="#,###.##"), "$ 100,000.00") frappe.db.set_default("currency", None) \ No newline at end of file From d014084ae5f3b2d97a4ae9c3ff7f1f41f9bd7732 Mon Sep 17 00:00:00 2001 From: shariquerik Date: Mon, 2 Aug 2021 20:23:44 +0530 Subject: [PATCH 17/37] fix: moved datetime logic to datetime.js --- frappe/public/js/frappe/form/controls/base_control.js | 4 +--- frappe/public/js/frappe/form/controls/datetime.js | 4 ++++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frappe/public/js/frappe/form/controls/base_control.js b/frappe/public/js/frappe/form/controls/base_control.js index ee40bbe43d..7977458ad7 100644 --- a/frappe/public/js/frappe/form/controls/base_control.js +++ b/frappe/public/js/frappe/form/controls/base_control.js @@ -162,9 +162,7 @@ frappe.ui.form.Control = class BaseControl { let force_value_set = (this.doc && this.doc.__run_link_triggers); let model_value = this.get_model_value(); - if (this.df && this.df.fieldtype == 'Datetime') { - model_value = frappe.datetime.get_datetime_as_string(model_value); - } + model_value = this.parse_model_value && this.parse_model_value(model_value); let is_value_same = (model_value === value); diff --git a/frappe/public/js/frappe/form/controls/datetime.js b/frappe/public/js/frappe/form/controls/datetime.js index 341a933066..7a3cef2304 100644 --- a/frappe/public/js/frappe/form/controls/datetime.js +++ b/frappe/public/js/frappe/form/controls/datetime.js @@ -36,4 +36,8 @@ frappe.ui.form.ControlDatetime = class ControlDatetime extends frappe.ui.form.Co $tp.$secondsText.prev().css('display', 'none'); } } + + parse_model_value(value) { + return frappe.datetime.get_datetime_as_string(value); + } }; From ed99915a7909e0cb53d910409531fbc13a9a1ce7 Mon Sep 17 00:00:00 2001 From: shariquerik Date: Tue, 10 Aug 2021 11:20:23 +0530 Subject: [PATCH 18/37] refactor: Refactored code --- frappe/public/js/frappe/form/controls/base_control.js | 6 +----- frappe/public/js/frappe/form/controls/datetime.js | 3 ++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/frappe/public/js/frappe/form/controls/base_control.js b/frappe/public/js/frappe/form/controls/base_control.js index 7977458ad7..d6c268a28a 100644 --- a/frappe/public/js/frappe/form/controls/base_control.js +++ b/frappe/public/js/frappe/form/controls/base_control.js @@ -160,11 +160,7 @@ frappe.ui.form.Control = class BaseControl { validate_and_set_in_model(value, e) { var me = this; let force_value_set = (this.doc && this.doc.__run_link_triggers); - let model_value = this.get_model_value(); - - model_value = this.parse_model_value && this.parse_model_value(model_value); - - let is_value_same = (model_value === value); + let is_value_same = (this.get_model_value() === value); if (this.inside_change_event || (!force_value_set && is_value_same)) { return Promise.resolve(); diff --git a/frappe/public/js/frappe/form/controls/datetime.js b/frappe/public/js/frappe/form/controls/datetime.js index 7a3cef2304..3fb00a6f26 100644 --- a/frappe/public/js/frappe/form/controls/datetime.js +++ b/frappe/public/js/frappe/form/controls/datetime.js @@ -37,7 +37,8 @@ frappe.ui.form.ControlDatetime = class ControlDatetime extends frappe.ui.form.Co } } - parse_model_value(value) { + get_model_value() { + let value = super.get_model_value() return frappe.datetime.get_datetime_as_string(value); } }; From 9da6fcadc8b1062afd14d4c6943a8f1a2d07e7eb Mon Sep 17 00:00:00 2001 From: shariquerik Date: Tue, 10 Aug 2021 11:31:16 +0530 Subject: [PATCH 19/37] fix: sider fix --- frappe/public/js/frappe/form/controls/datetime.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/form/controls/datetime.js b/frappe/public/js/frappe/form/controls/datetime.js index 3fb00a6f26..f7a2798a99 100644 --- a/frappe/public/js/frappe/form/controls/datetime.js +++ b/frappe/public/js/frappe/form/controls/datetime.js @@ -38,7 +38,7 @@ frappe.ui.form.ControlDatetime = class ControlDatetime extends frappe.ui.form.Co } get_model_value() { - let value = super.get_model_value() + let value = super.get_model_value(); return frappe.datetime.get_datetime_as_string(value); } }; From 3fbacb97f42e06da35ea8747e360566f3a73c388 Mon Sep 17 00:00:00 2001 From: Komal-Saraf0609 Date: Tue, 10 Aug 2021 18:53:20 +0530 Subject: [PATCH 20/37] test: Added test cases for folder navigation and checking if the nested folder contains the added file --- cypress/integration/folder_navigation.js | 79 ++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 cypress/integration/folder_navigation.js diff --git a/cypress/integration/folder_navigation.js b/cypress/integration/folder_navigation.js new file mode 100644 index 0000000000..4a389101b5 --- /dev/null +++ b/cypress/integration/folder_navigation.js @@ -0,0 +1,79 @@ +context('Folder Navigation', () => { + before(() => { + cy.visit('/login'); + cy.login(); + cy.visit('/app/file'); + }); + + it('Adding Folders', () => { + //Adding filter to go into the home folder + cy.get('.filter-selector > .btn').click(); + cy.get('.filter-action-buttons > div > .btn-secondary').contains('Clear Filters').click(); + cy.get('.filter-action-buttons > .text-muted').click(); + cy.get('.fieldname-select-area > .awesomplete > .form-control').type('Fol{enter}'); + cy.get('.filter-field > .form-group > .link-field > .awesomplete > .input-with-feedback').type('Home{enter}'); + cy.get('.filter-action-buttons > div > .btn-primary').click(); + + //Adding folder (Test Folder) + cy.get('.menu-btn-group > .btn').click(); + cy.get('.menu-btn-group > .dropdown-menu > .user-action > .grey-link').eq(2).click(); + cy.get('form > .frappe-control > .form-group > .control-input-wrapper > .control-input > .input-with-feedback').type('Test Folder'); + cy.get('.modal-footer > .standard-actions > .btn-primary').click(); + }); + + it('Navigating the nested folders, checking if the URL formed is correct, checking if the added content in the child folder is correct', () => { + //Navigating inside the Attachments folder + cy.get('[title="Attachments"] > span').click(); + + //To check if the URL formed after visiting the attachments folder is correct + cy.location('pathname').should('eq', '/app/file/view/home/Attachments'); + cy.visit('/app/file/view/home/Attachments'); + + //Adding folder inside the attachments folder + cy.get('.menu-btn-group > .btn').click(); + cy.get('.menu-btn-group > .dropdown-menu > .user-action > .grey-link').eq(2).click(); + cy.get('form > .frappe-control > .form-group > .control-input-wrapper > .control-input > .input-with-feedback').type('Test Folder'); + cy.get('.modal-footer > .standard-actions > .btn-primary').click(); + + //Navigating inside the added folder in the Attachments folder + cy.get('[title="Test Folder"] > span').click(); + + //To check if the URL is correct after visiting the Test Folder + cy.location('pathname').should('eq', '/app/file/view/home/Attachments/Test%20Folder'); + cy.visit('/app/file/view/home/Attachments/Test%20Folder'); + + //Adding a file inside the Test Folder + cy.get('.primary-action').contains('Add File').eq(0).click({force : true}); + cy.get('.mt-2 > .btn > .mt-1').eq(2).click(); + cy.get('.input-group > .form-control').type('https://wallpaperplay.com/walls/full/8/2/b/72402.jpg'); + cy.get('.btn-primary').contains('Upload').click(); + + //To check if the added file is present in the Test Folder + cy.get('span.level-item > span').should('contain','Test Folder'); + cy.get('.list-row-container').eq(0).should('contain.text','72402.jpg'); + cy.get('.list-row-checkbox').eq(0).click(); + + //Deleting the added file from the Test folder + cy.get('.actions-btn-group > .btn').click(); + cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); + cy.wait(700); + cy.click_modal_primary_button('Yes', {force : true, delay: 700}); + cy.wait(700); + + //Deleting the Test Folder + cy.visit('/app/file/view/home/Attachments'); + cy.get('.list-row-checkbox').eq(0).click(); + cy.get('.actions-btn-group > .btn').click(); + cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); + cy.click_modal_primary_button('Yes'); + }); + + it('Deleting Test Folder from the home', () => { + //Deleting the Test Folder added in the home directory + cy.visit('/app/file/view/home'); + cy.get('.list-row-container > .list-row > .level-left > .list-subject > .list-row-checkbox').eq(0).click({force : true, delay : 500}); + cy.get('.actions-btn-group > .btn').click(); + cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); + cy.click_modal_primary_button('Yes', {force : true}); + }); +}); \ No newline at end of file From 166574b1d065ac0c0461a671d7fe837a9d35b7ce Mon Sep 17 00:00:00 2001 From: Komal-Saraf0609 Date: Tue, 10 Aug 2021 19:10:27 +0530 Subject: [PATCH 21/37] test: Fixed sider issues --- cypress/integration/folder_navigation.js | 122 +++++++++++------------ 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/cypress/integration/folder_navigation.js b/cypress/integration/folder_navigation.js index 4a389101b5..d4fe569828 100644 --- a/cypress/integration/folder_navigation.js +++ b/cypress/integration/folder_navigation.js @@ -5,75 +5,75 @@ context('Folder Navigation', () => { cy.visit('/app/file'); }); - it('Adding Folders', () => { - //Adding filter to go into the home folder - cy.get('.filter-selector > .btn').click(); - cy.get('.filter-action-buttons > div > .btn-secondary').contains('Clear Filters').click(); - cy.get('.filter-action-buttons > .text-muted').click(); - cy.get('.fieldname-select-area > .awesomplete > .form-control').type('Fol{enter}'); - cy.get('.filter-field > .form-group > .link-field > .awesomplete > .input-with-feedback').type('Home{enter}'); - cy.get('.filter-action-buttons > div > .btn-primary').click(); - - //Adding folder (Test Folder) - cy.get('.menu-btn-group > .btn').click(); - cy.get('.menu-btn-group > .dropdown-menu > .user-action > .grey-link').eq(2).click(); - cy.get('form > .frappe-control > .form-group > .control-input-wrapper > .control-input > .input-with-feedback').type('Test Folder'); - cy.get('.modal-footer > .standard-actions > .btn-primary').click(); - }); + it('Adding Folders', () => { + //Adding filter to go into the home folder + cy.get('.filter-selector > .btn').click(); + cy.get('.filter-action-buttons > div > .btn-secondary').contains('Clear Filters').click(); + cy.get('.filter-action-buttons > .text-muted').click(); + cy.get('.fieldname-select-area > .awesomplete > .form-control').type('Fol{enter}'); + cy.get('.filter-field > .form-group > .link-field > .awesomplete > .input-with-feedback').type('Home{enter}'); + cy.get('.filter-action-buttons > div > .btn-primary').click(); - it('Navigating the nested folders, checking if the URL formed is correct, checking if the added content in the child folder is correct', () => { - //Navigating inside the Attachments folder - cy.get('[title="Attachments"] > span').click(); + //Adding folder (Test Folder) + cy.get('.menu-btn-group > .btn').click(); + cy.get('.menu-btn-group > .dropdown-menu > .user-action > .grey-link').eq(2).click(); + cy.get('form > .frappe-control > .form-group > .control-input-wrapper > .control-input > .input-with-feedback').type('Test Folder'); + cy.get('.modal-footer > .standard-actions > .btn-primary').click(); + }); - //To check if the URL formed after visiting the attachments folder is correct - cy.location('pathname').should('eq', '/app/file/view/home/Attachments'); - cy.visit('/app/file/view/home/Attachments'); + it('Navigating the nested folders, checking if the URL formed is correct, checking if the added content in the child folder is correct', () => { + //Navigating inside the Attachments folder + cy.get('[title="Attachments"] > span').click(); - //Adding folder inside the attachments folder - cy.get('.menu-btn-group > .btn').click(); - cy.get('.menu-btn-group > .dropdown-menu > .user-action > .grey-link').eq(2).click(); - cy.get('form > .frappe-control > .form-group > .control-input-wrapper > .control-input > .input-with-feedback').type('Test Folder'); - cy.get('.modal-footer > .standard-actions > .btn-primary').click(); + //To check if the URL formed after visiting the attachments folder is correct + cy.location('pathname').should('eq', '/app/file/view/home/Attachments'); + cy.visit('/app/file/view/home/Attachments'); - //Navigating inside the added folder in the Attachments folder - cy.get('[title="Test Folder"] > span').click(); + //Adding folder inside the attachments folder + cy.get('.menu-btn-group > .btn').click(); + cy.get('.menu-btn-group > .dropdown-menu > .user-action > .grey-link').eq(2).click(); + cy.get('form > .frappe-control > .form-group > .control-input-wrapper > .control-input > .input-with-feedback').type('Test Folder'); + cy.get('.modal-footer > .standard-actions > .btn-primary').click(); - //To check if the URL is correct after visiting the Test Folder - cy.location('pathname').should('eq', '/app/file/view/home/Attachments/Test%20Folder'); - cy.visit('/app/file/view/home/Attachments/Test%20Folder'); + //Navigating inside the added folder in the Attachments folder + cy.get('[title="Test Folder"] > span').click(); - //Adding a file inside the Test Folder - cy.get('.primary-action').contains('Add File').eq(0).click({force : true}); - cy.get('.mt-2 > .btn > .mt-1').eq(2).click(); - cy.get('.input-group > .form-control').type('https://wallpaperplay.com/walls/full/8/2/b/72402.jpg'); - cy.get('.btn-primary').contains('Upload').click(); + //To check if the URL is correct after visiting the Test Folder + cy.location('pathname').should('eq', '/app/file/view/home/Attachments/Test%20Folder'); + cy.visit('/app/file/view/home/Attachments/Test%20Folder'); - //To check if the added file is present in the Test Folder - cy.get('span.level-item > span').should('contain','Test Folder'); - cy.get('.list-row-container').eq(0).should('contain.text','72402.jpg'); - cy.get('.list-row-checkbox').eq(0).click(); + //Adding a file inside the Test Folder + cy.get('.primary-action').contains('Add File').eq(0).click({force: true}); + cy.get('.mt-2 > .btn > .mt-1').eq(2).click(); + cy.get('.input-group > .form-control').type('https://wallpaperplay.com/walls/full/8/2/b/72402.jpg'); + cy.get('.btn-primary').contains('Upload').click(); - //Deleting the added file from the Test folder - cy.get('.actions-btn-group > .btn').click(); - cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); - cy.wait(700); - cy.click_modal_primary_button('Yes', {force : true, delay: 700}); - cy.wait(700); + //To check if the added file is present in the Test Folder + cy.get('span.level-item > span').should('contain', 'Test Folder'); + cy.get('.list-row-container').eq(0).should('contain.text', '72402.jpg'); + cy.get('.list-row-checkbox').eq(0).click(); - //Deleting the Test Folder - cy.visit('/app/file/view/home/Attachments'); - cy.get('.list-row-checkbox').eq(0).click(); - cy.get('.actions-btn-group > .btn').click(); - cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); - cy.click_modal_primary_button('Yes'); - }); + //Deleting the added file from the Test folder + cy.get('.actions-btn-group > .btn').click(); + cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); + cy.wait(700); + cy.click_modal_primary_button('Yes', {force: true, delay: 700}); + cy.wait(700); - it('Deleting Test Folder from the home', () => { - //Deleting the Test Folder added in the home directory - cy.visit('/app/file/view/home'); - cy.get('.list-row-container > .list-row > .level-left > .list-subject > .list-row-checkbox').eq(0).click({force : true, delay : 500}); - cy.get('.actions-btn-group > .btn').click(); - cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); - cy.click_modal_primary_button('Yes', {force : true}); - }); + //Deleting the Test Folder + cy.visit('/app/file/view/home/Attachments'); + cy.get('.list-row-checkbox').eq(0).click(); + cy.get('.actions-btn-group > .btn').click(); + cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); + cy.click_modal_primary_button('Yes'); + }); + + it('Deleting Test Folder from the home', () => { + //Deleting the Test Folder added in the home directory + cy.visit('/app/file/view/home'); + cy.get('.list-row-container > .list-row > .level-left > .list-subject > .list-row-checkbox').eq(0).click({force: true, delay: 500}); + cy.get('.actions-btn-group > .btn').click(); + cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); + cy.click_modal_primary_button('Yes', {force: true}); + }); }); \ No newline at end of file From 5640366757860da10cf7b3af94307c89bfb0c5ab Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 18 Aug 2021 19:59:56 +0530 Subject: [PATCH 22/37] fix: Handle null values rows for XLSX format --- frappe/email/doctype/auto_email_report/auto_email_report.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frappe/email/doctype/auto_email_report/auto_email_report.py b/frappe/email/doctype/auto_email_report/auto_email_report.py index f30279e308..90b869997e 100644 --- a/frappe/email/doctype/auto_email_report/auto_email_report.py +++ b/frappe/email/doctype/auto_email_report/auto_email_report.py @@ -133,8 +133,10 @@ class AutoEmailReport(Document): new_row = [] out.append(new_row) for df in columns: - if df.fieldname not in row: continue - new_row.append(frappe.format(row[df.fieldname], df, row)) + if row.get(df.fieldname): + new_row.append(frappe.format(row[df.fieldname], df, row)) + else: + new_row.append('') return out From 2fcd3b556da4427cf3286e438a650cf6d87c6cab Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Wed, 18 Aug 2021 22:53:35 +0530 Subject: [PATCH 23/37] fix: Use query report build_xlsx_data function for XLSX and CSV format --- frappe/desk/query_report.py | 4 +-- .../auto_email_report/auto_email_report.py | 31 ++++++++----------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/frappe/desk/query_report.py b/frappe/desk/query_report.py index b42c9c89a0..610eaf466a 100644 --- a/frappe/desk/query_report.py +++ b/frappe/desk/query_report.py @@ -391,7 +391,7 @@ def handle_duration_fieldtype_values(result, columns): return result -def build_xlsx_data(columns, data, visible_idx, include_indentation): +def build_xlsx_data(columns, data, visible_idx, include_indentation, ignore_visible_idx=False): result = [[]] column_widths = [] @@ -407,7 +407,7 @@ def build_xlsx_data(columns, data, visible_idx, include_indentation): # build table from result for row_idx, row in enumerate(data.result): # only pick up rows that are visible in the report - if row_idx in visible_idx: + if ignore_visible_idx or row_idx in visible_idx: row_data = [] if isinstance(row, dict): for col_idx, column in enumerate(data.columns): diff --git a/frappe/email/doctype/auto_email_report/auto_email_report.py b/frappe/email/doctype/auto_email_report/auto_email_report.py index 90b869997e..ccfff594b7 100644 --- a/frappe/email/doctype/auto_email_report/auto_email_report.py +++ b/frappe/email/doctype/auto_email_report/auto_email_report.py @@ -13,6 +13,7 @@ from frappe.utils import (format_time, get_link_to_form, get_url_to_report, from frappe.model.naming import append_number_if_name_exists from frappe.utils.csvutils import to_csv from frappe.utils.xlsxutils import make_xlsx +from frappe.desk.query_report import build_xlsx_data max_reports_per_user = frappe.local.conf.max_reports_per_user or 3 @@ -99,13 +100,21 @@ class AutoEmailReport(Document): return self.get_html_table(columns, data) elif self.format == 'XLSX': - spreadsheet_data = self.get_spreadsheet_data(columns, data) - xlsx_file = make_xlsx(spreadsheet_data, "Auto Email Report") + report_data = frappe._dict() + report_data['columns'] = columns + report_data['result'] = data + + xlsx_data, column_widths = build_xlsx_data(columns, report_data, [], 1, ignore_visible_idx=True) + xlsx_file = make_xlsx(xlsx_data, "Auto Email Report", column_widths=column_widths) return xlsx_file.getvalue() elif self.format == 'CSV': - spreadsheet_data = self.get_spreadsheet_data(columns, data) - return to_csv(spreadsheet_data) + report_data = frappe._dict() + report_data['columns'] = columns + report_data['result'] = data + + xlsx_data, column_widths = build_xlsx_data(columns, report_data, [], 1, ignore_visible_idx=True) + return to_csv(xlsx_data) else: frappe.throw(_('Invalid Output Format')) @@ -126,20 +135,6 @@ class AutoEmailReport(Document): 'edit_report_settings': get_link_to_form('Auto Email Report', self.name) }) - @staticmethod - def get_spreadsheet_data(columns, data): - out = [[_(df.label) for df in columns], ] - for row in data: - new_row = [] - out.append(new_row) - for df in columns: - if row.get(df.fieldname): - new_row.append(frappe.format(row[df.fieldname], df, row)) - else: - new_row.append('') - - return out - def get_file_name(self): return "{0}.{1}".format(self.report.replace(" ", "-").replace("/", "-"), self.format.lower()) From b7e42fdc910592e3b0a55500914420eb6668c4e8 Mon Sep 17 00:00:00 2001 From: Komal-Saraf0609 Date: Tue, 10 Aug 2021 18:53:20 +0530 Subject: [PATCH 24/37] test: Added test cases for folder navigation and checking if the nested folder contains the added file --- cypress/integration/folder_navigation.js | 79 ++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 cypress/integration/folder_navigation.js diff --git a/cypress/integration/folder_navigation.js b/cypress/integration/folder_navigation.js new file mode 100644 index 0000000000..4a389101b5 --- /dev/null +++ b/cypress/integration/folder_navigation.js @@ -0,0 +1,79 @@ +context('Folder Navigation', () => { + before(() => { + cy.visit('/login'); + cy.login(); + cy.visit('/app/file'); + }); + + it('Adding Folders', () => { + //Adding filter to go into the home folder + cy.get('.filter-selector > .btn').click(); + cy.get('.filter-action-buttons > div > .btn-secondary').contains('Clear Filters').click(); + cy.get('.filter-action-buttons > .text-muted').click(); + cy.get('.fieldname-select-area > .awesomplete > .form-control').type('Fol{enter}'); + cy.get('.filter-field > .form-group > .link-field > .awesomplete > .input-with-feedback').type('Home{enter}'); + cy.get('.filter-action-buttons > div > .btn-primary').click(); + + //Adding folder (Test Folder) + cy.get('.menu-btn-group > .btn').click(); + cy.get('.menu-btn-group > .dropdown-menu > .user-action > .grey-link').eq(2).click(); + cy.get('form > .frappe-control > .form-group > .control-input-wrapper > .control-input > .input-with-feedback').type('Test Folder'); + cy.get('.modal-footer > .standard-actions > .btn-primary').click(); + }); + + it('Navigating the nested folders, checking if the URL formed is correct, checking if the added content in the child folder is correct', () => { + //Navigating inside the Attachments folder + cy.get('[title="Attachments"] > span').click(); + + //To check if the URL formed after visiting the attachments folder is correct + cy.location('pathname').should('eq', '/app/file/view/home/Attachments'); + cy.visit('/app/file/view/home/Attachments'); + + //Adding folder inside the attachments folder + cy.get('.menu-btn-group > .btn').click(); + cy.get('.menu-btn-group > .dropdown-menu > .user-action > .grey-link').eq(2).click(); + cy.get('form > .frappe-control > .form-group > .control-input-wrapper > .control-input > .input-with-feedback').type('Test Folder'); + cy.get('.modal-footer > .standard-actions > .btn-primary').click(); + + //Navigating inside the added folder in the Attachments folder + cy.get('[title="Test Folder"] > span').click(); + + //To check if the URL is correct after visiting the Test Folder + cy.location('pathname').should('eq', '/app/file/view/home/Attachments/Test%20Folder'); + cy.visit('/app/file/view/home/Attachments/Test%20Folder'); + + //Adding a file inside the Test Folder + cy.get('.primary-action').contains('Add File').eq(0).click({force : true}); + cy.get('.mt-2 > .btn > .mt-1').eq(2).click(); + cy.get('.input-group > .form-control').type('https://wallpaperplay.com/walls/full/8/2/b/72402.jpg'); + cy.get('.btn-primary').contains('Upload').click(); + + //To check if the added file is present in the Test Folder + cy.get('span.level-item > span').should('contain','Test Folder'); + cy.get('.list-row-container').eq(0).should('contain.text','72402.jpg'); + cy.get('.list-row-checkbox').eq(0).click(); + + //Deleting the added file from the Test folder + cy.get('.actions-btn-group > .btn').click(); + cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); + cy.wait(700); + cy.click_modal_primary_button('Yes', {force : true, delay: 700}); + cy.wait(700); + + //Deleting the Test Folder + cy.visit('/app/file/view/home/Attachments'); + cy.get('.list-row-checkbox').eq(0).click(); + cy.get('.actions-btn-group > .btn').click(); + cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); + cy.click_modal_primary_button('Yes'); + }); + + it('Deleting Test Folder from the home', () => { + //Deleting the Test Folder added in the home directory + cy.visit('/app/file/view/home'); + cy.get('.list-row-container > .list-row > .level-left > .list-subject > .list-row-checkbox').eq(0).click({force : true, delay : 500}); + cy.get('.actions-btn-group > .btn').click(); + cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); + cy.click_modal_primary_button('Yes', {force : true}); + }); +}); \ No newline at end of file From a881e85cb36e634bb3af0301736d87273089eb2c Mon Sep 17 00:00:00 2001 From: Komal-Saraf0609 Date: Tue, 10 Aug 2021 19:10:27 +0530 Subject: [PATCH 25/37] test: Fixed sider issues --- cypress/integration/folder_navigation.js | 122 +++++++++++------------ 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/cypress/integration/folder_navigation.js b/cypress/integration/folder_navigation.js index 4a389101b5..d4fe569828 100644 --- a/cypress/integration/folder_navigation.js +++ b/cypress/integration/folder_navigation.js @@ -5,75 +5,75 @@ context('Folder Navigation', () => { cy.visit('/app/file'); }); - it('Adding Folders', () => { - //Adding filter to go into the home folder - cy.get('.filter-selector > .btn').click(); - cy.get('.filter-action-buttons > div > .btn-secondary').contains('Clear Filters').click(); - cy.get('.filter-action-buttons > .text-muted').click(); - cy.get('.fieldname-select-area > .awesomplete > .form-control').type('Fol{enter}'); - cy.get('.filter-field > .form-group > .link-field > .awesomplete > .input-with-feedback').type('Home{enter}'); - cy.get('.filter-action-buttons > div > .btn-primary').click(); - - //Adding folder (Test Folder) - cy.get('.menu-btn-group > .btn').click(); - cy.get('.menu-btn-group > .dropdown-menu > .user-action > .grey-link').eq(2).click(); - cy.get('form > .frappe-control > .form-group > .control-input-wrapper > .control-input > .input-with-feedback').type('Test Folder'); - cy.get('.modal-footer > .standard-actions > .btn-primary').click(); - }); + it('Adding Folders', () => { + //Adding filter to go into the home folder + cy.get('.filter-selector > .btn').click(); + cy.get('.filter-action-buttons > div > .btn-secondary').contains('Clear Filters').click(); + cy.get('.filter-action-buttons > .text-muted').click(); + cy.get('.fieldname-select-area > .awesomplete > .form-control').type('Fol{enter}'); + cy.get('.filter-field > .form-group > .link-field > .awesomplete > .input-with-feedback').type('Home{enter}'); + cy.get('.filter-action-buttons > div > .btn-primary').click(); - it('Navigating the nested folders, checking if the URL formed is correct, checking if the added content in the child folder is correct', () => { - //Navigating inside the Attachments folder - cy.get('[title="Attachments"] > span').click(); + //Adding folder (Test Folder) + cy.get('.menu-btn-group > .btn').click(); + cy.get('.menu-btn-group > .dropdown-menu > .user-action > .grey-link').eq(2).click(); + cy.get('form > .frappe-control > .form-group > .control-input-wrapper > .control-input > .input-with-feedback').type('Test Folder'); + cy.get('.modal-footer > .standard-actions > .btn-primary').click(); + }); - //To check if the URL formed after visiting the attachments folder is correct - cy.location('pathname').should('eq', '/app/file/view/home/Attachments'); - cy.visit('/app/file/view/home/Attachments'); + it('Navigating the nested folders, checking if the URL formed is correct, checking if the added content in the child folder is correct', () => { + //Navigating inside the Attachments folder + cy.get('[title="Attachments"] > span').click(); - //Adding folder inside the attachments folder - cy.get('.menu-btn-group > .btn').click(); - cy.get('.menu-btn-group > .dropdown-menu > .user-action > .grey-link').eq(2).click(); - cy.get('form > .frappe-control > .form-group > .control-input-wrapper > .control-input > .input-with-feedback').type('Test Folder'); - cy.get('.modal-footer > .standard-actions > .btn-primary').click(); + //To check if the URL formed after visiting the attachments folder is correct + cy.location('pathname').should('eq', '/app/file/view/home/Attachments'); + cy.visit('/app/file/view/home/Attachments'); - //Navigating inside the added folder in the Attachments folder - cy.get('[title="Test Folder"] > span').click(); + //Adding folder inside the attachments folder + cy.get('.menu-btn-group > .btn').click(); + cy.get('.menu-btn-group > .dropdown-menu > .user-action > .grey-link').eq(2).click(); + cy.get('form > .frappe-control > .form-group > .control-input-wrapper > .control-input > .input-with-feedback').type('Test Folder'); + cy.get('.modal-footer > .standard-actions > .btn-primary').click(); - //To check if the URL is correct after visiting the Test Folder - cy.location('pathname').should('eq', '/app/file/view/home/Attachments/Test%20Folder'); - cy.visit('/app/file/view/home/Attachments/Test%20Folder'); + //Navigating inside the added folder in the Attachments folder + cy.get('[title="Test Folder"] > span').click(); - //Adding a file inside the Test Folder - cy.get('.primary-action').contains('Add File').eq(0).click({force : true}); - cy.get('.mt-2 > .btn > .mt-1').eq(2).click(); - cy.get('.input-group > .form-control').type('https://wallpaperplay.com/walls/full/8/2/b/72402.jpg'); - cy.get('.btn-primary').contains('Upload').click(); + //To check if the URL is correct after visiting the Test Folder + cy.location('pathname').should('eq', '/app/file/view/home/Attachments/Test%20Folder'); + cy.visit('/app/file/view/home/Attachments/Test%20Folder'); - //To check if the added file is present in the Test Folder - cy.get('span.level-item > span').should('contain','Test Folder'); - cy.get('.list-row-container').eq(0).should('contain.text','72402.jpg'); - cy.get('.list-row-checkbox').eq(0).click(); + //Adding a file inside the Test Folder + cy.get('.primary-action').contains('Add File').eq(0).click({force: true}); + cy.get('.mt-2 > .btn > .mt-1').eq(2).click(); + cy.get('.input-group > .form-control').type('https://wallpaperplay.com/walls/full/8/2/b/72402.jpg'); + cy.get('.btn-primary').contains('Upload').click(); - //Deleting the added file from the Test folder - cy.get('.actions-btn-group > .btn').click(); - cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); - cy.wait(700); - cy.click_modal_primary_button('Yes', {force : true, delay: 700}); - cy.wait(700); + //To check if the added file is present in the Test Folder + cy.get('span.level-item > span').should('contain', 'Test Folder'); + cy.get('.list-row-container').eq(0).should('contain.text', '72402.jpg'); + cy.get('.list-row-checkbox').eq(0).click(); - //Deleting the Test Folder - cy.visit('/app/file/view/home/Attachments'); - cy.get('.list-row-checkbox').eq(0).click(); - cy.get('.actions-btn-group > .btn').click(); - cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); - cy.click_modal_primary_button('Yes'); - }); + //Deleting the added file from the Test folder + cy.get('.actions-btn-group > .btn').click(); + cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); + cy.wait(700); + cy.click_modal_primary_button('Yes', {force: true, delay: 700}); + cy.wait(700); - it('Deleting Test Folder from the home', () => { - //Deleting the Test Folder added in the home directory - cy.visit('/app/file/view/home'); - cy.get('.list-row-container > .list-row > .level-left > .list-subject > .list-row-checkbox').eq(0).click({force : true, delay : 500}); - cy.get('.actions-btn-group > .btn').click(); - cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); - cy.click_modal_primary_button('Yes', {force : true}); - }); + //Deleting the Test Folder + cy.visit('/app/file/view/home/Attachments'); + cy.get('.list-row-checkbox').eq(0).click(); + cy.get('.actions-btn-group > .btn').click(); + cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); + cy.click_modal_primary_button('Yes'); + }); + + it('Deleting Test Folder from the home', () => { + //Deleting the Test Folder added in the home directory + cy.visit('/app/file/view/home'); + cy.get('.list-row-container > .list-row > .level-left > .list-subject > .list-row-checkbox').eq(0).click({force: true, delay: 500}); + cy.get('.actions-btn-group > .btn').click(); + cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); + cy.click_modal_primary_button('Yes', {force: true}); + }); }); \ No newline at end of file From 9fce3c60943ea003f719ca5a809b399cb13efb96 Mon Sep 17 00:00:00 2001 From: Komal-Saraf0609 Date: Thu, 8 Jul 2021 18:57:34 +0530 Subject: [PATCH 26/37] test: Added test cases for Email testing --- cypress/integration/email_testing.js | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 cypress/integration/email_testing.js diff --git a/cypress/integration/email_testing.js b/cypress/integration/email_testing.js new file mode 100644 index 0000000000..15cc895600 --- /dev/null +++ b/cypress/integration/email_testing.js @@ -0,0 +1,44 @@ +context('Email Feature Test', () => { + before(() => { + cy.visit('/login'); + cy.login(); + cy.visit('/app/todo'); + }); + + it('Saving and Deleting Email Template', () => { + cy.get('.level-item.ellipsis > .ellipsis').click(); + cy.get('.timeline-actions > .btn').click(); + cy.fill_field('recipients','test@example.com','MultiSelect'); + cy.get('.modal.show > .modal-dialog > .modal-content > .modal-body > :nth-child(1) > .form-layout > .form-page > :nth-child(3) > .section-body > .form-column > form > [data-fieldtype="Text Editor"] > .form-group > .control-input-wrapper > .control-input > .ql-container > .ql-editor').type('Test Mail'); + + cy.get('.add-more-attachments > .btn').click(); + cy.get('.mt-2 > .btn > .mt-1').eq(2).click(); + cy.get('.input-group > .form-control').type('https://wallpaperplay.com/walls/full/8/2/b/72402.jpg'); + cy.get('.btn-primary').contains('Upload').click(); + cy.get('.modal-footer > .standard-actions > .btn-primary').contains('Send').click({delay:500}); + cy.get('[data-doctype="Communication"] > .timeline-content').should('contain','Test Mail'); + cy.get('.timeline-content').should('contain','Added 72402.jpg'); + cy.get('[title="Open Communication"] > .icon').click(); + 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 > :nth-child(11) > .grey-link').click(); + cy.get('.modal.show > .modal-dialog > .modal-content > .modal-footer > .standard-actions > .btn-primary').click(); + cy.visit('/app/todo'); + cy.get('.level-item.ellipsis > .ellipsis').click(); + cy.get('.attachment-row > .data-pill > .remove-btn > .icon').click(); + cy.get('.modal-footer > .standard-actions > .btn-primary').contains('Yes').click(); + cy.get('.timeline-content').should('contain','Removed 72402.jpg'); + }); + + it('Discarding Email Template', () => { + cy.visit('/app/todo'); + cy.get('.level-item.ellipsis > .ellipsis').click(); + cy.get('.timeline-actions > .btn').click(); + cy.fill_field('recipients','test@example.com','MultiSelect'); + cy.get('.modal-footer > .standard-actions > .btn-secondary').contains('Discard').click(); + cy.get('.timeline-actions > .btn').click(); + cy.get_field('recipients','MultiSelect').should('have.value',''); + cy.get('.modal.show > .modal-dialog > .modal-content > .modal-header > .modal-actions > .btn-modal-close > .icon').click(); + }); + + +}); From f047a5517daea95a1408061fe9d47786aec94d74 Mon Sep 17 00:00:00 2001 From: Komal-Saraf0609 Date: Thu, 19 Aug 2021 20:24:03 +0530 Subject: [PATCH 27/37] test: corrected the selectors and shorten them (using the newly added API's) --- cypress/integration/folder_navigation.js | 134 +++++++++++------------ 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/cypress/integration/folder_navigation.js b/cypress/integration/folder_navigation.js index d4fe569828..1ff38005ad 100644 --- a/cypress/integration/folder_navigation.js +++ b/cypress/integration/folder_navigation.js @@ -1,79 +1,79 @@ context('Folder Navigation', () => { - before(() => { - cy.visit('/login'); - cy.login(); - cy.visit('/app/file'); - }); - - it('Adding Folders', () => { - //Adding filter to go into the home folder - cy.get('.filter-selector > .btn').click(); - cy.get('.filter-action-buttons > div > .btn-secondary').contains('Clear Filters').click(); - cy.get('.filter-action-buttons > .text-muted').click(); - cy.get('.fieldname-select-area > .awesomplete > .form-control').type('Fol{enter}'); - cy.get('.filter-field > .form-group > .link-field > .awesomplete > .input-with-feedback').type('Home{enter}'); - cy.get('.filter-action-buttons > div > .btn-primary').click(); + before(() => { + cy.visit('/login'); + cy.login(); + cy.visit('/app/file'); + }); - //Adding folder (Test Folder) - cy.get('.menu-btn-group > .btn').click(); - cy.get('.menu-btn-group > .dropdown-menu > .user-action > .grey-link').eq(2).click(); - cy.get('form > .frappe-control > .form-group > .control-input-wrapper > .control-input > .input-with-feedback').type('Test Folder'); - cy.get('.modal-footer > .standard-actions > .btn-primary').click(); - }); + it('Adding Folders', () => { + //Adding filter to go into the home folder + cy.get('.filter-selector > .btn').click(); + cy.findByRole('button', {name: 'Clear Filters'}).click(); + cy.get('.filter-action-buttons > .text-muted').click(); + cy.get('.fieldname-select-area > .awesomplete > .form-control').type('Fol{enter}'); + cy.get('.filter-field > .form-group > .link-field > .awesomplete > .input-with-feedback').type('Home{enter}'); + cy.get('.filter-action-buttons > div > .btn-primary').click(); - it('Navigating the nested folders, checking if the URL formed is correct, checking if the added content in the child folder is correct', () => { - //Navigating inside the Attachments folder - cy.get('[title="Attachments"] > span').click(); + //Adding folder (Test Folder) + cy.get('.menu-btn-group > .btn').click(); + cy.get('.menu-btn-group [data-label="New Folder"]').click(); + cy.get('form > [data-fieldname="value"]').type('Test Folder'); + cy.findByRole('button', {name: 'Create'}).click(); + }); - //To check if the URL formed after visiting the attachments folder is correct - cy.location('pathname').should('eq', '/app/file/view/home/Attachments'); - cy.visit('/app/file/view/home/Attachments'); + it('Navigating the nested folders, checking if the URL formed is correct, checking if the added content in the child folder is correct', () => { + //Navigating inside the Attachments folder + cy.get('[title="Attachments"] > span').click(); - //Adding folder inside the attachments folder - cy.get('.menu-btn-group > .btn').click(); - cy.get('.menu-btn-group > .dropdown-menu > .user-action > .grey-link').eq(2).click(); - cy.get('form > .frappe-control > .form-group > .control-input-wrapper > .control-input > .input-with-feedback').type('Test Folder'); - cy.get('.modal-footer > .standard-actions > .btn-primary').click(); + //To check if the URL formed after visiting the attachments folder is correct + cy.location('pathname').should('eq', '/app/file/view/home/Attachments'); + cy.visit('/app/file/view/home/Attachments'); - //Navigating inside the added folder in the Attachments folder - cy.get('[title="Test Folder"] > span').click(); + //Adding folder inside the attachments folder + cy.get('.menu-btn-group > .btn').click(); + cy.get('.menu-btn-group [data-label="New Folder"]').click(); + cy.get('form > [data-fieldname="value"]').type('Test Folder'); + cy.findByRole('button', {name: 'Create'}).click(); - //To check if the URL is correct after visiting the Test Folder - cy.location('pathname').should('eq', '/app/file/view/home/Attachments/Test%20Folder'); - cy.visit('/app/file/view/home/Attachments/Test%20Folder'); + //Navigating inside the added folder in the Attachments folder + cy.get('[title="Test Folder"] > span').click(); - //Adding a file inside the Test Folder - cy.get('.primary-action').contains('Add File').eq(0).click({force: true}); - cy.get('.mt-2 > .btn > .mt-1').eq(2).click(); - cy.get('.input-group > .form-control').type('https://wallpaperplay.com/walls/full/8/2/b/72402.jpg'); - cy.get('.btn-primary').contains('Upload').click(); + //To check if the URL is correct after visiting the Test Folder + cy.location('pathname').should('eq', '/app/file/view/home/Attachments/Test%20Folder'); + cy.visit('/app/file/view/home/Attachments/Test%20Folder'); - //To check if the added file is present in the Test Folder - cy.get('span.level-item > span').should('contain', 'Test Folder'); - cy.get('.list-row-container').eq(0).should('contain.text', '72402.jpg'); - cy.get('.list-row-checkbox').eq(0).click(); + //Adding a file inside the Test Folder + cy.findByRole('button', {name: 'Add File'}).eq(0).click({force: true}); + cy.get('.mt-2 > .btn > .mt-1').eq(2).click(); + cy.get('.input-group > .form-control').type('https://wallpaperplay.com/walls/full/8/2/b/72402.jpg'); + cy.findByRole('button', {name: 'Upload'}).click(); - //Deleting the added file from the Test folder - cy.get('.actions-btn-group > .btn').click(); - cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); - cy.wait(700); - cy.click_modal_primary_button('Yes', {force: true, delay: 700}); - cy.wait(700); + //To check if the added file is present in the Test Folder + cy.get('span.level-item > span').should('contain', 'Test Folder'); + cy.get('.list-row-container').eq(0).should('contain.text', '72402.jpg'); + cy.get('.list-row-checkbox').eq(0).click(); - //Deleting the Test Folder - cy.visit('/app/file/view/home/Attachments'); - cy.get('.list-row-checkbox').eq(0).click(); - cy.get('.actions-btn-group > .btn').click(); - cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); - cy.click_modal_primary_button('Yes'); - }); + //Deleting the added file from the Test folder + cy.findByRole('button', {name: 'Actions'}).click(); + cy.get('.actions-btn-group [data-label="Delete"]').click(); + cy.wait(700); + cy.findByRole('button', {name: 'Yes'}).click(); + cy.wait(700); - it('Deleting Test Folder from the home', () => { - //Deleting the Test Folder added in the home directory - cy.visit('/app/file/view/home'); - cy.get('.list-row-container > .list-row > .level-left > .list-subject > .list-row-checkbox').eq(0).click({force: true, delay: 500}); - cy.get('.actions-btn-group > .btn').click(); - cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); - cy.click_modal_primary_button('Yes', {force: true}); - }); -}); \ No newline at end of file + //Deleting the Test Folder + cy.visit('/app/file/view/home/Attachments'); + cy.get('.list-row-checkbox').eq(0).click(); + cy.findByRole('button', {name: 'Actions'}).click(); + cy.get('.actions-btn-group [data-label="Delete"]').click(); + cy.findByRole('button', {name: 'Yes'}).click(); + }); + + 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.findByRole('button', {name: 'Actions'}).click(); + cy.get('.actions-btn-group [data-label="Delete"]').click(); + cy.findByRole('button', {name: 'Yes'}).click(); + }); +}); From 8a6b8a5348d48444d8acc278bcfe83c844dbf246 Mon Sep 17 00:00:00 2001 From: Komal-Saraf0609 Date: Thu, 19 Aug 2021 20:41:31 +0530 Subject: [PATCH 28/37] test: corrected selectors and shorten them (using the newly added API's) --- cypress/integration/folder_navigation.js | 81 ------------------------ 1 file changed, 81 deletions(-) diff --git a/cypress/integration/folder_navigation.js b/cypress/integration/folder_navigation.js index 987bddce7c..1ff38005ad 100644 --- a/cypress/integration/folder_navigation.js +++ b/cypress/integration/folder_navigation.js @@ -1,5 +1,4 @@ context('Folder Navigation', () => { -<<<<<<< HEAD before(() => { cy.visit('/login'); cy.login(); @@ -78,83 +77,3 @@ context('Folder Navigation', () => { cy.findByRole('button', {name: 'Yes'}).click(); }); }); -======= - before(() => { - cy.visit('/login'); - cy.login(); - cy.visit('/app/file'); - }); - - it('Adding Folders', () => { - //Adding filter to go into the home folder - cy.get('.filter-selector > .btn').click(); - cy.get('.filter-action-buttons > div > .btn-secondary').contains('Clear Filters').click(); - cy.get('.filter-action-buttons > .text-muted').click(); - cy.get('.fieldname-select-area > .awesomplete > .form-control').type('Fol{enter}'); - cy.get('.filter-field > .form-group > .link-field > .awesomplete > .input-with-feedback').type('Home{enter}'); - cy.get('.filter-action-buttons > div > .btn-primary').click(); - - //Adding folder (Test Folder) - cy.get('.menu-btn-group > .btn').click(); - cy.get('.menu-btn-group > .dropdown-menu > .user-action > .grey-link').eq(2).click(); - cy.get('form > .frappe-control > .form-group > .control-input-wrapper > .control-input > .input-with-feedback').type('Test Folder'); - cy.get('.modal-footer > .standard-actions > .btn-primary').click(); - }); - - it('Navigating the nested folders, checking if the URL formed is correct, checking if the added content in the child folder is correct', () => { - //Navigating inside the Attachments folder - cy.get('[title="Attachments"] > span').click(); - - //To check if the URL formed after visiting the attachments folder is correct - cy.location('pathname').should('eq', '/app/file/view/home/Attachments'); - cy.visit('/app/file/view/home/Attachments'); - - //Adding folder inside the attachments folder - cy.get('.menu-btn-group > .btn').click(); - cy.get('.menu-btn-group > .dropdown-menu > .user-action > .grey-link').eq(2).click(); - cy.get('form > .frappe-control > .form-group > .control-input-wrapper > .control-input > .input-with-feedback').type('Test Folder'); - cy.get('.modal-footer > .standard-actions > .btn-primary').click(); - - //Navigating inside the added folder in the Attachments folder - cy.get('[title="Test Folder"] > span').click(); - - //To check if the URL is correct after visiting the Test Folder - cy.location('pathname').should('eq', '/app/file/view/home/Attachments/Test%20Folder'); - cy.visit('/app/file/view/home/Attachments/Test%20Folder'); - - //Adding a file inside the Test Folder - cy.get('.primary-action').contains('Add File').eq(0).click({force: true}); - cy.get('.mt-2 > .btn > .mt-1').eq(2).click(); - cy.get('.input-group > .form-control').type('https://wallpaperplay.com/walls/full/8/2/b/72402.jpg'); - cy.get('.btn-primary').contains('Upload').click(); - - //To check if the added file is present in the Test Folder - cy.get('span.level-item > span').should('contain', 'Test Folder'); - cy.get('.list-row-container').eq(0).should('contain.text', '72402.jpg'); - cy.get('.list-row-checkbox').eq(0).click(); - - //Deleting the added file from the Test folder - cy.get('.actions-btn-group > .btn').click(); - cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); - cy.wait(700); - cy.click_modal_primary_button('Yes', {force: true, delay: 700}); - cy.wait(700); - - //Deleting the Test Folder - cy.visit('/app/file/view/home/Attachments'); - cy.get('.list-row-checkbox').eq(0).click(); - cy.get('.actions-btn-group > .btn').click(); - cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); - cy.click_modal_primary_button('Yes'); - }); - - it('Deleting Test Folder from the home', () => { - //Deleting the Test Folder added in the home directory - cy.visit('/app/file/view/home'); - cy.get('.list-row-container > .list-row > .level-left > .list-subject > .list-row-checkbox').eq(0).click({force: true, delay: 500}); - cy.get('.actions-btn-group > .btn').click(); - cy.get('.actions-btn-group > .dropdown-menu > li > .grey-link').eq(5).click(); - cy.click_modal_primary_button('Yes', {force: true}); - }); -}); ->>>>>>> 166574b1d065ac0c0461a671d7fe837a9d35b7ce From 533b0147b28b069bd3d4ed4c41e4d20528b6a572 Mon Sep 17 00:00:00 2001 From: Komal-Saraf0609 Date: Thu, 19 Aug 2021 20:58:12 +0530 Subject: [PATCH 29/37] test: Fixed sider issues --- cypress/integration/folder_navigation.js | 130 +++++++++++------------ 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/cypress/integration/folder_navigation.js b/cypress/integration/folder_navigation.js index 1ff38005ad..09df8d2d20 100644 --- a/cypress/integration/folder_navigation.js +++ b/cypress/integration/folder_navigation.js @@ -1,79 +1,79 @@ context('Folder Navigation', () => { - before(() => { - cy.visit('/login'); - cy.login(); - cy.visit('/app/file'); - }); + before(() => { + cy.visit('/login'); + cy.login(); + cy.visit('/app/file'); + }); - it('Adding Folders', () => { - //Adding filter to go into the home folder - cy.get('.filter-selector > .btn').click(); - cy.findByRole('button', {name: 'Clear Filters'}).click(); - cy.get('.filter-action-buttons > .text-muted').click(); - cy.get('.fieldname-select-area > .awesomplete > .form-control').type('Fol{enter}'); - cy.get('.filter-field > .form-group > .link-field > .awesomplete > .input-with-feedback').type('Home{enter}'); - cy.get('.filter-action-buttons > div > .btn-primary').click(); + it('Adding Folders', () => { + //Adding filter to go into the home folder + cy.get('.filter-selector > .btn').click(); + cy.findByRole('button', {name: 'Clear Filters'}).click(); + cy.get('.filter-action-buttons > .text-muted').click(); + cy.get('.fieldname-select-area > .awesomplete > .form-control').type('Fol{enter}'); + cy.get('.filter-field > .form-group > .link-field > .awesomplete > .input-with-feedback').type('Home{enter}'); + cy.get('.filter-action-buttons > div > .btn-primary').click(); - //Adding folder (Test Folder) - cy.get('.menu-btn-group > .btn').click(); - cy.get('.menu-btn-group [data-label="New Folder"]').click(); - cy.get('form > [data-fieldname="value"]').type('Test Folder'); - cy.findByRole('button', {name: 'Create'}).click(); - }); + //Adding folder (Test Folder) + cy.get('.menu-btn-group > .btn').click(); + cy.get('.menu-btn-group [data-label="New Folder"]').click(); + cy.get('form > [data-fieldname="value"]').type('Test Folder'); + cy.findByRole('button', {name: 'Create'}).click(); + }); - it('Navigating the nested folders, checking if the URL formed is correct, checking if the added content in the child folder is correct', () => { - //Navigating inside the Attachments folder - cy.get('[title="Attachments"] > span').click(); + it('Navigating the nested folders, checking if the URL formed is correct, checking if the added content in the child folder is correct', () => { + //Navigating inside the Attachments folder + cy.get('[title="Attachments"] > span').click(); - //To check if the URL formed after visiting the attachments folder is correct - cy.location('pathname').should('eq', '/app/file/view/home/Attachments'); - cy.visit('/app/file/view/home/Attachments'); + //To check if the URL formed after visiting the attachments folder is correct + cy.location('pathname').should('eq', '/app/file/view/home/Attachments'); + cy.visit('/app/file/view/home/Attachments'); - //Adding folder inside the attachments folder - cy.get('.menu-btn-group > .btn').click(); - cy.get('.menu-btn-group [data-label="New Folder"]').click(); - cy.get('form > [data-fieldname="value"]').type('Test Folder'); - cy.findByRole('button', {name: 'Create'}).click(); + //Adding folder inside the attachments folder + cy.get('.menu-btn-group > .btn').click(); + cy.get('.menu-btn-group [data-label="New Folder"]').click(); + cy.get('form > [data-fieldname="value"]').type('Test Folder'); + cy.findByRole('button', {name: 'Create'}).click(); - //Navigating inside the added folder in the Attachments folder - cy.get('[title="Test Folder"] > span').click(); + //Navigating inside the added folder in the Attachments folder + cy.get('[title="Test Folder"] > span').click(); - //To check if the URL is correct after visiting the Test Folder - cy.location('pathname').should('eq', '/app/file/view/home/Attachments/Test%20Folder'); - cy.visit('/app/file/view/home/Attachments/Test%20Folder'); + //To check if the URL is correct after visiting the Test Folder + cy.location('pathname').should('eq', '/app/file/view/home/Attachments/Test%20Folder'); + cy.visit('/app/file/view/home/Attachments/Test%20Folder'); - //Adding a file inside the Test Folder - cy.findByRole('button', {name: 'Add File'}).eq(0).click({force: true}); - cy.get('.mt-2 > .btn > .mt-1').eq(2).click(); - cy.get('.input-group > .form-control').type('https://wallpaperplay.com/walls/full/8/2/b/72402.jpg'); - cy.findByRole('button', {name: 'Upload'}).click(); + //Adding a file inside the Test Folder + cy.findByRole('button', {name: 'Add File'}).eq(0).click({force: true}); + cy.get('.mt-2 > .btn > .mt-1').eq(2).click(); + cy.get('.input-group > .form-control').type('https://wallpaperplay.com/walls/full/8/2/b/72402.jpg'); + cy.findByRole('button', {name: 'Upload'}).click(); - //To check if the added file is present in the Test Folder - cy.get('span.level-item > span').should('contain', 'Test Folder'); - cy.get('.list-row-container').eq(0).should('contain.text', '72402.jpg'); - cy.get('.list-row-checkbox').eq(0).click(); + //To check if the added file is present in the Test Folder + cy.get('span.level-item > span').should('contain', 'Test Folder'); + cy.get('.list-row-container').eq(0).should('contain.text', '72402.jpg'); + cy.get('.list-row-checkbox').eq(0).click(); - //Deleting the added file from the Test folder - cy.findByRole('button', {name: 'Actions'}).click(); - cy.get('.actions-btn-group [data-label="Delete"]').click(); - cy.wait(700); - cy.findByRole('button', {name: 'Yes'}).click(); - cy.wait(700); + //Deleting the added file from the Test folder + cy.findByRole('button', {name: 'Actions'}).click(); + cy.get('.actions-btn-group [data-label="Delete"]').click(); + cy.wait(700); + cy.findByRole('button', {name: 'Yes'}).click(); + cy.wait(700); - //Deleting the Test Folder - cy.visit('/app/file/view/home/Attachments'); - cy.get('.list-row-checkbox').eq(0).click(); - cy.findByRole('button', {name: 'Actions'}).click(); - cy.get('.actions-btn-group [data-label="Delete"]').click(); - cy.findByRole('button', {name: 'Yes'}).click(); - }); + //Deleting the Test Folder + cy.visit('/app/file/view/home/Attachments'); + cy.get('.list-row-checkbox').eq(0).click(); + cy.findByRole('button', {name: 'Actions'}).click(); + cy.get('.actions-btn-group [data-label="Delete"]').click(); + cy.findByRole('button', {name: 'Yes'}).click(); + }); - 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.findByRole('button', {name: 'Actions'}).click(); - cy.get('.actions-btn-group [data-label="Delete"]').click(); - cy.findByRole('button', {name: 'Yes'}).click(); - }); + 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.findByRole('button', {name: 'Actions'}).click(); + cy.get('.actions-btn-group [data-label="Delete"]').click(); + cy.findByRole('button', {name: 'Yes'}).click(); + }); }); From a8846d52df900ae71539cc0b06f83ec0aad96833 Mon Sep 17 00:00:00 2001 From: Komal-Saraf0609 Date: Thu, 19 Aug 2021 21:04:02 +0530 Subject: [PATCH 30/37] test: Fixed sider issues --- cypress/integration/email_testing.js | 66 ++++++++++++++-------------- 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/cypress/integration/email_testing.js b/cypress/integration/email_testing.js index 15cc895600..cdc7a90af5 100644 --- a/cypress/integration/email_testing.js +++ b/cypress/integration/email_testing.js @@ -5,40 +5,38 @@ context('Email Feature Test', () => { cy.visit('/app/todo'); }); - it('Saving and Deleting Email Template', () => { - cy.get('.level-item.ellipsis > .ellipsis').click(); - cy.get('.timeline-actions > .btn').click(); - cy.fill_field('recipients','test@example.com','MultiSelect'); - cy.get('.modal.show > .modal-dialog > .modal-content > .modal-body > :nth-child(1) > .form-layout > .form-page > :nth-child(3) > .section-body > .form-column > form > [data-fieldtype="Text Editor"] > .form-group > .control-input-wrapper > .control-input > .ql-container > .ql-editor').type('Test Mail'); - - cy.get('.add-more-attachments > .btn').click(); - cy.get('.mt-2 > .btn > .mt-1').eq(2).click(); - cy.get('.input-group > .form-control').type('https://wallpaperplay.com/walls/full/8/2/b/72402.jpg'); - cy.get('.btn-primary').contains('Upload').click(); - cy.get('.modal-footer > .standard-actions > .btn-primary').contains('Send').click({delay:500}); - cy.get('[data-doctype="Communication"] > .timeline-content').should('contain','Test Mail'); - cy.get('.timeline-content').should('contain','Added 72402.jpg'); - cy.get('[title="Open Communication"] > .icon').click(); - 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 > :nth-child(11) > .grey-link').click(); - cy.get('.modal.show > .modal-dialog > .modal-content > .modal-footer > .standard-actions > .btn-primary').click(); - cy.visit('/app/todo'); - cy.get('.level-item.ellipsis > .ellipsis').click(); - cy.get('.attachment-row > .data-pill > .remove-btn > .icon').click(); - cy.get('.modal-footer > .standard-actions > .btn-primary').contains('Yes').click(); - cy.get('.timeline-content').should('contain','Removed 72402.jpg'); - }); + it('Saving and Deleting Email Template', () => { + cy.get('.level-item.ellipsis > .ellipsis').click(); + cy.get('.timeline-actions > .btn').click(); + cy.fill_field('recipients','test@example.com','MultiSelect'); + cy.get('.modal.show > .modal-dialog > .modal-content > .modal-body > :nth-child(1) > .form-layout > .form-page > :nth-child(3) > .section-body > .form-column > form > [data-fieldtype="Text Editor"] > .form-group > .control-input-wrapper > .control-input > .ql-container > .ql-editor').type('Test Mail'); - it('Discarding Email Template', () => { - cy.visit('/app/todo'); - cy.get('.level-item.ellipsis > .ellipsis').click(); - cy.get('.timeline-actions > .btn').click(); - cy.fill_field('recipients','test@example.com','MultiSelect'); - cy.get('.modal-footer > .standard-actions > .btn-secondary').contains('Discard').click(); - cy.get('.timeline-actions > .btn').click(); - cy.get_field('recipients','MultiSelect').should('have.value',''); - cy.get('.modal.show > .modal-dialog > .modal-content > .modal-header > .modal-actions > .btn-modal-close > .icon').click(); - }); + cy.get('.add-more-attachments > .btn').click(); + cy.get('.mt-2 > .btn > .mt-1').eq(2).click(); + cy.get('.input-group > .form-control').type('https://wallpaperplay.com/walls/full/8/2/b/72402.jpg'); + cy.get('.btn-primary').contains('Upload').click(); + cy.get('.modal-footer > .standard-actions > .btn-primary').contains('Send').click({delay:500}); + cy.get('[data-doctype="Communication"] > .timeline-content').should('contain','Test Mail'); + cy.get('.timeline-content').should('contain','Added 72402.jpg'); + cy.get('[title="Open Communication"] > .icon').click(); + 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 > :nth-child(11) > .grey-link').click(); + cy.get('.modal.show > .modal-dialog > .modal-content > .modal-footer > .standard-actions > .btn-primary').click(); + cy.visit('/app/todo'); + cy.get('.level-item.ellipsis > .ellipsis').click(); + cy.get('.attachment-row > .data-pill > .remove-btn > .icon').click(); + cy.get('.modal-footer > .standard-actions > .btn-primary').contains('Yes').click(); + cy.get('.timeline-content').should('contain','Removed 72402.jpg'); + }); - + it('Discarding Email Template', () => { + cy.visit('/app/todo'); + cy.get('.level-item.ellipsis > .ellipsis').click(); + cy.get('.timeline-actions > .btn').click(); + cy.fill_field('recipients','test@example.com','MultiSelect'); + cy.get('.modal-footer > .standard-actions > .btn-secondary').contains('Discard').click(); + cy.get('.timeline-actions > .btn').click(); + cy.get_field('recipients','MultiSelect').should('have.value',''); + cy.get('.modal.show > .modal-dialog > .modal-content > .modal-header > .modal-actions > .btn-modal-close > .icon').click(); + }); }); From f53622d21ecd69a1565354fd6b540f5d4b2db84c Mon Sep 17 00:00:00 2001 From: Komal-Saraf0609 Date: Thu, 19 Aug 2021 21:10:08 +0530 Subject: [PATCH 31/37] test: Deleted the file email_testing.js --- cypress/integration/email_testing.js | 42 ---------------------------- 1 file changed, 42 deletions(-) delete mode 100644 cypress/integration/email_testing.js diff --git a/cypress/integration/email_testing.js b/cypress/integration/email_testing.js deleted file mode 100644 index cdc7a90af5..0000000000 --- a/cypress/integration/email_testing.js +++ /dev/null @@ -1,42 +0,0 @@ -context('Email Feature Test', () => { - before(() => { - cy.visit('/login'); - cy.login(); - cy.visit('/app/todo'); - }); - - it('Saving and Deleting Email Template', () => { - cy.get('.level-item.ellipsis > .ellipsis').click(); - cy.get('.timeline-actions > .btn').click(); - cy.fill_field('recipients','test@example.com','MultiSelect'); - cy.get('.modal.show > .modal-dialog > .modal-content > .modal-body > :nth-child(1) > .form-layout > .form-page > :nth-child(3) > .section-body > .form-column > form > [data-fieldtype="Text Editor"] > .form-group > .control-input-wrapper > .control-input > .ql-container > .ql-editor').type('Test Mail'); - - cy.get('.add-more-attachments > .btn').click(); - cy.get('.mt-2 > .btn > .mt-1').eq(2).click(); - cy.get('.input-group > .form-control').type('https://wallpaperplay.com/walls/full/8/2/b/72402.jpg'); - cy.get('.btn-primary').contains('Upload').click(); - cy.get('.modal-footer > .standard-actions > .btn-primary').contains('Send').click({delay:500}); - cy.get('[data-doctype="Communication"] > .timeline-content').should('contain','Test Mail'); - cy.get('.timeline-content').should('contain','Added 72402.jpg'); - cy.get('[title="Open Communication"] > .icon').click(); - 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 > :nth-child(11) > .grey-link').click(); - cy.get('.modal.show > .modal-dialog > .modal-content > .modal-footer > .standard-actions > .btn-primary').click(); - cy.visit('/app/todo'); - cy.get('.level-item.ellipsis > .ellipsis').click(); - cy.get('.attachment-row > .data-pill > .remove-btn > .icon').click(); - cy.get('.modal-footer > .standard-actions > .btn-primary').contains('Yes').click(); - cy.get('.timeline-content').should('contain','Removed 72402.jpg'); - }); - - it('Discarding Email Template', () => { - cy.visit('/app/todo'); - cy.get('.level-item.ellipsis > .ellipsis').click(); - cy.get('.timeline-actions > .btn').click(); - cy.fill_field('recipients','test@example.com','MultiSelect'); - cy.get('.modal-footer > .standard-actions > .btn-secondary').contains('Discard').click(); - cy.get('.timeline-actions > .btn').click(); - cy.get_field('recipients','MultiSelect').should('have.value',''); - cy.get('.modal.show > .modal-dialog > .modal-content > .modal-header > .modal-actions > .btn-modal-close > .icon').click(); - }); -}); From a5e9d1ef4d3b5d9f10c163efe0578d8693e49f25 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Fri, 27 Aug 2021 22:46:18 +0530 Subject: [PATCH 32/37] ci: concurrency control for CI jobs When same PR causes multiple CI triggers due to rapid addition of new commits, this change will cancel previous CI jobs to save resources. --- .github/workflows/server-mariadb-tests.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/server-mariadb-tests.yml b/.github/workflows/server-mariadb-tests.yml index 65b6666678..7c4d72b9fa 100644 --- a/.github/workflows/server-mariadb-tests.yml +++ b/.github/workflows/server-mariadb-tests.yml @@ -6,6 +6,11 @@ on: push: branches: [ develop ] +concurrency: + group: server-mariadb-${{ github.event.number }} + cancel-in-progress: true + + jobs: test: runs-on: ubuntu-18.04 From d0099985fcee57b7852ac6567c3c504a812cfe0e Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Fri, 27 Aug 2021 23:04:37 +0530 Subject: [PATCH 33/37] ci: concurrency control for postgres --- .github/workflows/server-postgres-tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/server-postgres-tests.yml b/.github/workflows/server-postgres-tests.yml index 17a0f6f94f..1539e8c2d5 100644 --- a/.github/workflows/server-postgres-tests.yml +++ b/.github/workflows/server-postgres-tests.yml @@ -4,6 +4,10 @@ on: pull_request: workflow_dispatch: +concurrency: + group: server-postgres-develop-${{ github.event.number }} + cancel-in-progress: true + jobs: test: runs-on: ubuntu-18.04 From 132864a77641fcfe233a25539a21bd1faf4cdc53 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Fri, 27 Aug 2021 23:08:09 +0530 Subject: [PATCH 34/37] ci: extend concurrency control to all long jobs --- .github/workflows/patch-mariadb-tests.yml | 5 +++++ .github/workflows/server-mariadb-tests.yml | 2 +- .github/workflows/ui-tests.yml | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/patch-mariadb-tests.yml b/.github/workflows/patch-mariadb-tests.yml index 6ccc059afb..0dd4cd51d8 100644 --- a/.github/workflows/patch-mariadb-tests.yml +++ b/.github/workflows/patch-mariadb-tests.yml @@ -2,6 +2,11 @@ name: Patch on: [pull_request, workflow_dispatch] + +concurrency: + group: patch-mariadb-develop-${{ github.event.number }} + cancel-in-progress: true + jobs: test: runs-on: ubuntu-18.04 diff --git a/.github/workflows/server-mariadb-tests.yml b/.github/workflows/server-mariadb-tests.yml index 7c4d72b9fa..06977c7c2b 100644 --- a/.github/workflows/server-mariadb-tests.yml +++ b/.github/workflows/server-mariadb-tests.yml @@ -7,7 +7,7 @@ on: branches: [ develop ] concurrency: - group: server-mariadb-${{ github.event.number }} + group: server-mariadb-develop-${{ github.event.number }} cancel-in-progress: true diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index d56433c216..2a55546ec4 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -6,6 +6,10 @@ on: push: branches: [ develop ] +concurrency: + group: ui-develop-${{ github.event.number }} + cancel-in-progress: true + jobs: test: runs-on: ubuntu-18.04 From 9df31cfed1594c4aca4629b22e741959de84c042 Mon Sep 17 00:00:00 2001 From: Komal-Saraf0609 Date: Sat, 28 Aug 2021 01:55:46 +0530 Subject: [PATCH 35/37] test: Corrected the selectors for clicking of a button to make it more readable --- cypress/integration/folder_navigation.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cypress/integration/folder_navigation.js b/cypress/integration/folder_navigation.js index 09df8d2d20..1b7c02d98c 100644 --- a/cypress/integration/folder_navigation.js +++ b/cypress/integration/folder_navigation.js @@ -7,12 +7,12 @@ context('Folder Navigation', () => { it('Adding Folders', () => { //Adding filter to go into the home folder - cy.get('.filter-selector > .btn').click(); + cy.get('.filter-selector > .btn').findByText('1 filter').click(); cy.findByRole('button', {name: 'Clear Filters'}).click(); - cy.get('.filter-action-buttons > .text-muted').click(); + cy.get('.filter-action-buttons > .text-muted').findByText('+ Add a Filter').click(); cy.get('.fieldname-select-area > .awesomplete > .form-control').type('Fol{enter}'); cy.get('.filter-field > .form-group > .link-field > .awesomplete > .input-with-feedback').type('Home{enter}'); - cy.get('.filter-action-buttons > div > .btn-primary').click(); + cy.get('.filter-action-buttons > div > .btn-primary').findByText('Apply Filters').click(); //Adding folder (Test Folder) cy.get('.menu-btn-group > .btn').click(); @@ -44,7 +44,7 @@ context('Folder Navigation', () => { //Adding a file inside the Test Folder cy.findByRole('button', {name: 'Add File'}).eq(0).click({force: true}); - cy.get('.mt-2 > .btn > .mt-1').eq(2).click(); + cy.get('.file-uploader').findByText('Link').click(); cy.get('.input-group > .form-control').type('https://wallpaperplay.com/walls/full/8/2/b/72402.jpg'); cy.findByRole('button', {name: 'Upload'}).click(); From a5ded007a53390e2fdf8ca0cd9010b4106c5c68f Mon Sep 17 00:00:00 2001 From: Gavin D'souza Date: Mon, 30 Aug 2021 12:54:37 +0530 Subject: [PATCH 36/37] fix(ci): Run all builds on github push events Issue: No PR number is detected on Push events and all builds are skipped. We want the opposite to be true, so we're running all builds on merges in hopes of testing better. --- .github/helper/roulette.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/helper/roulette.py b/.github/helper/roulette.py index dd3081822e..9831df7f30 100644 --- a/.github/helper/roulette.py +++ b/.github/helper/roulette.py @@ -38,8 +38,12 @@ if __name__ == "__main__": pr_number = os.environ.get("PR_NUMBER") repo = os.environ.get("REPO_NAME") - if not files_list and pr_number: - files_list = get_files_list(pr_number=pr_number, repo=repo) + # this is a push build, run all builds + if not pr_number: + os.system('echo "::set-output name=build::strawberry"') + sys.exit(0) + + files_list = files_list or get_files_list(pr_number=pr_number, repo=repo) if not files_list: print("No files' changes detected. Build is shutting") From 0c7c1dcb890410ba6c5b18f2e6fec01609a31ca3 Mon Sep 17 00:00:00 2001 From: Saqib Date: Mon, 30 Aug 2021 20:02:29 +0530 Subject: [PATCH 37/37] feat: Bulk export from list view (#13906) Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com> --- .../js/frappe/data_import/data_exporter.js | 16 ++++++++-------- frappe/public/js/frappe/list/bulk_operations.js | 10 ++++++++++ frappe/public/js/frappe/list/list_view.js | 14 ++++++++++++++ 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/frappe/public/js/frappe/data_import/data_exporter.js b/frappe/public/js/frappe/data_import/data_exporter.js index 03e6288856..8fa5a08945 100644 --- a/frappe/public/js/frappe/data_import/data_exporter.js +++ b/frappe/public/js/frappe/data_import/data_exporter.js @@ -13,6 +13,13 @@ frappe.data_import.DataExporter = class DataExporter { this.dialog = new frappe.ui.Dialog({ title: __('Export Data'), fields: [ + { + fieldtype: 'Select', + fieldname: 'file_type', + label: __('File Type'), + options: ['Excel', 'CSV'], + default: 'CSV' + }, { fieldtype: 'Select', fieldname: 'export_records', @@ -45,13 +52,6 @@ frappe.data_import.DataExporter = class DataExporter { fieldname: 'filter_area', depends_on: doc => doc.export_records === 'by_filter' }, - { - fieldtype: 'Select', - fieldname: 'file_type', - label: __('File Type'), - options: ['Excel', 'CSV'], - default: 'CSV' - }, { fieldtype: 'Section Break' }, @@ -141,7 +141,7 @@ frappe.data_import.DataExporter = class DataExporter { let for_insert = this.exporting_for === 'Insert New Records'; let section_title = for_insert ? __('Select Fields To Insert') : __('Select Fields To Update'); let $select_all_buttons = $(` -
+
${section_title}