Commit graph

57 commits

Author SHA1 Message Date
Ankush Menat
d7a9d0111c
perf: lazy load SVG icons (#22517)
| Metric                             | Before | After | Change    |
| ---                                | ---    | ---   | ---       |
| app.html first response size       | 421kb  | 106kb | -75% (!)  |
| First response duration            | 60ms   | 40ms  | -33%      |

huge thanks to @cogk for doing most of the work for this PR on this issue: https://github.com/frappe/frappe/issues/17449#issuecomment-1728328726

Co-authored-by: Corentin Flr <10946971+cogk@users.noreply.github.com>
2023-09-23 15:13:43 +05:30
Corentin Flr
41d30e7213
feat: Add custom icons with the app_include_icons hook (#22254)
* feat: Add custom icons with the `app_include_icons` hook

These custom icons are available on the desk only. They can be picked in the `ControlIcon` picker.

Co-authored-by: Abraham Kalungi <85731451+kalungia@users.noreply.github.com>

* fix: skip conf for including icons

* test: Fix test_include_icons

---------

Co-authored-by: Abraham Kalungi <85731451+kalungia@users.noreply.github.com>
Co-authored-by: Ankush Menat <ankushmenat@gmail.com>
2023-09-20 20:23:17 +05:30
Deepesh Garg
e38078a69f
test: Patch hooks for testing (#21702)
* test: Patch hooks for testing

* test: hooks patcher

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-07-17 12:41:27 +05:30
Corentin Flr
9afedfae25
fix(test): Remove frappe.local.request between requests
`frappe.local.request` was not cleared between tests, which would not be a problem if all tests did set it to another Request object. But, some tests directly fetch the response content using get_response_content without first setting the frappe.local.request object (using set_request).
2023-06-16 13:27:49 +02:00
Corentin Flr
bcdc483a13
fix(test): Fix test_never_render to get path as string, exclude PYC files from static downloads
This test code never actually tested the behaviour for two reasons:
- first, the page had an error which meant that a 500 Error page was returned (because `path` is not a string)
- second, every page contains the string "400" because it's contained in some of the icons.svg icons!

I also found a minor related bug in static_page.py, allowing people to download PYC files (pycache)
2023-06-15 18:36:30 +02:00
Ankush Menat
3d0888a5d5 refactor: set_value usage 2023-06-13 16:00:43 +05:30
Ankush Menat
fa6dc03cc8
refactor: frappe.cache() usage to frappe.cache (#21282) 2023-06-08 11:47:17 +05:30
Ankush Menat
76e576c83e test: fix print view test from lang 2023-04-14 09:07:00 +05:30
gavin
cd524135c0
fix: TemplatePage.can_render (#20257)
Don't render python executable/loadable files from TemplatePage
renderer. This restricts access to reading/downloading possibly
private Python source code from Frappe applications
2023-03-06 12:40:15 +05:30
Faris Ansari
cfc2dd4437 test: patch get_hooks to bypass cache 2022-11-15 14:50:38 +05:30
Faris Ansari
e0a725025c test: for app_include_js and app_include_css 2022-11-11 20:47:18 +05:30
Faris Ansari
4f650854b8
fix(dx): resolve_class (#18417)
* fix(resolve_class): ignore False values

* fix: allow multiple arguments

* fix: remove unnecessary condition

* test: resolve_class
2022-10-15 17:40:22 +05:30
Ankush Menat
3e2d2a703a test: Use FrappeTestCase everywhere 2022-08-17 16:39:42 +05:30
Ankush Menat
015937a03a test: fix anticipiated test failures 2022-08-04 14:50:24 +05:30
Suraj Shetty
3199be44cd test: Assert status_code according to the exception 2022-06-01 12:49:47 +05:30
Faris Ansari
eeab5edf5f test: test for metatag rendering 2022-05-11 13:29:03 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
Ankush Menat
5c17f9ad79
Merge pull request #15661 from gavindsouza/thumbnail-for-images
fix: Thumbnail for external images (from URL)
2022-02-02 12:21:06 +05:30
Gavin D'souza
897b8a5b66 test: Add test for hosting binary file using StaticPage resolver 2022-01-19 19:30:08 +05:30
Gavin D'souza
227dc26707 Merge branch 'develop' of github.com:frappe/frappe into set_value-refactor 2022-01-17 14:04:13 +05:30
Gavin D'souza
3052808048 fix: Don't cast to str if None or Falsy
* refactor: use get_single_value instead of set_value(blah, None, blah1)
* User.reload in test_home_page to combat what happens locally
2022-01-10 15:05:57 +05:30
Conor
40ba1ac9ba fix: Postgres Compatibility
* Handle inconsistencies in type handling in DatabaseQuery & Database
  APIs
* Update incompatible queries with frappe.qb notation
* Fixed use cases discovered by failing ERPNext CI tests

fix: db independent syntax for user_type

fix: handle postgres datetime values

feat: add ability to auto commit on db inserts

feat: add ability to escape underscore in postgres

fix: handle missing data in test runner bootstrapping

fix: db independent syntax for queries

fix: refactor to use qb

fix: update cache for language

fix: use pluck in email_queue

Co-authored-by: gavin <gavin18d@gmail.com>

fix: don't auto insert on tests for make_property_setter

fix: remove auto_commit in custom_field insertion

fix: remove auto_commit functionality

fix: review comments

fix: revert link validation

fix: style suggestion for readability

Co-authored-by: gavin <gavin18d@gmail.com>

fix: revert .lower() in link validation

fix: add rollback for setup_wizard

Revert "fix: add rollback for setup_wizard"

This reverts commit 83b3b0913db17718ccd5edae01858cff15603829.

Revert "feat: add ability to escape underscore in postgres"

This reverts commit 8ed9c2aa3306438e94bb813f60e65b416d0b947b.

fix: more concise representation of order fields

Co-authored-by: gavin <gavin18d@gmail.com>
2022-01-07 10:44:57 +05:30
Gavin D'souza
c1db7649eb test: Delete from Access Log before each website test
This should fix flaky test_printview_page which fails due to name
collision while creating access log documents
2021-10-27 14:37:19 +05:30
Gavin D'souza
f08faf151c test(website): Clear db.value_cache on tearDown 2021-10-22 18:18:14 +05:30
Gavin D'souza
a575cff8a7 fix: Retry flaky test_printview_page if errored 2021-10-19 12:35:55 +05:30
Faris Ansari
7a34c542c1 test: safe_render 2021-08-03 12:40:48 +05:30
Suraj Shetty
fccd19a44c test: Add test to validate minified js load 2021-07-03 14:13:16 +05:30
Suraj Shetty
4363e51c6d test: Fix improper tests for website rendering 2021-07-01 22:10:02 +05:30
Suraj Shetty
a93bb67030 test: Add test case to validate raw file load 2021-07-01 22:08:15 +05:30
Suraj Shetty
9ad276767f test: Reset no_cache flag 2021-06-24 13:30:11 +05:30
Suraj Shetty
62684a70c1 test: Clear website cache after changing look_for_sidebar flag 2021-06-24 12:05:24 +05:30
Suraj Shetty
090c604b0a test: Add test cases to validate caching 2021-06-24 12:01:04 +05:30
Suraj Shetty
e83e80c6af test: Move tests to correct test file 2021-06-24 10:23:07 +05:30
Suraj Shetty
6f3e6fee82 test: Add test to check ability to use get_context without context object 2021-06-24 10:22:27 +05:30
Suraj Shetty
1ef83ea15f test: Add printview page test 2021-06-04 11:50:03 +05:30
Suraj Shetty
2d8c6c1710 Merge branch 'develop' of https://github.com/frappe/frappe into refactor-website 2021-06-03 11:43:28 +05:30
Suraj Shetty
2544964501 test: Add test case to validate custom page renderer 2021-06-03 10:41:22 +05:30
Gavin D'souza
e407b78506 chore: Drop dead and deprecated code
* Remove six for PY2 compatability since our dependencies are not, PY2
  is legacy.
* Removed usages of utils from future/past libraries since they are
  deprecated. This includes 'from __future__ ...' and 'from past...'
  statements.
* Removed compatibility imports for PY2, switched from six imports to
  standard library imports.
* Removed utils code blocks that handle operations depending on PY2/3
  versions.
* Removed 'from __future__ ...' lines from templates/code generators
* Used PY3 syntaxes in place of PY2 compatible blocks. eg: metaclass
2021-05-26 15:31:29 +05:30
Suraj Shetty
78206bea8f test: Clear hook cache after updating hook 2021-05-25 16:39:48 +05:30
Suraj Shetty
ca56b21290 test: Check all cases of setting homepage 2021-05-25 15:01:20 +05:30
Suraj Shetty
9429d06a17 refactor: Remove reduntant code
- Use Error & NotFound page as required
2021-05-11 16:44:50 +05:30
Suraj Shetty
e101105bce refactor: Import get_response instead of using serve.get_response 2021-05-11 10:41:18 +05:30
Suraj Shetty
b39b5effbf Merge branch 'develop' of https://github.com/frappe/frappe into refactor-website 2021-05-11 10:38:04 +05:30
Ankush Menat
a077466b1e
chore: replace assertEquals with alias assertEqual
`assertEquals` has been deprecated, while not fully removed it will
still keep giving warnings in tests / CI.

ref: https://docs.python.org/3/library/unittest.html#deprecated-aliases
2021-05-06 21:16:22 +05:30
Suraj Shetty
30659b9ee2 feat: Option to consider query string while writing website redirect
- if match_with_query_string is true in a website redirect rule, system will try to match the regex with the result of route + query_string
2021-03-11 10:29:12 +05:30
Rushabh Mehta
e79e142061 fix(minor): fix some tests and merge old and new website tests 2021-02-15 17:43:17 +05:30
barredterra
1930993675 test: login-css is no longer in login.html 2020-09-10 14:49:31 +02:00
Rushabh Mehta
137df8290b fix(sider): fix sider issues 2020-08-17 09:41:54 +05:30
Rushabh Mehta
b0f2af0ac5 fix(tests): add tests for home page 2020-08-17 09:41:54 +05:30
Gavin D'souza
450f5c3785 chore: moved 'get_html_for_route' to frappe.utils 2019-11-29 20:42:25 +05:30