Work on Testing part, fixed the ui part and add translation for notification

This commit is contained in:
Deepak Singh Gusain 2022-01-03 16:31:00 +05:30
parent 7e30e2263a
commit ea66c3f723
21 changed files with 96 additions and 94 deletions

View File

@ -29,7 +29,7 @@
</div>
<div class="notif-content">
<a :href="`${orderViewUrl}${notification.order_id}`">
#{{ notification.order.id }} {{ordertype.pending.message}}
#{{ notification.order.id }} {{orderTypeMessages.pending}}
</a>
</div>
<div class="notif-content">
@ -42,7 +42,7 @@
</div>
<div class="notif-content">
<a :href="`${orderViewUrl}${notification.order_id}`">
#{{ notification.order.id }} {{ordertype.canceled.message}}
#{{ notification.order.id }} {{orderTypeMessages.canceled}}
</a>
</div>
<div class="notif-content">
@ -55,7 +55,7 @@
</div>
<div class="notif-content">
<a :href="`${orderViewUrl}${notification.order_id}`">
#{{ notification.order.id }} {{ordertype.completed.message}}
#{{ notification.order.id }} {{orderTypeMessages.completed}}
</a>
</div>
<div class="notif-content">
@ -68,7 +68,7 @@
</div>
<div class="notif-content">
<a :href="`${orderViewUrl}${notification.order_id}`">
#{{ notification.order.id }} {{ordertype.processing.message}}
#{{ notification.order.id }} {{orderTypeMessages.processing}}
</a>
</div>
<div class="notif-content">
@ -81,7 +81,7 @@
</div>
<div class="notif-content">
<a :href="`${orderViewUrl}${notification.order_id}`">
#{{ notification.order.id }} {{ordertype.closed.message}}
#{{ notification.order.id }} {{orderTypeMessages.closed}}
</a>
</div>
<div class="notif-content">
@ -113,7 +113,8 @@
'pusherCluster',
'title',
'orderStatus',
'noRecordText'
'noRecordText',
'orderStatusMessages'
],
data: function() {
@ -144,7 +145,8 @@
message: 'Order Closed'
},
},
orderTypeStatus: JSON.parse(this.orderStatus)
orderTypeStatus: JSON.parse(this.orderStatus),
orderTypeMessages: JSON.parse(this.orderStatusMessages)
}
},

View File

