Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions .github/workflows/test-prs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ jobs:
env:
DJANGO_SETTINGS_MODULE: apps.openunited.settings.development
DJANGO_SECRET_KEY: 123456789
- name: Upload screenshot on failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: screenshot
path: screenshot.png
# - name: Lint with Black (Check)
# # We are installing Black with requirements.txt
# run: black --check .
12 changes: 3 additions & 9 deletions apps/commerce/migrations/0002_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="productaccountcredit",
name="actioned_by",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="talent.person"
),
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="talent.person"),
),
migrations.AddField(
model_name="productaccountcredit",
Expand Down Expand Up @@ -203,16 +201,12 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="contributoraccount",
name="owner",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="talent.person"
),
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="talent.person"),
),
migrations.AddField(
model_name="cart",
name="creator",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="talent.person"
),
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="talent.person"),
),
migrations.AddField(
model_name="cart",
Expand Down
4 changes: 1 addition & 3 deletions apps/product_management/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,7 @@ class Migration(migrations.Migration):
("uuid", models.UUIDField(default=uuid.uuid4, editable=False)),
(
"photo",
models.ImageField(
blank=True, null=True, upload_to="avatars/"
),
models.ImageField(blank=True, null=True, upload_to="avatars/"),
),
("name", models.TextField()),
("short_description", models.TextField()),
Expand Down
8 changes: 2 additions & 6 deletions apps/product_management/migrations/0002_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="idea",
name="person",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="talent.person"
),
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="talent.person"),
),
migrations.AddField(
model_name="idea",
Expand Down Expand Up @@ -228,9 +226,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="bounty",
name="expertise",
field=models.ManyToManyField(
related_name="bounty_expertise", to="talent.expertise"
),
field=models.ManyToManyField(related_name="bounty_expertise", to="talent.expertise"),
),
migrations.AddField(
model_name="bounty",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="product",
name="photo",
field=models.ImageField(
blank=True, null=True, upload_to="products/"
),
field=models.ImageField(blank=True, null=True, upload_to="products/"),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="capability",
name="description",
field=models.TextField(
blank=True, default="", max_length=1000, null=True
),
field=models.TextField(blank=True, default="", max_length=1000, null=True),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ class Migration(migrations.Migration):
(
"id",
models.UUIDField(
default=uuid.UUID(
"09332c8a-0484-43c7-b283-42e07798686e"
),
default=uuid.UUID("09332c8a-0484-43c7-b283-42e07798686e"),
primary_key=True,
serialize=False,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="productareaattachment",
name="file",
field=models.FileField(
blank=True, null=True, upload_to="attachments"
),
field=models.FileField(blank=True, null=True, upload_to="attachments"),
),
migrations.RemoveField(
model_name="productareaattachment",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,15 @@
def forward_func(apps, schema_editor):
Bounty = apps.get_model("product_management.Bounty")
for bounty in Bounty.objects.all():
expertise_as_str = ", ".join(
[exp.name.title() for exp in bounty.expertise.all()]
)
expertise_as_str = ", ".join([exp.name.title() for exp in bounty.expertise.all()])
skill_name = ""
if expertise_as_str:
expertise_as_str = f"({expertise_as_str})"

if bounty.skill:
skill_name = bounty.skill.name

bounty.title = (
f"{skill_name} {expertise_as_str} - {bounty.challenge.title}"
)
bounty.title = f"{skill_name} {expertise_as_str} - {bounty.challenge.title}"
bounty.save()


Expand Down
4 changes: 1 addition & 3 deletions apps/security/migrations/0002_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name="productroleassignment",
name="person",
field=models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE, to="talent.person"
),
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to="talent.person"),
),
migrations.AddField(
model_name="productroleassignment",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="productroleassignment",
name="person",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="talent.person"
),
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="talent.person"),
),
]
8 changes: 2 additions & 6 deletions apps/talent/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ class Migration(migrations.Migration):
("preferred_name", models.CharField(max_length=128)),
(
"photo",
models.ImageField(
blank=True, null=True, upload_to="avatars/"
),
models.ImageField(blank=True, null=True, upload_to="avatars/"),
),
("headline", models.TextField()),
("overview", models.TextField(blank=True)),
Expand Down Expand Up @@ -208,9 +206,7 @@ class Migration(migrations.Migration):
("website", models.CharField(max_length=200)),
(
"type",
models.IntegerField(
choices=[(0, "Personal"), (1, "Company")]
),
models.IntegerField(choices=[(0, "Personal"), (1, "Company")]),
),
(
"person",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="bountydeliveryattempt",
name="person",
field=models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="talent.person"
),
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="talent.person"),
),
migrations.DeleteModel(
name="BountyDeliveryAttachment",
Expand Down
26 changes: 0 additions & 26 deletions e2e/base.py

This file was deleted.

1 change: 1 addition & 0 deletions e2e/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from e2e.fixtures import *
85 changes: 85 additions & 0 deletions e2e/fixtures.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import os
import pytest
from model_bakery import baker
from playwright.sync_api import sync_playwright
from django.utils import timezone


@pytest.fixture(scope="module")
def playwright_context():
os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "true"
playwright = sync_playwright().start()
yield playwright
playwright.stop()


@pytest.fixture
def browser_context(playwright_context):
# browser = playwright_context.chromium.launch(headless=False,slow_mo=300)
browser = playwright_context.chromium.launch()
yield browser
browser.close()


@pytest.fixture
def page_context(browser_context):
page = browser_context.new_page()
yield page


@pytest.fixture
def create_user(db):
username = "testuser"
password = "12345"
first_name = "Test"
last_name = "User"
full_name = f"{first_name} {last_name}"

user = baker.make(
"security.User",
username=username,
password=password,
first_name=first_name,
last_name=last_name,
)
user.set_password(password)
user.save()
person = baker.make("talent.Person", user=user, photo="image.png", full_name=full_name)

return user, username, password, person


@pytest.fixture
def setup_bounty(db, create_user):
user, username, password, person = create_user

now = timezone.now()
product = baker.make(
"product_management.Product",
name="PetConnect",
slug="petconnect",
created_at=now,
updated_at=now,
)
product_tree = baker.make("product_management.ProductTree", product=product, name="PetConnect Tree")
product_area = baker.make("product_management.ProductArea", product_tree=product_tree, name="PetConnect Area")
initiative = baker.make("product_management.Initiative", product=product, name="PetConnect Service Integration")
challenge = baker.make(
"product_management.Challenge",
product_area=product_area,
initiative=initiative,
product=product,
status="Active",
title="Pet Emergency Alert System",
short_description="Introduce pet grooming scheduler feature.",
priority="High",
created_by=person,
)
bounty = baker.make(
"product_management.Bounty",
challenge=challenge,
title="Pet Sitting Made Easy",
status="Available",
description="Information Systems & Networking (Python)",
)
return product, challenge, bounty, person, username, password
7 changes: 7 additions & 0 deletions e2e/helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from e2e.pages.login_page import LoginPage


def login_user(page, live_server_url, username, password):
login_page = LoginPage(page)
login_page.navigate(f"{live_server_url}{login_page.url}")
login_page.login(username, password)
24 changes: 24 additions & 0 deletions e2e/pages/challenge_details_page.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from e2e.pages.base import BasePage


class ChallengeDetailPage(BasePage):
def __init__(self, page):
super().__init__(page)
self.bounty_add_btn = self.page.locator("#bounty-add-btn")
self.expected_submission_date = self.page.locator("#expected_submission_date")
self.terms_check_box = self.page.locator("#is_agreement_accepted")
self.request_claim_button = self.page.locator('button[class="ajs-button ajs-ok"]')

def get_challenge_detail_button(self, product_slug, challenge_id):
href_value = f"/{product_slug}/challenge/{challenge_id}"
return self.page.locator(f'a[href="{href_value}"].relative')

def get_bounty_claim_button(self, bounty_id):
href_value = f"/bounty-claim/{bounty_id}/"
return self.page.locator(f'button[hx-post="{href_value}"]')

def get_actions_dropdown(self, bounty_id):
return self.page.locator(f"#dropdownHoverButton_{bounty_id}")

def get_cancel_request_button(self, bounty_claim_id):
return self.page.locator(f'a[hx-post="/bounty_claim/delete/{bounty_claim_id}"]')
3 changes: 1 addition & 2 deletions e2e/pages/login_page.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from .base import BasePage
from e2e.pages.base import BasePage


class LoginPage(BasePage):
def __init__(self, page):
super().__init__(page)
# self.url = "/sign-in/?next=/dashboard/"
self.url = "/sign-in/"
self.username_field = self.page.locator("#id_username_or_email")
self.password_field = self.page.locator("#id_password")
Expand Down
20 changes: 0 additions & 20 deletions e2e/test_login.py

This file was deleted.

14 changes: 0 additions & 14 deletions e2e/test_signup.py

This file was deleted.

Loading