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

change request api version to latest #18

Merged
merged 1 commit into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion cypress/support/commands/fixture-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ Cypress.Commands.add('setToInitialState', () => {
return cy.log('Cleaning, please wait a little bit.').then(() => {
return cy.cleanUpPreviousState();
}).then(() => {
return cy.clearCacheAdminApi('DELETE', 'api/v*/_action/cache');
return cy.clearCacheAdminApi('DELETE', 'api/v1/_action/cache');
}).then(() => {
return cy.setLocaleToEnGb();
});
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/commands/storefront-api-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Cypress.Commands.add('storefrontApiRequest', (method, endpoint, header = {}, bod
...body
},
method: method,
url: `/sales-channel-api/v*/${endpoint}`
url: `/sales-channel-api/v1/${endpoint}`
};

return cy.request(requestConfig).then((result) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ module.exports = class AdminApiService extends ApiService {
}

clearCache() {
return super.clearCache('/v*/_action/cache');
return super.clearCache('/v1/_action/cache');
}

loginToAdministration() {
Expand Down
8 changes: 4 additions & 4 deletions cypress/support/service/administration/fixture.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ class AdminFixtureService {
}

create(endpoint, rawData) {
return this.apiClient.post(`/v*/${endpoint}?response=true`, rawData);
return this.apiClient.post(`/v1/${endpoint}?response=true`, rawData);
}

update(userData) {
if (!userData.id) {
throw new Error('Update fixtures must always contain an id');
}
return this.apiClient.patch(`/v*/${userData.type}/${userData.id}`, userData.data);
return this.apiClient.patch(`/v1/${userData.type}/${userData.id}`, userData.data);
}

authenticate() {
return this.apiClient.loginToAdministration();
}

search(type, filter) {
return this.apiClient.post(`/v*/search/${type}?response=true`, {
return this.apiClient.post(`/v1/search/${type}?response=true`, {
filter: [{
field: filter.field ? filter.field : 'name',
type: 'equals',
Expand All @@ -40,7 +40,7 @@ class AdminFixtureService {
}

clearCache() {
return this.apiClient.delete('/v*/_action/cache').catch((err) => {
return this.apiClient.delete('/v1/_action/cache').catch((err) => {
console.log('Cache could not be cleared')
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const AdminFixtureService = require('../fixture.service.js');

class CategoryFixtureService extends AdminFixtureService {
setCategoryFixture(userData) {
return this.apiClient.post('/v*/category?_response=true', userData);
return this.apiClient.post('/v1/category?_response=true', userData);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const AdminFixtureService = require('../fixture.service.js');
class CmsFixtureService extends AdminFixtureService {
setCmsPageFixture(userData) {
return this.apiClient.post('/v*/cms-page?_response=true', userData);
return this.apiClient.post('/v1/cms-page?_response=true', userData);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class CustomerFixtureService extends AdminFixtureService {
return this.mergeFixtureWithData(finalCustomerRawData, finalAddressRawData);
})
.then((finalCustomerData) => {
return this.apiClient.post('/v*/customer?_response=true', finalCustomerData);
return this.apiClient.post('/v1/customer?_response=true', finalCustomerData);
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ProductFixture extends AdminFixtureService {
manufacturerId: manufacturer.id
}, userData);
}).then((finalProductData) => {
return this.apiClient.post('/v*/product?_response=true', finalProductData);
return this.apiClient.post('/v1/product?_response=true', finalProductData);
}).then((result) => {
return this.setProductVisible(userData.name, categoryName);
});
Expand All @@ -34,7 +34,7 @@ class ProductFixture extends AdminFixtureService {
let salesChannelId = '';
let productId = '';

return this.apiClient.post('/v*/search/sales-channel?response=true', {
return this.apiClient.post('/v1/search/sales-channel?response=true', {
filter: [{
field: 'name',
type: 'equals',
Expand All @@ -43,7 +43,7 @@ class ProductFixture extends AdminFixtureService {
}).then((data) => {
salesChannelId = data.id;

return this.apiClient.post('/v*/search/product?response=true', {
return this.apiClient.post('/v1/search/product?response=true', {
filter: [{
field: 'name',
type: 'equals',
Expand All @@ -53,7 +53,7 @@ class ProductFixture extends AdminFixtureService {
}).then((data) => {
productId = data.id;
}).then(() => {
return this.apiClient.post('/v*/search/category?response=true', {
return this.apiClient.post('/v1/search/category?response=true', {
filter: [{
field: 'name',
type: 'equals',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PropertyFixtureService extends AdminFixtureService {

const finalData = this.mergeFixtureWithData(propertyJson, userData);

return this.apiClient.post('/v*/property-group?_response=true', finalData);
return this.apiClient.post('/v1/property-group?_response=true', finalData);
}
}
module.exports = PropertyFixtureService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class AdminSalesChannelFixture extends AdminFixtureService {
navigationCategoryId: navigationCategory.id
}, userData);
}).then((finalChannelData) => {
return this.apiClient.post('/v*/sales-channel?_response=true', finalChannelData);
return this.apiClient.post('/v1/sales-channel?_response=true', finalChannelData);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ShippingFixtureService extends AdminFixtureService {
deliveryTimeId: deliveryTime.id
});
}).then((finalShippingData) => {
return this.apiClient.post('/v*/shipping-method?_response=true', finalShippingData);
return this.apiClient.post('/v1/shipping-method?_response=true', finalShippingData);
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SnippetFixtureService extends AdminFixtureService {

const snippetData = this.snippetFixture;

return this.apiClient.post('/v*/search/language?response=true', {
return this.apiClient.post('/v1/search/language?response=true', {
filter: [{
field: 'name',
type: 'equals',
Expand All @@ -28,7 +28,7 @@ class SnippetFixtureService extends AdminFixtureService {
}).then((data) => {
languageId = data.id;
}).then(() => {
return this.apiClient.post('/v*/search/snippet-set?response=true', {
return this.apiClient.post('/v1/search/snippet-set?response=true', {
filter: [{
field: 'name',
type: 'equals',
Expand All @@ -45,7 +45,7 @@ class SnippetFixtureService extends AdminFixtureService {
}, snippetData);
})
.then((finalSnippetData) => {
return this.apiClient.post('/v*/snippet?_response=true', finalSnippetData, userData);
return this.apiClient.post('/v1/snippet?_response=true', finalSnippetData, userData);
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/service/saleschannel/fixture.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SalesChannelFixtureService {
}

getClientId(salesChannelName = 'Storefront') {
return this.adminApiClient.post('/v*/search/sales-channel?response=true', {
return this.adminApiClient.post('/v1/search/sales-channel?response=true', {
filter: [{
field: 'name',
type: 'equals',
Expand Down
18 changes: 9 additions & 9 deletions cypress/support/service/saleschannel/fixture/order.fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class OrderFixtureService extends SalesChannelFixtureService {
this.apiClient.setAccessKey(result);
})
.then(() => {
return this.apiClient.post('/v*/customer/login', JSON.stringify({
return this.apiClient.post('/v1/customer/login', JSON.stringify({
username: customer.username,
password: customer.password
}));
Expand All @@ -16,17 +16,17 @@ class OrderFixtureService extends SalesChannelFixtureService {
return this.apiClient.setContextToken(contextToken['sw-context-token']);
})
.then(() => {
return this.apiClient.post('/v*/checkout/cart');
return this.apiClient.post('/v1/checkout/cart');
})
.then(() => {
return this.apiClient.post(`/v*/checkout/cart/line-item/${productId}`, {
return this.apiClient.post(`/v1/checkout/cart/line-item/${productId}`, {
type: 'product',
referencedId: productId,
stackable: true
});
})
.then(() => {
return this.apiClient.post('/v*/checkout/order');
return this.apiClient.post('/v1/checkout/order');
})
.catch((err) => {
console.log('err :', err);
Expand Down Expand Up @@ -70,33 +70,33 @@ class OrderFixtureService extends SalesChannelFixtureService {
return this.apiClient.setContextToken(this.createUuid().replace(/-/g, ''));
})
.then(() => {
return this.apiClient.post('/v*/checkout/cart');
return this.apiClient.post('/v1/checkout/cart');
})
.then(() => {
return this.apiClient.post(`/v*/checkout/cart/line-item/${productId}`, {
return this.apiClient.post(`/v1/checkout/cart/line-item/${productId}`, {
type: 'product',
referencedId: productId,
stackable: true
});
})
.then(() => {
return this.apiClient.post('/v*/checkout/guest-order', customerRawData);
return this.apiClient.post('/v1/checkout/guest-order', customerRawData);
})
.catch((err) => {
console.log('err :', err);
});
}

setPromotionFixture(userData) {
return this.adminApiClient.post('/v*/promotion?_response=true', userData);
return this.adminApiClient.post('/v1/promotion?_response=true', userData);
}

setDiscountFixture(userData, promotionId) {
userData.promotion_discount.payload.forEach(item => {
item.promotionId = promotionId;
});

return this.adminApiClient.post('/v*/_action/sync', userData);
return this.adminApiClient.post('/v1/_action/sync', userData);
}
}

Expand Down