Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bumped moltin sdk in all repos and d2c output #130

Merged
merged 32 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ae39e7c
feat: bumped moltin sdk in all repos and d2c output
field123 Nov 17, 2023
ed4821b
chore: changeset
field123 Nov 17, 2023
ebc756b
chore: generated latest examples
github-actions[bot] Nov 17, 2023
aec7220
build: generate examples now uses workspace prefix for monorepo depen…
field123 Nov 17, 2023
e85009b
chore: changeset
field123 Nov 17, 2023
d48cdec
build: use BASE_URL env var for testing on preview deploy
field123 Nov 17, 2023
998f7d6
build: use BASE_URL env var for testing on preview deploy
field123 Nov 17, 2023
4f333c9
build: try test
field123 Nov 18, 2023
e41e3db
build: install pnpm
field123 Nov 18, 2023
b7cc68e
build: terminated string
field123 Nov 18, 2023
9663741
build: testing if skipping in ci
field123 Nov 18, 2023
da7885c
build: testing if skipping in ci
field123 Nov 18, 2023
132488f
build: make test file for e2e
field123 Nov 19, 2023
bb36310
build: make test file for e2e
field123 Nov 19, 2023
4cb9462
build: make test file for e2e
field123 Nov 19, 2023
e9dc312
build: ci troubleshooting
field123 Nov 19, 2023
947a67d
build: ci troubleshooting
field123 Nov 19, 2023
c26c2cc
build: ci troubleshooting
field123 Nov 19, 2023
1c323bd
build: ci troubleshooting
field123 Nov 19, 2023
31937b4
build: ci troubleshooting
field123 Nov 19, 2023
a24d6cc
build: ci troubleshooting
field123 Nov 19, 2023
3aa0b4a
build: ci troubleshooting
field123 Nov 19, 2023
5e8352b
build: ci troubleshooting
field123 Nov 19, 2023
c6b5eea
build: ci troubleshooting
field123 Nov 19, 2023
c4c7cc0
build: ci troubleshooting
field123 Nov 19, 2023
2c1a8e2
build: ci troubleshooting
field123 Nov 19, 2023
4dc47c3
build: ci troubleshooting
field123 Nov 19, 2023
a484a8c
fix: check for text not for url
field123 Nov 20, 2023
eba2dba
fix: use correct label
field123 Nov 20, 2023
c7f0598
feat: disabled safari devices
field123 Nov 20, 2023
a1844dc
feat: apply changes to schematics
field123 Nov 20, 2023
5403bf8
feat: updated examples
field123 Nov 20, 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
9 changes: 9 additions & 0 deletions .changeset/gold-buttons-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@elasticpath/react-shopper-hooks": patch
"@elasticpath/composable-common": patch
"composable-cli": patch
"@elasticpath/d2c-schematics": patch
"@elasticpath/shopper-common": patch
---

bumped moltin sdk in all repos and d2c output
5 changes: 5 additions & 0 deletions .changeset/lemon-badgers-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@elasticpath/d2c-schematics": patch
---

bumped hooks and common dep version
11 changes: 7 additions & 4 deletions .github/workflows/generate-examples.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
name: Generate Examples

on:
push:
branches-ignore:
- main
- changeset-release/main
# push:
# branches-ignore:
# - main
# - changeset-release/main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
generate-examples:
if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success'
name: Create latest examples
runs-on: ubuntu-latest
outputs:
Expand Down Expand Up @@ -160,6 +161,8 @@ jobs:
run: pnpm test:e2e
id: examples-e2e-tests
continue-on-error: true
env:
BASE_URL: ${{ github.event.deployment_status.environment_url }}

- name: Upload test results
if: always()
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/run-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Run e2e tests

on:
deployment_status:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:
run-e2es:
if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success' && github.event.deployment_status.environment == 'Preview – composable-frontend-simple'
runs-on: ubuntu-latest
steps:
- uses: pnpm/action-setup@v2
with:
version: 8

- uses: actions/checkout@v3

- name: Install dependencies
run: pnpm install && npx playwright install --with-deps

