@jetshop/template-trend 5.8.2 → 5.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.linaria-cache/packages/template-trend/src/components/SearchPage/CategoryList.linaria.css +7 -0
- package/.linaria-cache/packages/ui/ChannelSelector/Region.linaria.css +3 -0
- package/cypress/integration/essentials.spec.js +50 -0
- package/package.json +5 -5
- package/schema.graphql +30 -18
- package/src/components/Auth/ForgotPassword.loadable.js +7 -0
- package/src/components/Auth/LogInPage.loadable.js +7 -0
- package/src/components/Auth/ResetPassword.loadable.js +7 -0
- package/src/components/Auth/Signup/SignUpPage.loadable.js +7 -0
- package/src/components/Cart/CartFragment.gql +8 -0
- package/src/components/CategoryPage/CategoryPage.loadable.js +7 -0
- package/src/components/CategoryPage/Filters/ListFilters.js +1 -2
- package/src/components/CategoryPage/ProductGridFragment.gql +8 -0
- package/src/components/CategoryPage/WindowedCategoryPage.js +6 -5
- package/src/components/ContentPage/ContentPage.loadable.js +7 -0
- package/src/components/Forms/Input.js +3 -6
- package/src/components/Layout/Header/RecommendedChannel/RecommendedChannelSelector.js +1 -1
- package/src/components/Layout/Header/TopNav.js +13 -11
- package/src/components/MyPages/MyPages.loadable.js +7 -0
- package/src/components/MyPages/MyPagesSidebar.js +0 -1
- package/src/components/NavigationTree/NavTreePage.loadable.js +7 -0
- package/src/components/NotFoundPage.loadable.js +7 -0
- package/src/components/ProductPage/AddToCart/ProductToast.js +1 -1
- package/src/components/ProductPage/ProductPage.loadable.js +7 -0
- package/src/components/SearchPage/SearchPage.loadable.js +7 -0
- package/src/components/Shop.js +26 -75
- package/src/components/StartPage/Content/Row.js +0 -37
- package/src/components/StartPage/StartPage.loadable.js +7 -0
- package/src/components/StartPage/StartPageProductGridFragment.gql +8 -0
- package/src/components/Store/Store.loadable.js +7 -0
- package/src/components/StoreLocator/StoreLocator.loadable.js +7 -0
- package/src/shop.config.js +8 -4
- package/.vscode/launch.json +0 -11
- package/cypress/constants.js +0 -5
- package/cypress/integration/addToCart/addToCart.spec.js +0 -27
- package/cypress/integration/addToCart/disabledVariations.spec.js +0 -17
- package/cypress/integration/addToCart/newslettersubscriber.spec.js +0 -24
- package/cypress/integration/addToCart/notifyWhenBackInStock.spec.js +0 -20
- package/cypress/integration/addToCart/productConfigurations.spec.js +0 -35
- package/cypress/integration/addToCart/productVariations.spec.js +0 -42
- package/cypress/integration/addToCart/sizePriceChange.spec.js +0 -20
- package/cypress/integration/analytics/gtag.spec.js +0 -90
- package/cypress/integration/analytics/releware.spec.js +0 -95
- package/cypress/integration/auth/login.spec.js +0 -18
- package/cypress/integration/auth/signup.spec.js +0 -98
- package/cypress/integration/category_page_spec.js +0 -73
- package/cypress/integration/filters.spec.js +0 -103
- package/cypress/integration/getbyarticlenumber.spec.js +0 -28
- package/cypress/integration/packages.spec.js +0 -85
- package/cypress/integration/prefetch_headers_spec.js +0 -26
- package/cypress/integration/product_browsing_spec.js +0 -17
- package/cypress/integration/search/autocomplete.spec.js +0 -28
- package/cypress/integration/search/search_page.spec.js +0 -39
- package/cypress/integration/ssr/categorySSR.js +0 -9
- package/cypress/integration/ssr/productSSR.js +0 -9
- package/cypress/integration/ssr/startPageSSR.js +0 -5
- package/cypress/integration/start_page_spec.js +0 -5
- package/cypress/integration/stores_page.spec.js +0 -5
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { CATEGORY_URL } from '../constants';
|
|
2
|
-
|
|
3
|
-
const ACCESSORIES_URL = '/accessories';
|
|
4
|
-
const FURNITURE_URL = '/furniture';
|
|
5
|
-
const CAMPAIGN_URL = '/campaigns';
|
|
6
|
-
|
|
7
|
-
describe('Category Page', () => {
|
|
8
|
-
beforeEach(() => cy.visit(`${ACCESSORIES_URL}?channelCountry=US`));
|
|
9
|
-
it('Loads the right header', () => {
|
|
10
|
-
cy.findByTestId('page-header').should('contain', 'Accessories');
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('Can handle pagination', () => {
|
|
14
|
-
cy.visit(`${ACCESSORIES_URL}?channelCountry=US&standardPagination=true`);
|
|
15
|
-
cy.get('a')
|
|
16
|
-
.contains('Next')
|
|
17
|
-
.click();
|
|
18
|
-
cy.url().should('contain', 'page=2');
|
|
19
|
-
cy.get('#root').should('contain', 'Page 2 of 2');
|
|
20
|
-
cy.get('a')
|
|
21
|
-
.contains('Prev')
|
|
22
|
-
.click();
|
|
23
|
-
cy.url().should('not.contain', 'page=2');
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
describe('Infinite pagination', () => {
|
|
28
|
-
it('has non moving scroll position on fetch', () => {
|
|
29
|
-
let yOffset;
|
|
30
|
-
cy.visit(CAMPAIGN_URL);
|
|
31
|
-
cy.scrollTo('bottom');
|
|
32
|
-
cy.window()
|
|
33
|
-
.then(win => {
|
|
34
|
-
yOffset = win.pageYOffset;
|
|
35
|
-
})
|
|
36
|
-
.then(() => {
|
|
37
|
-
cy.get('a')
|
|
38
|
-
.contains('Show more')
|
|
39
|
-
.click();
|
|
40
|
-
cy.wait(2000);
|
|
41
|
-
cy.window()
|
|
42
|
-
.its('pageYOffset')
|
|
43
|
-
.should('equal', yOffset);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
it('paginates correctly when retreiving more products', () => {
|
|
47
|
-
cy.visit(FURNITURE_URL);
|
|
48
|
-
cy.get('a')
|
|
49
|
-
.contains('Show more')
|
|
50
|
-
.click();
|
|
51
|
-
cy.wait(2000);
|
|
52
|
-
cy.scrollTo('bottom');
|
|
53
|
-
cy.url().should('contain', 'page=2');
|
|
54
|
-
cy.scrollTo('top');
|
|
55
|
-
cy.url().should('not.contain', 'page=2');
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
describe('product browsing', () => {
|
|
60
|
-
describe('news category', () => {
|
|
61
|
-
beforeEach(() => cy.visit(`${CATEGORY_URL}?channelCountry=US`));
|
|
62
|
-
|
|
63
|
-
it('contains a category description', () => {
|
|
64
|
-
cy.findByTestId('category-description');
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('contains a product grid with products', () => {
|
|
68
|
-
cy.findByTestId('product-grid').within(() =>
|
|
69
|
-
cy.findAllByTestId('product')
|
|
70
|
-
);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
});
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
const BIKES_URL = '/bikes';
|
|
2
|
-
const SEARCH_URL = '/se/search/?term=city';
|
|
3
|
-
const FURNITURE_URL = '/furniture';
|
|
4
|
-
const PRODUCT_NAME_TO_CHECK = 'Toldbod Pendant';
|
|
5
|
-
describe('Filters', () => {
|
|
6
|
-
it('Has a working default in stock filter on categories', () => {
|
|
7
|
-
cy.visit(`${BIKES_URL}?channelCountry=US`);
|
|
8
|
-
cy.get('input[type=checkbox]').should('be.checked');
|
|
9
|
-
cy.contains('City Racer_ 2').should('not.exist');
|
|
10
|
-
cy.get('label').contains('In stock').click();
|
|
11
|
-
cy.url().should('include', 'boolean[150:buyable]=false');
|
|
12
|
-
cy.contains('City Racer_ 2').should('exist');
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('Has a working default in stock filter on search', () => {
|
|
16
|
-
cy.visit(`${SEARCH_URL}&channelCountry=US`);
|
|
17
|
-
cy.get('input[type=checkbox]').should('be.checked');
|
|
18
|
-
cy.contains('City Racer_ 2').should('not.exist');
|
|
19
|
-
cy.get('label').contains('In stock').click();
|
|
20
|
-
cy.url().should('include', 'boolean[buyable]=false');
|
|
21
|
-
cy.contains('City Racer_ 2').should('exist');
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('Non-default filters should be un-chcked', () => {
|
|
25
|
-
cy.visit(`${FURNITURE_URL}?channelCountry=US`);
|
|
26
|
-
cy.get('input[type=checkbox]').should('not.be.checked');
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('Applies filters when returning to category from product', () => {
|
|
30
|
-
cy.visit(FURNITURE_URL);
|
|
31
|
-
cy.get('.product-card-detail')
|
|
32
|
-
.contains(PRODUCT_NAME_TO_CHECK)
|
|
33
|
-
.should('exist');
|
|
34
|
-
cy.get('button[data-flight-dropdown-button] > span')
|
|
35
|
-
.contains('Brand')
|
|
36
|
-
.click();
|
|
37
|
-
cy.get('li[data-flight-dropdown-item] > span').contains('Cartels').click();
|
|
38
|
-
cy.get('.product-card-detail')
|
|
39
|
-
.contains(PRODUCT_NAME_TO_CHECK)
|
|
40
|
-
.should('not.exist');
|
|
41
|
-
cy.get('.product-card-detail').click();
|
|
42
|
-
cy.go('back');
|
|
43
|
-
cy.get('.product-card-detail')
|
|
44
|
-
.contains(PRODUCT_NAME_TO_CHECK)
|
|
45
|
-
.should('not.exist');
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('Persists filters when applying sort', () => {
|
|
49
|
-
cy.visit(FURNITURE_URL);
|
|
50
|
-
cy.get('button[data-flight-dropdown-button] > span')
|
|
51
|
-
.contains('Brand')
|
|
52
|
-
.click();
|
|
53
|
-
cy.get('li[data-flight-dropdown-item] > span').contains('Cartels').click();
|
|
54
|
-
cy.get('button[data-flight-dropdown-button] > span')
|
|
55
|
-
.contains('Sort By')
|
|
56
|
-
.click();
|
|
57
|
-
cy.get('li[data-flight-dropdown-item] > span')
|
|
58
|
-
.contains('Date added')
|
|
59
|
-
.click();
|
|
60
|
-
|
|
61
|
-
// logically working
|
|
62
|
-
cy.get('.product-card-detail')
|
|
63
|
-
.contains(PRODUCT_NAME_TO_CHECK)
|
|
64
|
-
.should('not.exist');
|
|
65
|
-
|
|
66
|
-
// also shown in ui
|
|
67
|
-
cy.get('aside > button').contains('Clear all filters').should('exist');
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('Persists filters when paginating', () => {
|
|
71
|
-
cy.visit('/accessories?standardPagination=true');
|
|
72
|
-
cy.get('button[data-flight-dropdown-button] > span')
|
|
73
|
-
.contains('Categories')
|
|
74
|
-
.click();
|
|
75
|
-
cy.get('li[data-flight-dropdown-item] > span').as('listOfCategories');
|
|
76
|
-
cy.get('@listOfCategories').contains('Watches').click();
|
|
77
|
-
cy.get('@listOfCategories').contains('Glasses').click();
|
|
78
|
-
cy.get('@listOfCategories').contains('Bags').click();
|
|
79
|
-
|
|
80
|
-
cy.get('.product-card-detail').contains('Belt Light').should('not.exist');
|
|
81
|
-
|
|
82
|
-
cy.get('a').contains('Next').click();
|
|
83
|
-
|
|
84
|
-
cy.get('.product-card-detail').contains('Belt Light').should('not.exist');
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('Persists filters when infinite paginating', () => {
|
|
88
|
-
cy.visit('/accessories');
|
|
89
|
-
cy.get('button[data-flight-dropdown-button] > span')
|
|
90
|
-
.contains('Categories')
|
|
91
|
-
.click();
|
|
92
|
-
cy.get('li[data-flight-dropdown-item] > span').as('listOfCategories');
|
|
93
|
-
cy.get('@listOfCategories').contains('Watches').click();
|
|
94
|
-
cy.get('@listOfCategories').contains('Glasses').click();
|
|
95
|
-
cy.get('@listOfCategories').contains('Bags').click();
|
|
96
|
-
|
|
97
|
-
cy.get('.product-card-detail').contains('Belt Light').should('not.exist');
|
|
98
|
-
|
|
99
|
-
cy.get('a').contains('Show more').click();
|
|
100
|
-
|
|
101
|
-
cy.get('.product-card-detail').contains('Belt Light').should('not.exist');
|
|
102
|
-
});
|
|
103
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ARTICLENUMBER_URL, US_ARTICLENUMBER_URL } from '../constants';
|
|
2
|
-
|
|
3
|
-
describe('Visiting /articlenumber/:articlenumber', () => {
|
|
4
|
-
it('does a redirect on the server to the correct product', () => {
|
|
5
|
-
cy.request(ARTICLENUMBER_URL)
|
|
6
|
-
.its('body')
|
|
7
|
-
.should('include', '>Toldbod Pendant</h1>');
|
|
8
|
-
});
|
|
9
|
-
it("returns the startpage if the product isn't found", () => {
|
|
10
|
-
cy.request('/articlenumber/quepasa_quepasa')
|
|
11
|
-
.its('body')
|
|
12
|
-
.should('include', 'Selected Categories</h2>');
|
|
13
|
-
});
|
|
14
|
-
it('redirect to login if login required', () => {
|
|
15
|
-
cy.request(
|
|
16
|
-
US_ARTICLENUMBER_URL +
|
|
17
|
-
'?culture=en-US¤cy=USD&channelCountry=US&channel=M7-GLOBAL'
|
|
18
|
-
).then(res => {
|
|
19
|
-
expect(res.redirects).to.have.length(1);
|
|
20
|
-
expect(res.redirects[0]).to.include('/login');
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
it('handles preselected variants', () => {
|
|
24
|
-
cy.visit(ARTICLENUMBER_URL + '-170-white');
|
|
25
|
-
cy.get('button[aria-pressed="true"]').should('contain', '170');
|
|
26
|
-
cy.get('[data-flight-dropdown-button=""]').should('contain', 'White');
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
const PRODUCT_URL = '/living-room-furniture-pack';
|
|
2
|
-
|
|
3
|
-
describe('Package products', () => {
|
|
4
|
-
it('will preselect the cheapest variants', () => {
|
|
5
|
-
cy.visit(PRODUCT_URL);
|
|
6
|
-
cy.get('[aria-pressed="true"]')
|
|
7
|
-
.should('contain', 'Black')
|
|
8
|
-
.should('contain', '140');
|
|
9
|
-
|
|
10
|
-
cy.get('[data-testid=package-product-add-to-cart]')
|
|
11
|
-
.contains('Add to cart') // check that the button reads 'add to cart' (after transitioning from 'updating price')
|
|
12
|
-
.click();
|
|
13
|
-
cy.get('[data-testid="cart-button"]').click();
|
|
14
|
-
cy.get('[data-testid="item-name"').should('have.length', 5);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('should update the price when variants are selected', () => {
|
|
18
|
-
cy.visit(PRODUCT_URL);
|
|
19
|
-
|
|
20
|
-
cy.get('[data-testid="package-price-total"] > div').should($div => {
|
|
21
|
-
const totalPrice = parseFloat($div.text().replace(/\D+/g, ''));
|
|
22
|
-
expect(totalPrice).to.be.eq(104498);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
cy.get('[data-testid=ColorWhite]').click();
|
|
26
|
-
cy.get('[data-testid=Height120]').click();
|
|
27
|
-
|
|
28
|
-
cy.get('[data-testid=package-product-add-to-cart]').contains('Add to cart'); // check that the button reads 'add to cart' (after transitioning from 'updating price')
|
|
29
|
-
|
|
30
|
-
cy.get('[data-testid="package-price-total"] > div').should($div => {
|
|
31
|
-
const totalPrice = parseFloat($div.text().replace(/\D+/g, ''));
|
|
32
|
-
expect(totalPrice).to.be.eq(106298);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should update the item price when variants are selected', () => {
|
|
37
|
-
cy.visit(PRODUCT_URL);
|
|
38
|
-
|
|
39
|
-
cy.get('.package-product-price')
|
|
40
|
-
.first()
|
|
41
|
-
.children()
|
|
42
|
-
.last()
|
|
43
|
-
.as('item-price');
|
|
44
|
-
|
|
45
|
-
cy.get('@item-price')
|
|
46
|
-
.last()
|
|
47
|
-
.should($div => {
|
|
48
|
-
const totalPrice = parseFloat($div.text().replace(/\D+/g, ''));
|
|
49
|
-
expect(totalPrice).to.be.eq(8000);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
cy.get('[data-testid=ColorWhite]').click();
|
|
53
|
-
cy.get('[data-testid=Height120]').click();
|
|
54
|
-
|
|
55
|
-
cy.get('@item-price')
|
|
56
|
-
.last()
|
|
57
|
-
.should($div => {
|
|
58
|
-
const totalPrice = parseFloat($div.text().replace(/\D+/g, ''));
|
|
59
|
-
expect(totalPrice).to.be.eq(10000);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('can not be added to the cart without selected variants', () => {
|
|
64
|
-
cy.visit(PRODUCT_URL);
|
|
65
|
-
cy.get('[data-testid=ColorWhite]').click();
|
|
66
|
-
cy.get('[data-testid=package-product-add-to-cart]').click();
|
|
67
|
-
cy.get('[data-testid="cart-button"]').click();
|
|
68
|
-
// Wait for cart to update
|
|
69
|
-
cy.get('[data-testid=package-product-add-to-cart]').contains(
|
|
70
|
-
'Select the variants'
|
|
71
|
-
);
|
|
72
|
-
cy.get('[data-testid="item-name"').should('not.exist');
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('can be added to the cart after selecting the appropriate options', () => {
|
|
76
|
-
cy.visit(PRODUCT_URL);
|
|
77
|
-
cy.get('[data-testid=ColorWhite]').click();
|
|
78
|
-
cy.get('[data-testid=Height120]').click();
|
|
79
|
-
cy.get('[data-testid=package-product-add-to-cart]')
|
|
80
|
-
.contains('Add to cart') // check that the button reads 'add to cart' (after transitioning from 'updating price')
|
|
81
|
-
.click();
|
|
82
|
-
cy.get('[data-testid="cart-button"]').click();
|
|
83
|
-
cy.get('[data-testid="item-name"').should('have.length', 5);
|
|
84
|
-
});
|
|
85
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { CATEGORY_URL, PRODUCT_URL } from '../constants';
|
|
2
|
-
|
|
3
|
-
describe('Preload Link header', () => {
|
|
4
|
-
it('Sets appropriate preload Link header on the home page', () => {
|
|
5
|
-
cy.request({
|
|
6
|
-
url: '/'
|
|
7
|
-
}).then(res => {
|
|
8
|
-
expect(res.headers).to.have.property('link');
|
|
9
|
-
expect(res.headers.link).to.match(/^<([^\s>]+.[js|css])>/);
|
|
10
|
-
});
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('Sets appropriate preload Link header on Category page', () => {
|
|
14
|
-
cy.request(`/${CATEGORY_URL}?channelCountry=US`).then(res => {
|
|
15
|
-
expect(res.headers).to.have.property('link');
|
|
16
|
-
expect(res.headers.link).to.include('static/js/');
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
it('Sets appropriate preload Link header on Product page for both jss and css', () => {
|
|
20
|
-
cy.request(`/${PRODUCT_URL}?channelCountry=US`).then(res => {
|
|
21
|
-
expect(res.headers).to.have.property('link');
|
|
22
|
-
expect(res.headers.link).to.include('static/js/');
|
|
23
|
-
expect(res.headers.link).to.include('static/css/');
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { CATEGORY_URL } from '../constants';
|
|
2
|
-
|
|
3
|
-
describe('product browsing', () => {
|
|
4
|
-
describe('news category', () => {
|
|
5
|
-
beforeEach(() => cy.visit(`${CATEGORY_URL}?channelCountry=US`));
|
|
6
|
-
|
|
7
|
-
it('contains a category description', () => {
|
|
8
|
-
cy.findByTestId('category-description');
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it('contains a product grid with products', () => {
|
|
12
|
-
cy.findByTestId('product-grid').within(() =>
|
|
13
|
-
cy.findAllByTestId('product')
|
|
14
|
-
);
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const CATEGORY_TERM = 'brand';
|
|
2
|
-
const PRODUCT_TERM = 'bike';
|
|
3
|
-
|
|
4
|
-
describe('Search autocomplete', () => {
|
|
5
|
-
it('Returns results', () => {
|
|
6
|
-
cy.visit('/');
|
|
7
|
-
|
|
8
|
-
cy.get('#root > div > header').as('header');
|
|
9
|
-
cy.get('@header')
|
|
10
|
-
.find('button')
|
|
11
|
-
.contains('Search')
|
|
12
|
-
.click();
|
|
13
|
-
cy.get('[data-flight-search-autocomplete-field]')
|
|
14
|
-
.as('searchField')
|
|
15
|
-
.click()
|
|
16
|
-
.type(CATEGORY_TERM);
|
|
17
|
-
|
|
18
|
-
cy.get('@header')
|
|
19
|
-
.find('[data-flight-search-autocomplete-result="category"]')
|
|
20
|
-
.should('be.visible');
|
|
21
|
-
|
|
22
|
-
cy.get('@searchField').type(`{selectall}${PRODUCT_TERM}`);
|
|
23
|
-
|
|
24
|
-
cy.get('@header')
|
|
25
|
-
.find('[data-flight-search-autocomplete-result="product"]')
|
|
26
|
-
.should('be.visible');
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const PRODUCT_TERM = 'bike';
|
|
2
|
-
const EMPTY_TERM = 'sikeeeeee';
|
|
3
|
-
const PAGED_TERM = 'wa bag';
|
|
4
|
-
|
|
5
|
-
describe('Search page', () => {
|
|
6
|
-
it('Returns results', () => {
|
|
7
|
-
cy.visit(`se/search/?term=${PRODUCT_TERM}`);
|
|
8
|
-
|
|
9
|
-
cy.findByTestId('product-grid').as('productGrid').should('exist');
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('Returns a no results page if there are no matches', () => {
|
|
13
|
-
cy.visit(`se/search/?term=${EMPTY_TERM}`);
|
|
14
|
-
|
|
15
|
-
cy.findByTestId('product-grid').as('productGrid').should('not.exist');
|
|
16
|
-
|
|
17
|
-
cy.findAllByText('No results for').should('exist');
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('Can handle pagination on search page', () => {
|
|
21
|
-
cy.visit(`se/search/?term=${PAGED_TERM}&standardPagination=true`);
|
|
22
|
-
cy.findByTestId('product-grid').as('productGrid').should('exist');
|
|
23
|
-
cy.get('li[data-testid="product"]').should('have.length', 24);
|
|
24
|
-
cy.get('a').contains('Next').click();
|
|
25
|
-
cy.url().should('contain', 'page=2');
|
|
26
|
-
cy.findByTestId('product-grid').as('productGrid').should('exist');
|
|
27
|
-
cy.get('li[data-testid="product"]').should('have.length.lessThan', 24);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('Can handle infinite pagination', () => {
|
|
31
|
-
cy.visit(`se/search/?term=${PAGED_TERM}`);
|
|
32
|
-
cy.get('a').contains('Show more').click();
|
|
33
|
-
cy.wait(2000);
|
|
34
|
-
cy.scrollTo('bottom');
|
|
35
|
-
cy.url().should('contain', 'page=2');
|
|
36
|
-
cy.scrollTo('top');
|
|
37
|
-
cy.url().should('not.contain', 'page=2');
|
|
38
|
-
});
|
|
39
|
-
});
|