Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
df4736f
#1226 changing the new subscribers email template sent to shop owners
joeltejeda Aug 24, 2023
a8bbd1d
Merge branch 'master' of github.com:Subscribie/subscribie into 1226-a…
joeltejeda Aug 25, 2023
6f660b6
adding new subscriber email template test
joeltejeda Aug 28, 2023
9bd1e15
skipping black format
joeltejeda Aug 28, 2023
df13f5b
filtering by subscriber name
joeltejeda Aug 29, 2023
df8ab4a
updating onboarding
joeltejeda Aug 29, 2023
7797a97
removing some tests
joeltejeda Aug 31, 2023
5f1a9c6
Merge branch 'master' of github.com:Subscribie/subscribie into 1226-a…
joeltejeda Sep 6, 2023
e92d813
adding tests
joeltejeda Sep 6, 2023
b255108
adding env variable for workflow
joeltejeda Sep 6, 2023
dd85da1
changing test order
joeltejeda Sep 6, 2023
d909837
testing
joeltejeda Sep 6, 2023
41c196b
Merge branch 'master' of github.com:Subscribie/subscribie into 1226-a…
joeltejeda Sep 8, 2023
5823689
black formatting
joeltejeda Sep 8, 2023
6603efd
waiting more time before checking email
joeltejeda Sep 8, 2023
1c2cf64
changing order of the plan and removing a flaky test
joeltejeda Sep 8, 2023
f52763d
removing email test
joeltejeda Sep 8, 2023
0d41c7d
adding the new subscirber email test back
joeltejeda Sep 9, 2023
4474889
Merge branch 'master' of github.com:Subscribie/subscribie into 1226-a…
joeltejeda Sep 23, 2023
042e9f3
removing unused tests and fixing 1226 test
joeltejeda Sep 23, 2023
a1191cf
adding 1226 test to the pipeline
joeltejeda Sep 23, 2023
01472c2
Merge branch 'master' of github.com:Subscribie/subscribie into 1226-a…
joeltejeda Sep 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/demo-videos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
RESET_PASSWORD_IMAP_SEARCH_SUBJECT: ${{ secrets.RESET_PASSWORD_IMAP_SEARCH_SUBJECT }}
IMAP_SEARCH_UNSEEN: "1"
IMAP_SEARCH_SINCE_DATE: "01-Jun-2022"

