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

Support Node 16 #965

Merged
merged 58 commits into from
Feb 27, 2023
Merged
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
298e638
add explicit dependency on ws
raiyaj Feb 7, 2023
906b23e
add custom docs url for 403 errors
raiyaj Feb 7, 2023
b8d680d
remove performance timer
raiyaj Feb 7, 2023
fa17a85
add explicit support for node 16
raiyaj Feb 7, 2023
86f9353
add explicit pwa-kit-dev support for node 16
raiyaj Feb 7, 2023
3eb9ee1
add explicit support for node 16 across the board
raiyaj Feb 7, 2023
c9e24b6
delete performance timer tests
raiyaj Feb 7, 2023
e81ea18
add explicit support for node 18
raiyaj Feb 9, 2023
74081e3
add node 16 and 18 to test matrix
raiyaj Feb 9, 2023
4b463a5
Revert "add explicit support for node 18"
raiyaj Feb 10, 2023
5c23e0e
remove 18 from test matrix
raiyaj Feb 10, 2023
261d49a
fix use-product-view-modal test
raiyaj Feb 13, 2023
2e88658
fix use-wishlist test
raiyaj Feb 14, 2023
6684628
lint
raiyaj Feb 14, 2023
5678a28
fix product-view test
raiyaj Feb 15, 2023
4f3dd08
lint
raiyaj Feb 15, 2023
614549f
try to fix with-registration test
raiyaj Feb 15, 2023
5182c84
update changelog
raiyaj Feb 15, 2023
60ae753
Merge branch 'develop' into pwa-kit-runtime-node16
raiyaj Feb 15, 2023
3c2e5a4
update pwa-kit-dev changelog
raiyaj Feb 15, 2023
ea563c5
add node 16 to windows test matrix
raiyaj Feb 15, 2023
40be1e2
change default pwa kit version to 16.x
raiyaj Feb 16, 2023
942dad5
try to fix flaky reset-password test
raiyaj Feb 16, 2023
cdbe418
switch generated builds to node 16
raiyaj Feb 16, 2023
fdc6d21
add npm 7 and 8 to windows test matrix
raiyaj Feb 16, 2023
70e1bdf
try to make reset-password test even more resilient
raiyaj Feb 16, 2023
7a7567a
add -y flag to npx command to prevent timeouts when generating projec…
raiyaj Feb 17, 2023
58f8ca4
try to make registration test more resilient
raiyaj Feb 17, 2023
35dad46
try to make account test more resilient
raiyaj Feb 17, 2023
b571ee7
try to make registration test more resilient
raiyaj Feb 17, 2023
bdf0896
conditionally pass -y flag to npx based on current node/npm version
raiyaj Feb 17, 2023
f73e739
exclude unnecessary node/npm combinations from test matrices
raiyaj Feb 17, 2023
8078e1b
fix indentation
raiyaj Feb 17, 2023
25dc0d6
make sure pwa-kit-create-app@latest gets installed
raiyaj Feb 17, 2023
5674fe6
Merge branch 'develop' into pwa-kit-runtime-node16
raiyaj Feb 17, 2023
0f2cf9d
set npx flags based on the version of npm, not node
raiyaj Feb 17, 2023
1298a0f
update IS_DEFAULT_NPM
raiyaj Feb 17, 2023
f123067
try to make reset-password test more resilient
raiyaj Feb 17, 2023
d6e14c1
clean up tests
raiyaj Feb 19, 2023
3eb363b
fix sdk dir path
raiyaj Feb 22, 2023
d90306f
add logs
raiyaj Feb 22, 2023
85fbe74
make sure sdkDir resolves to pwa-kit-dev
raiyaj Feb 22, 2023
5c7552a
refactor
raiyaj Feb 22, 2023
0dcfef7
return a default path rather than throwing an error
raiyaj Feb 22, 2023
e7f7df6
Merge branch 'develop' into pwa-kit-runtime-node16
raiyaj Feb 22, 2023
f230864
update READMEs and babel configs
raiyaj Feb 22, 2023
0c50c68
try to make tests more resilient
raiyaj Feb 22, 2023
ee119ad
lint
raiyaj Feb 22, 2023
0e6e00e
add comment about looking for pwa-kit-dev node_modules in two places
raiyaj Feb 23, 2023
b7186e8
try to make tests more resilient
raiyaj Feb 23, 2023
38dbed1
undo unnecessary change
raiyaj Feb 23, 2023
5bc8c36
ensure pwa-kit publish steps are only run once
raiyaj Feb 24, 2023
570c53d
Merge branch 'develop' into pwa-kit-runtime-node16
raiyaj Feb 24, 2023
87cf7eb
remove node 16 / npm 6 builds
raiyaj Feb 25, 2023
cba5cb5
try to make reset-password test more resilient
raiyaj Feb 25, 2023
85cd2dc
Merge branch 'develop' into pwa-kit-runtime-node16
raiyaj Feb 27, 2023
c08035f
try to make registration test more resilient
raiyaj Feb 27, 2023
6ec6d7d
Merge branch 'develop' into pwa-kit-runtime-node16
raiyaj Feb 27, 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
Prev Previous commit
Next Next commit
fix product-view test
raiyaj committed Feb 15, 2023
commit 5678a28bca2a89b0f4717b8f115a05f7f12d893b
Original file line number Diff line number Diff line change
@@ -53,32 +53,38 @@ beforeEach(() => {
})
afterEach(() => {
localStorage.clear()
sessionStorage.clear()
})