@ -15,7 +15,7 @@
</div>
<div class="notif-content">
<a :href="`${orderViewUrl}${notification.order_id}`">
#{{ notification.order.id }} {{ordertype.pending.message}}
#{{ notification.order.id }} {{orderTypeMessages.pending}}
</a>
</div>
<div class="notif-content">
@ -28,7 +28,7 @@
</div>
<div class="notif-content">
<a :href="`${orderViewUrl}${notification.order_id}`">
#{{ notification.order.id }} {{ordertype.canceled.message}}
#{{ notification.order.id }} {{orderTypeMessages.canceled}}
</a>
</div>
<div class="notif-content">
@ -41,7 +41,7 @@
</div>
<div class="notif-content">
<a :href="`${orderViewUrl}${notification.order_id}`">
#{{ notification.order.id }} {{ordertype.completed.message}}
#{{ notification.order.id }} {{orderTypeMessages.completed}}
</a>
</div>
<div class="notif-content">
@ -54,7 +54,7 @@
</div>
<div class="notif-content">
<a :href="`${orderViewUrl}${notification.order_id}`">
#{{ notification.order.id }} {{ordertype.processing.message}}
#{{ notification.order.id }} {{orderTypeMessages.processing}}
</a>
</div>
<div class="notif-content">
@ -67,7 +67,7 @@
</div>
<div class="notif-content">
<a :href="`${orderViewUrl}${notification.order_id}`">
#{{ notification.order.id }} {{ordertype.closed.message}}
#{{ notification.order.id }} {{orderTypeMessages.closed}}
</a>
</div>
<div class="notif-content">
@ -98,7 +98,8 @@ export default {
'title',
'viewAllTitle',
'getReadAllUrl',
'readAllTitle'
'readAllTitle',
'orderStatusMessages'
],
data(){
@ -127,13 +128,16 @@ export default {
message: 'Order Closed'
}
},
totalUnRead: 0
totalUnRead: 0,
orderTypeMessages:JSON.parse(this.orderStatusMessages)
}
},
mounted(){
this.getNotification();
console.log(this.orderTypeMessages);
if(this.pusherKey != undefined && this.pusherCluster != undefined){
Echo = new Echo({
broadcaster: 'pusher',
@ -147,7 +151,6 @@ export default {
});
Echo.channel('notification').listen('.update-notification', (e) => {
console.log(e);
this.notifications.forEach((notification)=>{
if(notification.order_id == e.id){
notification.order.status = e.status;

View File

@ -11,6 +11,7 @@
.navbar-top-left {
background-color: #071e37;
border-bottom: 1px solid $seprator;
}
.profile-info {

View File

@ -1603,6 +1603,13 @@ return [
'view-all' => 'View All Notifications',
'no-record' => 'No Record Found',
'read-all' => 'Mark as Read',
'notification-marked-success' => 'Notification Marked Successfully'
'notification-marked-success' => 'Notification Marked Successfully',
'order-status-messages' => [
'completed' => 'Order Completed',
'closed' => 'Order Closed',
'canceled' => 'Order Canceled',
'pending' => 'Order Pending',
'processing' => 'Order Processing',
]
],
];

View File

@ -1,3 +1,13 @@
@php
$orderStatusMessages = [
'pending' => trans('admin::app.notification.order-status-messages.pending'),
'canceled'=> trans('admin::app.notification.order-status-messages.canceled'),
'closed' => trans('admin::app.notification.order-status-messages.closed'),
'completed'=> trans('admin::app.notification.order-status-messages.completed'),
'processing' => trans('admin::app.notification.order-status-messages.processing')
];
@endphp
<div class="navbar-top">
<div class="navbar-top-left">
@include ('admin::layouts.mobile-nav')
@ -38,6 +48,7 @@
title="{{ __('admin::app.notification.title-plural') }}"
view-all-title="{{ __('admin::app.notification.view-all') }}"
get-read-all-url="{{ route('admin.notification.read-all') }}"
order-status-messages="{{ json_encode($orderStatusMessages) }}"
read-all-title="{{ __('admin::app.notification.read-all') }}">
</notification>

View File

@ -13,6 +13,14 @@
'completed'=> trans('admin::app.notification.status.completed'),
'processing' => trans('admin::app.notification.status.processing')
];
$orderStatusMessages = [
'pending' => trans('admin::app.notification.order-status-messages.pending'),
'canceled'=> trans('admin::app.notification.order-status-messages.canceled'),
'closed' => trans('admin::app.notification.order-status-messages.closed'),
'completed'=> trans('admin::app.notification.order-status-messages.completed'),
'processing' => trans('admin::app.notification.order-status-messages.processing')
];
@endphp
@push('css')
@ -47,6 +55,7 @@
pusher-cluster="{{ env('PUSHER_APP_CLUSTER') }}"
title=" {{ __('admin::app.notification.title') }}"
order-status="{{ json_encode($orderStatus) }}"
order-status-messages="{{ json_encode($orderStatusMessages) }}"
no-record-text="{{ __('admin::app.notification.no-record') }}">
</notification-list>
@endsection

View File

@ -36,7 +36,7 @@ class NotificationRepository extends Repository
});
})->with('order')->paginate(10): $this->model->with('order')->latest()->paginate(10);
}elseif(isset($params['limit'])){
return $this->model->limit($params['limit'])->with('order')->latest()->paginate(10);
return $this->model->limit($params['limit'])->with('order')->latest()->paginate($params['limit']);
}elseif(isset($params['id'])){
return $this->model->where('order_id',$params['id'])->with('order')->paginate(10);
}

View File

@ -18,13 +18,11 @@ class AttributeCest
$attribute = $I->have(Attribute::class);
$I->loginAsAdmin();
$I->amOnAdminRoute('admin.dashboard.index');
$I->click(__('admin::app.layouts.catalog'), '//*[contains(@class, "navbar-left")]');
$I->click(__('admin::app.layouts.attributes'), '//*[contains(@class, "aside-nav")]');
$I->amOnAdminRoute('admin.catalog.attributes.index');
$I->seeCurrentRouteIs('admin.catalog.attributes.index');
$I->see($attribute->id, '//script[@type="text/x-template"]');
$I->see($attribute->admin_name, '//script[@type="text/x-template"]');
$I->see("{$attribute->id}", '//script[@type="text/x-template"]');
}
/**

View File

@ -11,14 +11,12 @@ class AttributeFamilyCest
{
$attributeFamily = $I->have(AttributeFamily::class);
$I->loginAsAdmin();
$I->amOnAdminRoute('admin.dashboard.index');
$I->click(__('admin::app.layouts.catalog'), '//*[contains(@class, "navbar-left")]');
$I->click(__('admin::app.layouts.attribute-families'), '//*[contains(@class, "aside-nav")]');
$I->loginAsAdmin();
$I->amOnAdminRoute('admin.catalog.families.index');
$I->seeCurrentRouteIs('admin.catalog.families.index');
$I->see($attributeFamily->id, '//script[@type="text/x-template"]');
$I->see($attributeFamily->name, '//script[@type="text/x-template"]');
$I->see("{$attributeFamily->id}", '//script[@type="text/x-template"]');
}
public function testCreate(FunctionalTester $I): void

View File

@ -12,12 +12,10 @@ class CategoryCest
$category = $I->have(Category::class);
$I->loginAsAdmin();
$I->amOnAdminRoute('admin.dashboard.index');
$I->click(__('admin::app.layouts.catalog'), '//*[contains(@class, "navbar-left")]');
$I->click(__('admin::app.layouts.categories'), '//*[contains(@class, "aside-nav")]');
$I->amOnAdminRoute('admin.catalog.categories.index');
$I->seeCurrentRouteIs('admin.catalog.categories.index');
$I->see($category->id, '//script[@type="text/x-template"]');
$I->see($category->name, '//script[@type="text/x-template"]');
$I->see("{$category->id}", '//script[@type="text/x-template"]');
}
}

View File

@ -76,14 +76,11 @@ class ProductCest
$product = $I->haveProduct(Laravel5Helper::SIMPLE_PRODUCT, [], ['simple']);
$I->loginAsAdmin();
$I->amOnAdminRoute('admin.dashboard.index');
$I->click(__('admin::app.layouts.catalog'), '//*[contains(@class, "navbar-left")]');
$I->seeCurrentRouteIs('admin.catalog.products.index');
$I->click(__('admin::app.layouts.products'), '//*[contains(@class, "aside-nav")]');
$I->amOnAdminRoute('admin.catalog.products.index');
$I->seeCurrentRouteIs('admin.catalog.products.index');
$I->see($product->id, '//script[@type="text/x-template"]');
$I->see($product->name, '//script[@type="text/x-template"]');
$I->see("{$product->id}", '//script[@type="text/x-template"]');
}
public function selectEmptyAttributeOptionOnProductCreation(FunctionalTester $I): void

View File

@ -12,14 +12,11 @@ class CustomerCest
$customer = $I->have(Customer::class);
$I->loginAsAdmin();
$I->amOnAdminRoute('admin.dashboard.index');
$I->click(__('admin::app.layouts.customers'), '//*[contains(@class, "navbar-left")]');
$I->amOnAdminRoute('admin.customer.index');
$I->seeCurrentRouteIs('admin.customer.index');
$I->click(__('admin::app.layouts.customers'), '//*[contains(@class, "aside-nav")]');
$I->seeCurrentRouteIs('admin.customer.index');
$I->see($customer->id, '//script[@type="text/x-template"]');
$I->see($customer->last_name, '//script[@type="text/x-template"]');
$I->see("{$customer->id}", '//script[@type="text/x-template"]');
}
public function testCreate(FunctionalTester $I): void

View File

@ -12,12 +12,10 @@ class GroupsCest
$group = $I->have(CustomerGroup::class);
$I->loginAsAdmin();
$I->amOnAdminRoute('admin.dashboard.index');
$I->click(__('admin::app.layouts.customers'), '//*[contains(@class, "navbar-left")]');
$I->click(__('admin::app.layouts.groups'), '//*[contains(@class, "aside-nav")]');
$I->amOnAdminRoute('admin.groups.index');
$I->seeCurrentRouteIs('admin.groups.index');
$I->see($group->id, '//script[@type="text/x-template"]');
$I->see($group->name, '//script[@type="text/x-template"]');
$I->see("{$group->id}", '//script[@type="text/x-template"]');
}
}

View File

@ -12,13 +12,10 @@ class NewsletterSubscriptionCest
$subscriber = $I->have(SubscribersList::class);
$I->loginAsAdmin();
$I->amOnAdminRoute('admin.dashboard.index');
$I->click(__('admin::app.layouts.marketing'), '//*[contains(@class, "navbar-left")]');
$I->click(__('admin::app.layouts.email-marketing'), '//*[contains(@class, "aside-nav")]');
$I->click(__('admin::app.layouts.newsletter-subscriptions'), '//*[contains(@class, "tabs")]');
$I->amOnAdminRoute('admin.customers.subscribers.index');
$I->seeCurrentRouteIs('admin.customers.subscribers.index');
$I->see($subscriber->id, '//script[@type="text/x-template"]');
$I->see($subscriber->email, '//script[@type="text/x-template"]');
$I->see("{$subscriber->id}", '//script[@type="text/x-template"]');
}
}

View File

@ -14,12 +14,10 @@ class ReviewCest
$review = $I->have(ProductReview::class, ['product_id' => $product->id]);
$I->loginAsAdmin();
$I->amOnAdminRoute('admin.dashboard.index');
$I->click(__('admin::app.layouts.customers'), '//*[contains(@class, "navbar-left")]');
$I->click(__('admin::app.layouts.reviews'), '//*[contains(@class, "aside-nav")]');
$I->amOnAdminRoute('admin.customer.review.index');
$I->seeCurrentRouteIs('admin.customer.review.index');
$I->see($review->id, '//script[@type="text/x-template"]');
$I->see($review->title, '//script[@type="text/x-template"]');
$I->see("{$review->id}", '//script[@type="text/x-template"]');
}
}

View File

@ -18,11 +18,10 @@ class InvoiceCest
]);
$I->loginAsAdmin();
$I->amOnAdminRoute('admin.dashboard.index');
$I->click(__('admin::app.layouts.sales'), '//*[contains(@class, "navbar-left")]');
$I->click(__('admin::app.layouts.invoices'), '//*[contains(@class, "aside-nav")]');
$I->amOnAdminRoute('admin.sales.invoices.index');
$I->seeCurrentRouteIs('admin.sales.invoices.index');
$I->see($invoice->id, '//script[@type="text/x-template"]');
$I->see("{$invoice->id}", '//script[@type="text/x-template"]');
}
}

View File

@ -19,10 +19,8 @@ class OrderCest
$I->loginAsAdmin();
/* go to order view page */
$I->amOnAdminRoute('admin.dashboard.index');
$I->click(__('admin::app.layouts.sales'), '//*[contains(@class, "navbar-left")]');
$I->amOnAdminRoute('admin.sales.orders.index');
$I->seeCurrentRouteIs('admin.sales.orders.index');
$I->click(__('admin::app.layouts.orders'), '//*[contains(@class, "aside-nav")]');
/* now test index page */
$I->seeCurrentRouteIs('admin.sales.orders.index');
@ -44,7 +42,7 @@ class OrderCest
$I->see('Cancel', Locator::href(route('admin.sales.orders.cancel', $order->id)));
$I->click('Cancel', Locator::href(route('admin.sales.orders.cancel', $order->id)));
$I->seeCurrentRouteIs('admin.sales.orders.view');
$I->see(0.00, '#due-amount-on-cancelled');
$I->see("0.00", '#due-amount-on-cancelled');
}
private function generateCashOnDeliveryOrder(FunctionalTester $I)

