From e74c2f33c5fe62fb84a02268da28a5b6540df4c2 Mon Sep 17 00:00:00 2001 From: sebastian-zak Date: Mon, 21 Apr 2025 21:51:24 +0200 Subject: [PATCH 01/32] Add files via upload --- MakeFile | 16 +++++ README.md | 22 +++++++ b4uleave/__init__.py | 1 + b4uleave/entrypoint.py | 92 +++++++++++++++++++++++++++ dist/b4uleave-0.1.0-py3-none-any.whl | Bin 0 -> 3345 bytes dist/b4uleave-0.1.0.tar.gz | Bin 0 -> 2551 bytes pyproject.toml | 18 ++++++ 7 files changed, 149 insertions(+) create mode 100644 MakeFile create mode 100644 README.md create mode 100644 b4uleave/__init__.py create mode 100644 b4uleave/entrypoint.py create mode 100644 dist/b4uleave-0.1.0-py3-none-any.whl create mode 100644 dist/b4uleave-0.1.0.tar.gz create mode 100644 pyproject.toml diff --git a/MakeFile b/MakeFile new file mode 100644 index 0000000..283a382 --- /dev/null +++ b/MakeFile @@ -0,0 +1,16 @@ +.PHONY: install test build publish clean + +install: + pip install . + +test: + pytest + +build: + poetry build + +publish: + poetry publish --build + +clean: + rm -rf dist build *.egg-info \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e0b1472 --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +# B4ULeave Plugin + +## Overview + +Plugin B4ULeave wyświetla modalne okno z pytaniem, czy użytkownik chce opuścić stronę przy zdarzeniu `beforeunload`. + +## Installation + +```sh +pip install platzky-B4ULeave +``` + +## Usage + +```json +"plugins": [ + { + "name": "B4ULeave", + "config": {} + } +] +``` \ No newline at end of file diff --git a/b4uleave/__init__.py b/b4uleave/__init__.py new file mode 100644 index 0000000..da6cb62 --- /dev/null +++ b/b4uleave/__init__.py @@ -0,0 +1 @@ +from B4ULeave.entrypoint import process as process \ No newline at end of file diff --git a/b4uleave/entrypoint.py b/b4uleave/entrypoint.py new file mode 100644 index 0000000..40f4e02 --- /dev/null +++ b/b4uleave/entrypoint.py @@ -0,0 +1,92 @@ +from flask import Flask, Response +from typing import Any, Dict + +def process(app, plugin_config: Dict[str, Any]): + # Zapisujemy konfigurację (opcjonalnie pusta) + app.config['B4ULeave'] = plugin_config or {} + + @app.after_request + def add_B4ULeave(response: Response) -> Response: + if 'text/html' in response.headers.get('Content-Type', ''): + # kod wstrzykiwany przed + html = f""" + + +
+
+

Czy na pewno chcesz
opuścić naszą stronę?

