diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index ed6fa20..258e74b 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -33,7 +33,6 @@ jobs:
- name: Run unit-tests
run: make unit-tests
-# Set Node.js version to 18 for running Cypress and npm commands
- name: Set up Node.js
uses: actions/setup-node@v4
with:
@@ -44,31 +43,12 @@ jobs:
run: |
npm install cypress
-# Run all Cypress tests using default config
- - name: Run Cypress tests
- working-directory: tests/e2e_tests/e2e
- run: npx cypress run --spec "cypress/e2e/**/*"
-
- - name: Run Flask server in background
+ - name: Run e2e tests
run: |
- poetry run flask run &
- echo $! > flask_pid.txt
- sleep 3
-
-# Run Cypress tests specifying the folder with your test specs
- - name: Run Cypress tests
- run: npx cypress run --spec "tests/e2e_tests/cypress/e2e/**/*"
+ 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/**/*"
-# Stop the Flask server using the saved process ID
- - name: Stop Flask server
- run: kill $(cat flask_pid.txt)
- # - name: Run tests with coverage
- # run: make coverage
- # - name: Coveralls
- # uses: coverallsapp/github-action@v1
- # with:
- # path-to-lcov: "./coverage.lcov"
- # github-token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/README.md b/README.md
index cc52460..61646e9 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ The B4ULeave plugin displays a modal window asking the user whether they want to
## Installation
```sh
-pip install platzky-b4uLeave
+pip install platzky-b4uleave
```
## Usage
@@ -15,7 +15,7 @@ pip install platzky-b4uLeave
```json
"plugins": [
{
- "name": "b4uLeave",
+ "name": "b4uleave",
"config": {
"message": "Your custom message goes here",
"stay": "Staying custom message",
diff --git a/platzky_b4uleave/entrypoint.py b/platzky_b4uleave/entrypoint.py
index 7a411b7..45679ef 100644
--- a/platzky_b4uleave/entrypoint.py
+++ b/platzky_b4uleave/entrypoint.py
@@ -1,17 +1,24 @@
-from flask import Flask, Response
+from flask import 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"""
+
+
This page includes the B4ULeave plugin for testing.
+ +