Skip to content

Commit

Permalink
fix: setup as own project
Browse files Browse the repository at this point in the history
  • Loading branch information
cyl3x committed Feb 14, 2025
1 parent c88fa67 commit 3029332
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 40 deletions.
38 changes: 0 additions & 38 deletions tests/acceptance/fixtures/PayPalAccountFixture.ts

This file was deleted.

1 change: 0 additions & 1 deletion tests/acceptance/global.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import type { ShopAdminTasks } from '@tasks/ShopAdminTasks';
import type { ShopCustomerTasks } from '@tasks/ShopCustomerTasks';

interface TestFixtureTypes extends AdminPageTypes, StorefrontPageTypes, DataFixtureTypes, ShopAdminTasks, ShopCustomerTasks {
DefaultPayPalAccount: () => Promise<void>
}

declare global {
Expand Down
5 changes: 5 additions & 0 deletions tests/acceptance/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ export default defineConfig({
},

projects: [
{
name: 'PayPal Setup',
testMatch: /.*\.setup\.ts/,
use: { trace: 'off' },
},
{
name: 'PayPal',
use: {
Expand Down
35 changes: 35 additions & 0 deletions tests/acceptance/setup/paypal-account.setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// eslint-disable playwright/no-conditional-expect
import { test } from '@fixtures/AcceptanceTest';
import { expect } from '@shopware-ag/acceptance-test-suite';
import type * as PayPal from 'SwagPayPal/types';

test('PayPal Account setup', {}, async ({ AdminApiContext }) => {
const isSandbox = Boolean(process.env.PAYPAL_SANDBOX);
const prefix = isSandbox ? 'Sandbox' : '';
const clientId = String(process.env.PAYPAL_CLIENT_ID);
const clientSecret = String(process.env.PAYPAL_CLIENT_SECRET);
const merchantId = String(process.env.PAYPAL_MERCHANT_ID);

const response = await AdminApiContext.post('./_action/paypal/save-settings', {
data: {
null: {
[`SwagPayPal.settings.clientId${prefix}`]: clientId,
[`SwagPayPal.settings.clientSecret${prefix}`]: clientSecret,
[`SwagPayPal.settings.merchantPayerId${prefix}`]: merchantId,
'SwagPayPal.settings.sandbox': isSandbox,
},
},
});

expect(response.ok()).toBeTruthy();

const json = await response.json() as PayPal.Api.Operations<'saveSettings'>;

expect(json).toHaveProperty('null');

if (json.null.sandboxCredentialsChanged) {
expect(json.null.sandboxCredentialsValid).toBeTruthy();
} else if (json.null.liveCredentialsChanged) {
expect(json.null.liveCredentialsValid).toBeTruthy();
}
});
1 change: 0 additions & 1 deletion tests/acceptance/tests/Settings/ShippingCarrier.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { test } from '@fixtures/AcceptanceTest';

test('As an admin, I can select a standard carrier that is used to be displayed by PayPal', { tag: ['@Settings'] }, async ({
ShopAdmin,
DefaultPayPalAccount,
AdminShippingDetail,
TestDataService,
SetStandardCarrier,
Expand Down

0 comments on commit 3029332

Please sign in to comment.