+
+ + +
+
+
+ +""" + response.set_data(response.get_data(as_text=True).replace('', html + '')) + return response + + return app \ No newline at end of file diff --git a/dist/b4uleave-0.1.0-py3-none-any.whl b/dist/b4uleave-0.1.0-py3-none-any.whl new file mode 100644 index 0000000000000000000000000000000000000000..4f5856dffc23e179ed019b35f8a49f5562a671a7 GIT binary patch literal 3345 zcmaKv2{@Gd7stnvU4~FJ%1)LUB82QCV_(NsMz(7jX2e*_5|JWHW0YLG8JBE@$UbG6 z#=aJ^R}@0Y#6r9{>Qb(M`<6P#T}5 zNWVKxw;yjkRD=DzFNJtR5C|k1iA5m50pVuylmUl;)9hbh77Au#W_|Lf$`r^0z4A8X zUPUrQ&PG<2Vr8iahMOoPC^K09gx3*oxW~i{0Q|-d00{mQ?~TR=h6iAfXe|8$b#Q;w zqA_s)BSKk&|HWvan+c->sJ`W%!8`>Y=r7iNX?!xh#1-zCPRGxf5Bz=uwVOu@h2>cz73yXWyHxEq~0^W%cdMa|ajl&iLD_ z&fN3yacX{=R&rv`j z?l+`UNH~?(gHU58=BGkKMeB1qN{)_PEs zRJ3HOnE?*BLnbExp>a1sXJ~|lYH1s_G28O2auX7F;IZ`q{wis${wPI{EGlhp=2c@^ zI}C$KIv3uO@j<2&rg$U!IL9c3Lngyq?C4AK0QpUZ<@_8MM{iEF=!i=|y~+H>+?@RP zMm=Rj!%eDCPi9b&=?goh&q7H&34`D6ShCE-aX#dP6GZVw829-5Jw_TACiqW#q;_RP zN@K*U?v`g3(~vl}7n_>#m}SkC>6xhO|C}qghguSqN(yb+j5p{f3iOE=Dem zOSO^^>!)uQsFIs?YxwORBCCOh)0ym>X3clbe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Fy#m@EldyGBQLSvAPa(h8p3}AK3N~D^^@6g?bOuu@Dv>Ks*R<451XW79 zG$dJ+R%@GMf~J{>Uy>+OL9A@>6(eiZhYu^;izs}?c0XeN<)+bJZnN6rKT)JZ_LJ$^ zn1+b^`t)zl1r%-|BU7HG&NL$N<)&5ekBS~7aj`O0z1*y$>ryRgdLEFJtn0p77X^mM zb5$3fO+-d(5Pq=Cr`1YXmcc7sjDL;Sm|E@bl&pjnQ7Vzpi2T3w|49zbocgd}r+g7T z(EZ=u_TBG)JI$84|9cR4lX4!}38!$}J45O&43g~TE(}2#)t`m{saJ>v9eH-q2yGf{2Q;D3MaDj( z@(d+;Ixmd+{f_;Wg^FX1dTlAgZ?meFAOQhap9+Dag68_l-m%*jDlZu|s%f|E?Hwg+ znz1No$Q*XQ#Tim34Cv1!5WTSq4bb!oYMr5iP<0`oMF}YlP{a0uNFKur9EYs`h5R3W z^P=JPj|M;b_y4_i`-k#>`$_YY@Bgi4+vNX)eE+8@QN^$EvPg7j@a-Mchkd|V=QLW6 z=|zIZ*#eFla6b95avzod1Hr+N_-It-Qe&v|*}(_TAf4;`ZBTuvT4EM5brLC=u;bvt z*u$L!O4k(}qa7_~{l6MES%!ko1X(Q9T}F?@vy99%f1yeJ+PN>i{nfoWzP>ldcJux$ z+xKT_-JfOWX1co21v=$jQuW{&?78**9lKdW-J6Qh*t{HZ^f7!3*3u=kdg{xQ`51No zk5T5kya59S3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz`!pF N{t3Kktvmow008S-{}2EG literal 0 HcmV?d00001 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b774cdf --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,18 @@ +[tool.poetry] +name = "B4ULeave" +version = "0.1.0" +description = "Plugin B4ULeave wyświetla modalne okno przy próbie opuszczenia strony." +license = "MIT" +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.8" +flask = "^2.0" + +[tool.poetry.group.dev.dependencies] +pytest = "^8.3.4" +platzky = "^0.2.13" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" \ No newline at end of file From 2b54dcf9d87b57aed0f5b46a1cb6067116dde099 Mon Sep 17 00:00:00 2001 From: Milena Chowaniec Date: Fri, 25 Apr 2025 20:01:51 +0200 Subject: [PATCH 02/32] update plugin and added unit test --- MakeFile | 5 +- README.md | 10 +- b4uleave/__init__.py | 1 - platzky_b4uleave/__init__.py | 1 + {b4uleave => platzky_b4uleave}/entrypoint.py | 8 +- poetry.lock | 2383 ++++++++++++++++++ pyproject.toml | 15 +- tests/test_b4uleave.py | 42 + 8 files changed, 2454 insertions(+), 11 deletions(-) delete mode 100644 b4uleave/__init__.py create mode 100644 platzky_b4uleave/__init__.py rename {b4uleave => platzky_b4uleave}/entrypoint.py (86%) create mode 100644 poetry.lock create mode 100644 tests/test_b4uleave.py diff --git a/MakeFile b/MakeFile index 283a382..a49386c 100644 --- a/MakeFile +++ b/MakeFile @@ -1,5 +1,3 @@ -.PHONY: install test build publish clean - install: pip install . @@ -9,6 +7,9 @@ test: build: poetry build +unit-tests: + poetry run python -m pytest -v + publish: poetry publish --build diff --git a/README.md b/README.md index e0b1472..0e10c0f 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,15 @@ pip install platzky-B4ULeave "plugins": [ { "name": "B4ULeave", - "config": {} + "config": { + "message": "Your custom message goes here" + } } ] +``` + +If you omit `message`, it defaults to: + +```html +

'Czy na pewno chcesz
opuścić naszą stronę?'

``` \ No newline at end of file diff --git a/b4uleave/__init__.py b/b4uleave/__init__.py deleted file mode 100644 index da6cb62..0000000 --- a/b4uleave/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from B4ULeave.entrypoint import process as process \ No newline at end of file diff --git a/platzky_b4uleave/__init__.py b/platzky_b4uleave/__init__.py new file mode 100644 index 0000000..c297140 --- /dev/null +++ b/platzky_b4uleave/__init__.py @@ -0,0 +1 @@ +from platzky_b4uleave.entrypoint import process as process \ No newline at end of file diff --git a/b4uleave/entrypoint.py b/platzky_b4uleave/entrypoint.py similarity index 86% rename from b4uleave/entrypoint.py rename to platzky_b4uleave/entrypoint.py index 40f4e02..f07e2c7 100644 --- a/b4uleave/entrypoint.py +++ b/platzky_b4uleave/entrypoint.py @@ -1,14 +1,16 @@ from flask import Flask, Response from typing import Any, Dict -def process(app, plugin_config: Dict[str, Any]): - # Zapisujemy konfigurację (opcjonalnie pusta) +def process(app, plugin_config: Dict[str, Any]): + # Defines the main `process` function taking a Flask app instance and plugin configuration + # Store plugin configuration (defaults to empty dict) app.config['B4ULeave'] = plugin_config or {} @app.after_request def add_B4ULeave(response: Response) -> Response: + # Decorator that registers a function to run after each request is processed if 'text/html' in response.headers.get('Content-Type', ''): - # kod wstrzykiwany przed + # Function receives a Response object and returns a modified Response html = f""" -
-
-