- name: Make .env.test file
run: |
echo "NEXT_PUBLIC_EPCC_CLIENT_ID=${{secrets.E2E_NEXT_PUBLIC_EPCC_CLIENT_ID}}" > ./examples/simple/.env.test
echo "EPCC_CLIENT_SECRET=${{secrets.E2E_EPCC_CLIENT_SECRET}}" >> ./examples/simple/.env.test
echo "NEXT_PUBLIC_EPCC_ENDPOINT_URL=${{secrets.E2E_NEXT_PUBLIC_EPCC_ENDPOINT_URL}}" >> ./examples/simple/.env.test
echo "NEXT_PUBLIC_COOKIE_PREFIX_KEY=${{secrets.E2E_NEXT_PUBLIC_COOKIE_PREFIX_KEY}}" >> ./examples/simple/.env.test
echo "SITE_NAME=${{secrets.E2E_SITE_NAME}}" >> ./examples/simple/.env.test

- name: Run tests
run: pnpm test:e2e
env:
BASE_URL: ${{ github.event.deployment_status.environment_url }}

- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results-${{ github.sha }}-${{ github.run_number }}
path: examples/simple/test-results
4 changes: 0 additions & 4 deletions examples/algolia/e2e/home-page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import { createD2CHomePage } from "./models/d2c-home-page";
import { skipIfMissingCatalog } from "./util/missing-published-catalog";