View File

@ -12,11 +12,10 @@ class RefundCest
$refund = $I->have(Refund::class);
$I->loginAsAdmin();
$I->amOnAdminRoute('admin.dashboard.index');
$I->click(__('admin::app.layouts.sales'), '//*[contains(@class, "navbar-left")]');
$I->click(__('admin::app.layouts.refunds'), '//*[contains(@class, "aside-nav")]');
$I->amOnAdminRoute('admin.sales.refunds.index');
$I->seeCurrentRouteIs('admin.sales.refunds.index');
$I->see($refund->id, '//script[@type="text/x-template"]');
$I->see("{$refund->id}", '//script[@type="text/x-template"]');
}
}

View File

@ -12,12 +12,11 @@ class ShipmentsCest
$shipment = $I->have(Shipment::class);
$I->loginAsAdmin();
$I->amOnAdminRoute('admin.dashboard.index');
$I->click(__('admin::app.layouts.sales'), '//*[contains(@class, "navbar-left")]');
$I->click(__('admin::app.layouts.shipments'), '//*[contains(@class, "aside-nav")]');
$I->amOnAdminRoute('admin.sales.shipments.index');
$I->seeCurrentRouteIs('admin.sales.shipments.index');
$I->see($shipment->id, '//script[@type="text/x-template"]');
$I->see($shipment->total_qty, '//script[@type="text/x-template"]');
$I->see("{$shipment->id}", '//script[@type="text/x-template"]');
$I->see("{$shipment->total_qty}", '//script[@type="text/x-template"]');
}
}

View File

@ -15,11 +15,8 @@ class ExchangeRatesCest
public function testIndex(FunctionalTester $I): void
{
$I->loginAsAdmin();
$I->amOnAdminRoute('admin.dashboard.index');
$I->click(__('admin::app.layouts.settings'), '//*[contains(@class, "navbar-left")]');
$I->click(__('admin::app.layouts.exchange-rates'), '//*[contains(@class, "aside-nav")]');
$I->amOnAdminRoute('admin.exchange_rates.index');
$I->seeCurrentRouteIs('admin.exchange_rates.index');
}
}

View File

@ -17,11 +17,7 @@ class UsersCest
{
$I->loginAsAdmin();
$I->amOnAdminRoute('admin.dashboard.index');
$I->click(__('admin::app.layouts.settings'), '//*[contains(@class, "navbar-left")]');
$I->click(__('admin::app.layouts.users'), '//*[contains(@class, "aside-nav")]');
$I->seeCurrentRouteIs('admin.users.index');
$I->seeCurrentRouteIs('admin.dashboard.index');
}
/**