Czy na pewno chcesz
opuścić naszą stronę?

-
- - +
+
+

{message}

+
+ +
""" - response.set_data(response.get_data(as_text=True).replace('', html + '')) + response.set_data( + response.get_data(as_text=True).replace("", html + "") + ) return response - # temporary route for testing purposes - # this route ensures that the plugin can modify a simple HTML response - # def index(): - # return "Hello" - # app.route("/")(index) - return app - \ No newline at end of file diff --git a/tests/unit_tests/test_b4uleave.py b/tests/unit_tests/test_b4uleave.py index a126722..d310b26 100644 --- a/tests/unit_tests/test_b4uleave.py +++ b/tests/unit_tests/test_b4uleave.py @@ -20,7 +20,7 @@ def test_that_plugin_loads_b4uleave(): "config": { "message": "Your custom message goes here", "stay": "Staying custom message", - "leave": "Leaving custom message" + "leave": "Leaving custom message", }, } ], @@ -39,7 +39,7 @@ def test_that_plugin_loads_b4uleave(): app_with_plugin = create_app_from_config(config_with_plugin) response = app_with_plugin.test_client().get("/") - + assert response.status_code == 200 decoded_response = response.data.decode() assert b4uleave_function in decoded_response @@ -49,5 +49,5 @@ def test_that_plugin_loads_b4uleave(): assert '
Your custom message goes here

" in decoded_response - assert 'Staying custom message' in decoded_response - assert 'Leaving custom message' in decoded_response + assert "Staying custom message" in decoded_response + assert "Leaving custom message" in decoded_response From bae6b882be5f5e4e92bcbcc36446e94b7783d045 Mon Sep 17 00:00:00 2001 From: Milena Chowaniec Date: Fri, 11 Jul 2025 20:46:21 +0200 Subject: [PATCH 14/32] deleted unused Flask --- platzky_b4uleave/entrypoint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platzky_b4uleave/entrypoint.py b/platzky_b4uleave/entrypoint.py index 636a65a..20ae765 100644 --- a/platzky_b4uleave/entrypoint.py +++ b/platzky_b4uleave/entrypoint.py @@ -1,4 +1,4 @@ -from flask import Flask, Response +from flask import Response from typing import Any, Dict From 4c917ea3376bf34aef406fbd5d1b05fc2061de98 Mon Sep 17 00:00:00 2001 From: Milena Chowaniec Date: Fri, 11 Jul 2025 20:49:40 +0200 Subject: [PATCH 15/32] fix mistakes --- platzky_b4uleave/entrypoint.py | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/platzky_b4uleave/entrypoint.py b/platzky_b4uleave/entrypoint.py index 20ae765..b16cf1a 100644 --- a/platzky_b4uleave/entrypoint.py +++ b/platzky_b4uleave/entrypoint.py @@ -1,24 +1,17 @@ -from flask import Response +from flask import Flask, Response from typing import Any, Dict - -def process( - app, plugin_config: Dict[str, Any] -): # Defines the main 'process' function taking a Flask app instance and plugin configuration +def process(app, plugin_config: Dict[str, Any]): # Defines the main `process` function taking a Flask app instance and plugin configuration # Store plugin configuration (defaults to empty dict) - app.config["b4uleave"] = plugin_config or {} + app.config['b4uleave'] = plugin_config or {} - message = app.config["b4uleave"].get( - "message", "Czy na pewno chcesz
opuścić naszą stronę?" - ) - stay = app.config["b4uleave"].get("stay", "Stay") - leave = app.config["b4uleave"].get("leave", "Leave") + message = app.config['b4uleave'].get('message', 'Czy na pewno chcesz
opuścić naszą stronę?') + stay = app.config['b4uleave'].get('stay', 'Stay') + leave = app.config['b4uleave'].get('leave', 'Leave') - @app.after_request # Decorator that registers a function to run after each request is processed + @app.after_request # Decorator that registers a function to run after each request is processed def add_B4ULeave(response: Response) -> Response: - if "text/html" in response.headers.get( - "Content-Type", "" - ): # Function receives a Response object and returns a modified Response + if 'text/html' in response.headers.get('Content-Type', ''): # Function receives a Response object and returns a modified Response html = f""" + + +