test.describe("Home Page", async () => {
test.beforeEach(async () => {
await skipIfMissingCatalog();
});

test("should load home page", async ({ page }) => {
const d2cHomePage = createD2CHomePage(page);
await d2cHomePage.goto();
Expand Down
4 changes: 0 additions & 4 deletions examples/algolia/e2e/models/d2c-cart-page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import type { Locator, Page } from "@playwright/test";
import { expect } from "@playwright/test";
import { getCartId } from "../util/get-cart-id";

export interface D2CCartPage {
readonly page: Page;
Expand All @@ -20,8 +18,6 @@ export function createD2CCartPage(page: Page): D2CCartPage {
},
async checkoutCart() {
await checkoutBtn.click();
const cartId = await getCartId(page)();
await expect(page).toHaveURL(`/checkout/${cartId}`);
},
};
}
4 changes: 0 additions & 4 deletions examples/algolia/e2e/product-details-page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import { client } from "./util/epcc-client";
import { skipIfMissingCatalog } from "./util/missing-published-catalog";

test.describe("Product Details Page", async () => {
test.beforeEach(async () => {
await skipIfMissingCatalog();
});

test("should add a simple product to cart", async ({ page }) => {
const productDetailPage = createD2CProductDetailPage(page, client);

Expand Down
6 changes: 3 additions & 3 deletions examples/algolia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
},
"dependencies": {
"@algolia/react-instantsearch-widget-color-refinement-list": "^1.4.7",
"@elasticpath/react-shopper-hooks": "^0.5.1",
"@elasticpath/shopper-common": "^0.1.1",
"@elasticpath/react-shopper-hooks": "workspace:^0.6.0",
"@elasticpath/shopper-common": "workspace:^0.2.0",
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18",
"@moltin/sdk": "^25.0.2",
"@moltin/sdk": "^27.0.0",
"algoliasearch": "^4.14.2",
"clsx": "^1.2.1",
"cookies-next": "^4.0.0",
Expand Down
12 changes: 1 addition & 11 deletions examples/algolia/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ loadEnvConfig(process.env.PWD!);
const PORT = process.env.PORT || 3000;

// Set webServer.url and use.baseURL with the location of the WebServer respecting the correct set port
const baseURL = `http://localhost:${PORT}`;
const baseURL = process.env.BASE_URL ?? `http://localhost:${PORT}`;

// Reference: https://playwright.dev/docs/test-configuration
const config: PlaywrightTestConfig = {
Expand Down Expand Up @@ -60,23 +60,13 @@ const config: PlaywrightTestConfig = {
...devices["Desktop Firefox"],
},
},
{
name: "Desktop Safari",
use: {
...devices["Desktop Safari"],
},
},
// Test against mobile viewports.
{
name: "Mobile Chrome",
use: {
...devices["Pixel 5"],
},
},
{
name: "Mobile Safari",
use: devices["iPhone 12"],
},
],
};
export default config;
2 changes: 0 additions & 2 deletions examples/payments/e2e/checkout-flow.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { test } from "@playwright/test";
import { createD2CProductDetailPage } from "./models/d2c-product-detail-page";
import { client } from "./util/epcc-client";
import { skipIfMissingCatalog } from "./util/missing-published-catalog";
import { createD2CCartPage } from "./models/d2c-cart-page";
import { createD2CCheckoutPage } from "./models/d2c-checkout-page";
import { gatewayIsEnabled } from "./util/gateway-is-enabled";
Expand All @@ -10,7 +9,6 @@ import { skipIfCIEnvironment } from "./util/skip-ci-env";
test.describe("Checkout flow", async () => {
test.beforeEach(async () => {
skipIfCIEnvironment();
await skipIfMissingCatalog();
await gatewayIsEnabled();
});

Expand Down
4 changes: 0 additions & 4 deletions examples/payments/e2e/home-page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import { createD2CHomePage } from "./models/d2c-home-page";
import { skipIfMissingCatalog } from "./util/missing-published-catalog";

test.describe("Home Page", async () => {
test.beforeEach(async () => {
await skipIfMissingCatalog();
});

test("should load home page", async ({ page }) => {
const d2cHomePage = createD2CHomePage(page);
await d2cHomePage.goto();
Expand Down
4 changes: 0 additions & 4 deletions examples/payments/e2e/models/d2c-cart-page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import type { Locator, Page } from "@playwright/test";
import { expect } from "@playwright/test";
import { getCartId } from "../util/get-cart-id";

export interface D2CCartPage {
readonly page: Page;
Expand All @@ -20,8 +18,6 @@ export function createD2CCartPage(page: Page): D2CCartPage {
},
async checkoutCart() {
await checkoutBtn.click();
const cartId = await getCartId(page)();
await expect(page).toHaveURL(`/checkout/${cartId}`);
},
};
}
4 changes: 3 additions & 1 deletion examples/payments/e2e/models/d2c-checkout-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ export function createD2CCheckoutPage(page: Page): D2CCheckoutPage {
},
async continueShopping() {
await continueShoppingBtn.click();
await expect(page).toHaveURL(`/`);
await expect(
page.getByRole("heading", { name: "Your Elastic Path storefront" }),
).toBeVisible();
},
};
}
4 changes: 0 additions & 4 deletions examples/payments/e2e/product-details-page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import { client } from "./util/epcc-client";
import { skipIfMissingCatalog } from "./util/missing-published-catalog";

test.describe("Product Details Page", async () => {
test.beforeEach(async () => {
await skipIfMissingCatalog();
});

test("should add a simple product to cart", async ({ page }) => {
const productDetailPage = createD2CProductDetailPage(page, client);

Expand Down
6 changes: 3 additions & 3 deletions examples/payments/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
"start:e2e": "NODE_ENV=test next start"
},
"dependencies": {
"@elasticpath/react-shopper-hooks": "^0.5.1",
"@elasticpath/shopper-common": "^0.1.1",
"@elasticpath/react-shopper-hooks": "workspace:^0.6.0",
"@elasticpath/shopper-common": "workspace:^0.2.0",
"@headlessui/react": "^1.7.17",
"@heroicons/react": "^2.0.18",
"@moltin/sdk": "^25.0.2",
"@moltin/sdk": "^27.0.0",
"@stripe/react-stripe-js": "^2.3.0",
"@stripe/stripe-js": "^2.1.6",
"clsx": "^1.2.1",
Expand Down
12 changes: 1 addition & 11 deletions examples/payments/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ loadEnvConfig(process.env.PWD!);
const PORT = process.env.PORT || 3000;

// Set webServer.url and use.baseURL with the location of the WebServer respecting the correct set port
const baseURL = `http://localhost:${PORT}`;
const baseURL = process.env.BASE_URL ?? `http://localhost:${PORT}`;

// Reference: https://playwright.dev/docs/test-configuration
const config: PlaywrightTestConfig = {
Expand Down Expand Up @@ -60,23 +60,13 @@ const config: PlaywrightTestConfig = {
...devices["Desktop Firefox"],
},
},
{
name: "Desktop Safari",
use: {
...devices["Desktop Safari"],
},
},
// Test against mobile viewports.
{
name: "Mobile Chrome",
use: {
...devices["Pixel 5"],
},
},
{
name: "Mobile Safari",
use: devices["iPhone 12"],
},
],
};
export default config;
11 changes: 1 addition & 10 deletions examples/simple/e2e/checkout-flow.spec.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
import { test } from "@playwright/test";
import { createD2CProductDetailPage } from "./models/d2c-product-detail-page";
import { client } from "./util/epcc-client";
import { skipIfMissingCatalog } from "./util/missing-published-catalog";
import { createD2CCartPage } from "./models/d2c-cart-page";
import { createD2CCheckoutPage } from "./models/d2c-checkout-page";
import { gatewayIsEnabled } from "./util/gateway-is-enabled";
import { skipIfCIEnvironment } from "./util/skip-ci-env";

test.describe("Checkout flow", async () => {
test.beforeEach(async () => {
skipIfCIEnvironment();
await skipIfMissingCatalog();
await gatewayIsEnabled();
});

test("should perform product checkout", async ({ page }) => {
const productDetailPage = createD2CProductDetailPage(page, client);
const cartPage = createD2CCartPage(page);
Expand All @@ -31,7 +22,7 @@ test.describe("Checkout flow", async () => {

/* Enter information */
await checkoutPage.enterInformation({
"Email Address": { value: "[email protected]", fieldType: "input" },
Email: { value: "[email protected]", fieldType: "input" },
"First Name": { value: "Jim", fieldType: "input" },
"Last Name": { value: "Brown", fieldType: "input" },
"Street Address": { value: "Main Street", fieldType: "input" },
Expand Down
4 changes: 0 additions & 4 deletions examples/simple/e2e/home-page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ import { createD2CHomePage } from "./models/d2c-home-page";
import { skipIfMissingCatalog } from "./util/missing-published-catalog";

test.describe("Home Page", async () => {
test.beforeEach(async () => {
await skipIfMissingCatalog();
});

test("should load home page", async ({ page }) => {
const d2cHomePage = createD2CHomePage(page);
await d2cHomePage.goto();
Expand Down
4 changes: 0 additions & 4 deletions examples/simple/e2e/models/d2c-cart-page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import type { Locator, Page } from "@playwright/test";
import { expect } from "@playwright/test";
import { getCartId } from "../util/get-cart-id";

export interface D2CCartPage {
readonly page: Page;
Expand All @@ -20,8 +18,6 @@ export function createD2CCartPage(page: Page): D2CCartPage {
},
async checkoutCart() {
await checkoutBtn.click();
const cartId = await getCartId(page)();
await expect(page).toHaveURL(`/checkout/${cartId}`);
},
};
}
4 changes: 3 additions & 1 deletion examples/simple/e2e/models/d2c-checkout-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ export function createD2CCheckoutPage(page: Page): D2CCheckoutPage {
},
async continueShopping() {
await continueShoppingBtn.click();
await expect(page).toHaveURL(`/`);
await expect(
page.getByRole("heading", { name: "Your Elastic Path storefront" }),
).toBeVisible();
},
};
}
4 changes: 0 additions & 4 deletions examples/simple/e2e/product-details-page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import { client } from "./util/epcc-client";
import { skipIfMissingCatalog } from "./util/missing-published-catalog";

test.describe("Product Details Page", async () => {
test.beforeEach(async () => {
await skipIfMissingCatalog();
});

test("should add a simple product to cart", async ({ page }) => {
const productDetailPage = createD2CProductDetailPage(page, client);

Expand Down
10 changes: 5 additions & 5 deletions examples/simple/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"start:e2e": "NODE_ENV=test next start"
},
"dependencies": {
"@moltin/sdk": "^25.0.2",
"@elasticpath/react-shopper-hooks": "^0.5.1",
"@elasticpath/shopper-common": "^0.1.1",
"@moltin/sdk": "^27.0.0",
"@elasticpath/react-shopper-hooks": "workspace:^0.6.0",
"@elasticpath/shopper-common": "workspace:^0.2.0",
"clsx": "^1.2.1",
"cookies-next": "^4.0.0",
"focus-visible": "^5.2.0",
Expand Down Expand Up @@ -69,5 +69,5 @@
"autoprefixer": "^10.4.14",
"postcss": "^8.4.30",
"prettier-plugin-tailwindcss": "^0.5.4"
}
}
}
}
Loading
Loading