test('ProductView Component renders properly', () => {
test('ProductView Component renders properly', async () => {
const addToCart = jest.fn()
renderWithProviders(<MockComponent product={mockProductDetail} addToCart={addToCart} />)
await renderWithProviders(<MockComponent product={mockProductDetail} addToCart={addToCart} />)

expect(screen.getAllByText(/Black Single Pleat Athletic Fit Wool Suit/i).length).toEqual(2)
expect(screen.getAllByText(/299.99/).length).toEqual(2)
expect(screen.getAllByText(/Add to cart/i).length).toEqual(2)
expect(screen.getAllByRole('radiogroup').length).toEqual(3)
expect(screen.getAllByText(/add to cart/i).length).toEqual(2)
await waitFor(() => {
expect(screen.getAllByText(/Black Single Pleat Athletic Fit Wool Suit/i).length).toEqual(2)
expect(screen.getAllByText(/299.99/).length).toEqual(2)
expect(screen.getAllByText(/Add to cart/i).length).toEqual(2)
expect(screen.getAllByRole('radiogroup').length).toEqual(3)
expect(screen.getAllByText(/add to cart/i).length).toEqual(2)
})
})

test('ProductView Component renders with addToCart event handler', () => {
test('ProductView Component renders with addToCart event handler', async () => {
const addToCart = jest.fn()
renderWithProviders(<MockComponent product={mockProductDetail} addToCart={addToCart} />)
await renderWithProviders(<MockComponent product={mockProductDetail} addToCart={addToCart} />)

const addToCartButton = screen.getAllByText(/add to cart/i)[0]
fireEvent.click(addToCartButton)
expect(addToCart).toHaveBeenCalledTimes(1)

await waitFor(() => {
expect(addToCart).toHaveBeenCalledTimes(1)
})
})

test('ProductView Component renders with addToWishList event handler', async () => {
const addToWishlist = jest.fn()

renderWithProviders(<MockComponent product={mockProductDetail} addToWishlist={addToWishlist} />)
await renderWithProviders(<MockComponent product={mockProductDetail} addToWishlist={addToWishlist} />)

await waitFor(() => {
expect(screen.getByText(/customer: registered/)).toBeInTheDocument()
@@ -95,7 +101,7 @@ test('ProductView Component renders with addToWishList event handler', async ()
test('ProductView Component renders with updateWishlist event handler', async () => {
const updateWishlist = jest.fn()

renderWithProviders(
await renderWithProviders(
<MockComponent product={mockProductDetail} updateWishlist={updateWishlist} />
)

@@ -111,12 +117,23 @@ test('ProductView Component renders with updateWishlist event handler', async ()
})
})

test('Product View can update quantity', () => {
test('Product View can update quantity', async () => {
const addToCart = jest.fn()
renderWithProviders(<MockComponent product={mockProductDetail} addToCart={addToCart} />)
const quantityBox = screen.getByRole('spinbutton')
expect(quantityBox).toHaveValue('1')
await renderWithProviders(<MockComponent product={mockProductDetail} addToCart={addToCart} />)

let quantityBox
await waitFor(() => {
quantityBox = screen.getByRole('spinbutton')
})

await waitFor(() => {
expect(quantityBox).toHaveValue('1')
})

// update item quantity
userEvent.type(quantityBox, '{backspace}3')
expect(quantityBox).toHaveValue('3')

await waitFor(() => {
expect(quantityBox).toHaveValue('3')
})
})
10 changes: 6 additions & 4 deletions packages/template-retail-react-app/jest-setup.js
Original file line number Diff line number Diff line change
@@ -99,7 +99,7 @@ jest.mock('./app/commerce-api/utils', () => {
global.TextEncoder = require('util').TextEncoder

// This file consists of global mocks for jsdom.
class LocalStorageMock {
class StorageMock {
constructor() {
this.store = {}
}
@@ -117,14 +117,16 @@ class LocalStorageMock {
}
}

const localStorageMock = new LocalStorageMock()

Object.defineProperty(window, 'crypto', {
value: new Crypto()
})

Object.defineProperty(window, 'localStorage', {
value: localStorageMock
value: new StorageMock()
})

Object.defineProperty(window, 'sessionStorage', {
value: new StorageMock()
})

Object.defineProperty(window, 'scrollTo', {