Welcome to E2E Test

+

This page includes the B4ULeave plugin for testing.

+ + + """ + ) + + return app diff --git a/tests/e2e_tests/e2e_test_config.yml b/tests/e2e_tests/e2e_test_config.yml new file mode 100644 index 0000000..b5d3418 --- /dev/null +++ b/tests/e2e_tests/e2e_test_config.yml @@ -0,0 +1,21 @@ +APP_NAME: Bridges in Wroclaw +SECRET_KEY: SECRET +BLOG_PREFIX: "/blog" +DB: + TYPE: json_file + PATH: tests/e2e_tests/e2e_test_data.json + +#TODO this should not be necessary argument +LANGUAGES: + en: + name: English + flag: gb + country: GB + pl: + name: polski + flag: pl + country: PL + +FEATURE_FLAGS: + USE_LAZY_LOADING: True + SHOW_ACCESSIBILITY_TABLE: True \ No newline at end of file diff --git a/tests/e2e_tests/e2e_test_data.json b/tests/e2e_tests/e2e_test_data.json new file mode 100644 index 0000000..d25d2aa --- /dev/null +++ b/tests/e2e_tests/e2e_test_data.json @@ -0,0 +1,133 @@ +{ + "map": { + "data": [ + { + "name": "Grunwaldzki", + "position": [ + 51.1095, + 17.0525 + ], + "accessible_by": [ + "pedestrians", + "cars" + ], + "type_of_place": "big bridge", + "uuid": "hidden", + "CTA": { + "type": "CTA", + "value": "https://www.example.com", + "displayValue": "Visit example.org!" + } + }, + { + "name": "Zwierzyniecka", + "position": [ + 51.10655, + 17.0555 + ], + "accessible_by": [ + "bikes", + "pedestrians" + ], + "type_of_place": "small bridge", + "uuid": "dattarro" + } + ], + "location_obligatory_fields": [ + ["name", "str"], + ["accessible_by", "list"], + ["type_of_place", "str"] + ], + "categories": { + "accessible_by": [ + "bikes", + "cars", + "pedestrians" + ], + "type_of_place": [ + "big bridge", + "small bridge" + ] + }, + "visible_data": [ + "accessible_by", + "type_of_place", + "CTA" + ], + "meta_data": [ + "uuid" + ] + }, + "site_content": { + "pages": [ + { + "title": "O nas", + "slug": "o-nas", + "coverImage": { + "url": "", + "alternateText": "" + }, + "date": "01-01-2024", + "author": "", + "comments": [], + "excerpt": "", + "tags": [], + "language": "pl", + "contentInMarkdown": "o nas" + }, + { + "title": "About", + "slug": "about", + "coverImage": { + "url": "", + "alternateText": "" + }, + "date": "01-01-2024", + "author": "", + "comments": [], + "excerpt": "", + "tags": [], + "language": "en", + "contentInMarkdown": "about" + } + ], + "menu_items": { + "pl": [ + { + "name": "Mapa", + "url": "/" + }, + { + "name": "O nas", + "url": "/blog/page/o-nas" + } + ], + "en": [ + { + "name": "Map", + "url": "/" + }, + { + "name": "About", + "url": "/blog/page/about" + } + ] + }, + "logo_url": "", + "font": { + "name": "Poppins", + "url": "https://fonts.googleapis.com/css2?family=Poppins" + }, + "primary_color": "#FFFFFF", + "secondary_color": "#245466", + "left_bar_width": "300px" + }, + "plugins": [ + { + "name": "msgbar", + "config": { + "message": "Your custom message goes here" + } + } + ] +} From 8e4efaacf19ef1c8f26c15b76c9236054c45626c Mon Sep 17 00:00:00 2001 From: Milena Chowaniec Date: Fri, 5 Sep 2025 21:21:42 +0200 Subject: [PATCH 30/32] tests fix --- .github/workflows/tests.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6bf0aca..25da82d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,11 +4,11 @@ on: pull_request: branches: - main - - addedUnitTest + - feature/plugin-with-tests push: branches: - main - - addedUnitTest + - feature/plugin-with-tests permissions: contents: 'read' @@ -27,7 +27,6 @@ jobs: python -m pip install --upgrade pip pip install poetry==1.7.1 poetry install - - name: Run linters run: make lint-check @@ -44,10 +43,12 @@ jobs: run: | npm install cypress - - name: Run Flask server in background + - name: Run e2e tests run: | - poetry run flask --app "platzky.platzky:create_app(config_path='tests/e2e_tests/e2e_test_config.yml')" run --debug & + poetry run flask --app "tests.e2e_tests.e2e_app:create_app(config_path='tests/e2e_tests/e2e_test_config.yml')" run --debug --host=localhost & + sleep 6 + cd tests/e2e_tests && npx cypress run --spec "cypress/e2e/**/*" + + + - - name: Run Cypress tests - working-directory: tests/e2e_tests - run: npx cypress run --spec "cypress/e2e/**/*" From 56247d6ae1353bbafec034e25d486dab67a9c6a4 Mon Sep 17 00:00:00 2001 From: Milena Chowaniec Date: Fri, 5 Sep 2025 21:22:13 +0200 Subject: [PATCH 31/32] tests fix --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 25da82d..258e74b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,11 +4,11 @@ on: pull_request: branches: - main - - feature/plugin-with-tests + - addedUnitTest push: branches: - main - - feature/plugin-with-tests + - addedUnitTest permissions: contents: 'read' From 2f79ff465b474d0d9ad5fddeb0e8f6b8b1238126 Mon Sep 17 00:00:00 2001 From: Milena Chowaniec Date: Fri, 5 Sep 2025 21:25:21 +0200 Subject: [PATCH 32/32] e2e data dix --- tests/e2e_tests/cypress.config.js | 2 +- tests/e2e_tests/e2e_test_data.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e_tests/cypress.config.js b/tests/e2e_tests/cypress.config.js index f9b24c9..10ece9e 100644 --- a/tests/e2e_tests/cypress.config.js +++ b/tests/e2e_tests/cypress.config.js @@ -2,7 +2,7 @@ const { defineConfig } = require("cypress"); module.exports = defineConfig({ e2e: { - baseUrl: 'http://www.goodmap.localhost:5000/', + baseUrl: 'http://localhost:5000/', setupNodeEvents(on, config) { return config }, diff --git a/tests/e2e_tests/e2e_test_data.json b/tests/e2e_tests/e2e_test_data.json index d25d2aa..7aa3b55 100644 --- a/tests/e2e_tests/e2e_test_data.json +++ b/tests/e2e_tests/e2e_test_data.json @@ -124,7 +124,7 @@ }, "plugins": [ { - "name": "msgbar", + "name": "b4uleave", "config": { "message": "Your custom message goes here" }