NEW_SUBSCRIBER_IMAP_SEARCH_SUBJECT: "new subscriber"
run: |
set -x
cp tests/browser-automated-tests-playwright/.env.example tests/browser-automated-tests-playwright/.env
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr-demo-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ jobs:
RESET_PASSWORD_IMAP_SEARCH_SUBJECT: ${{ secrets.RESET_PASSWORD_IMAP_SEARCH_SUBJECT }}
IMAP_SEARCH_UNSEEN: "1"
IMAP_SEARCH_SINCE_DATE: "01-Sep-2022"
NEW_SUBSCRIBER_IMAP_SEARCH_SUBJECT: "new subscriber"
run: |
set -x
cp tests/browser-automated-tests-playwright/.env.example tests/browser-automated-tests-playwright/.env
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/remove-inactive-pr-previews.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
head_ref = pull_request["head"]["ref"]
find_hyphen = head_ref.rfind("-")
head_ref = head_ref[:60].lower()
container_name = head_ref[:find_hyphen] + head_ref[find_hyphen + 1 :]
# fmt: off
container_name = head_ref[:find_hyphen] + head_ref[find_hyphen + 1:]
# fmt: on
print(
f"Pull Request #{pull_request_number} has a commit older than 3 days. Head ref: {head_ref}"
)
Expand Down
5 changes: 3 additions & 2 deletions subscribie/blueprints/checkout/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,9 @@ def create_subscription(
database.session.commit()
except Exception as e: # noqa
log.error("Could not set cancel_at: {e}")

newSubscriberEmailNotification()
subscriber_name = subscription.person.full_name
subscriber_plan = subscription.plan.title
newSubscriberEmailNotification(subscriber_name, subscriber_plan)
return subscription


Expand Down
8 changes: 6 additions & 2 deletions subscribie/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
log = logging.getLogger(__name__)


def newSubscriberEmailNotification(*args, **kwargs):
def newSubscriberEmailNotification(
subscriber_name=None, subscriber_plan=None, **kwargs
):
"""As a shop owner all shop admins email notification
when a new subscriber joins
https://github.com/Subscribie/subscribie/issues/602
Expand All @@ -21,7 +23,9 @@ def newSubscriberEmailNotification(*args, **kwargs):
msg["from"] = current_app.config["EMAIL_LOGIN_FROM"]
shopadmins = User.query.all() # all shop admins
msg["to"] = [user.email for user in shopadmins] # all shop admins
msg.set_content("you have a new subscriber!")
msg.set_content(
f"You have a new subscriber! \n\n Plan Title: {subscriber_plan} \n Subscriber Name: {subscriber_name}"
)
setting = Setting.query.first()
if setting.reply_to_email_address is not None:
msg["reply-to"] = setting.reply_to_email_address
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const { test, expect } = require('@playwright/test');
const checkNewSubscriberEmail= require('./checkNewSubscriberEmail.js');
const SUBSCRIBER_EMAIL_USER = process.env.SUBSCRIBER_EMAIL_USER;
const { admin_login } = require('./features/admin_login');

test('@1226@shop-owner@check new subscriber email @1226_shop-owner_check_new_subscriber_email', async ({ page }) => {

await admin_login(page);
await page.goto("/admin/add-shop-admin"); // Go to home before selecting product
await page.fill('[name=email]', SUBSCRIBER_EMAIL_USER);
await page.fill('[name=password]', 'password');
await page.click("text=Save");
console.log("Ordering plan with only recurring charge...");
// Buy item with subscription & upfront fee
await page.goto("/"); // Go to home before selecting product
await page.click('[name="Bath Soaps"]');

// Fill in order form
await page.fill('#given_name', 'John');
await page.fill('#family_name', 'Smith');
await page.fill('#email', 'hello@example.com');
await page.fill('#mobile', '07123456789');
await page.fill('#address_line_one', '123 Short Road');
await page.fill('#city', 'London');
await page.fill('#postcode', 'L01 T3U');
await page.click('.btn-primary-lg');
// Begin stripe checkout
const order_summary_content = await page.textContent(".title-1");
expect(order_summary_content === "Order Summary");
await page.click('#checkout-button');

//Verify first payment is correct (recuring charge only)
const payment_content = await page.textContent('div.mr2.flex-item.width-fixed');
expect(payment_content === "£10.99");
const recuring_charge_content = await page.textContent('.Text-fontSize--16');
expect(recuring_charge_content === "Subscribe to Bath Soaps");

// Pay with test card
await page.fill('#cardNumber', '4242 4242 4242 4242');
await page.fill('#cardExpiry', '04 / 24');
await page.fill('#cardCvc', '123');
await page.fill('#billingName', 'John Smith');
await page.selectOption('select#billingCountry', 'GB');
await page.fill('#billingPostalCode', 'LN1 7FH');
await page.click('.SubmitButton');
const order_complete_content = await page.textContent('.title-1');
expect(order_complete_content === "Order Complete!");
expect(await page.screenshot()).toMatchSnapshot('recurring-order-complete.png');

await new Promise(r => setTimeout(r, 10000));
checkNewSubscriberEmail.checkNewSubscriberEmail();
console.log("checking new subscriber email template");
await new Promise(r => setTimeout(r, 10000));
const subscriber_name = checkNewSubscriberEmail.subscriber_name;
expect(subscriber_name === "John Smith");

});

This file was deleted.

This file was deleted.

Loading