Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Commit

Permalink
Fix cypress api_url
Browse files Browse the repository at this point in the history
  • Loading branch information
avoinea committed Sep 10, 2021
1 parent a97689d commit 596cbfb
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,15 @@ Cypress.Commands.add(
// --- Add DX Content-Type ----------------------------------------------------------
Cypress.Commands.add('addContentType', (name) => {
let api_url, auth;
api_url =
Cypress.env('API_PATH') ||
'http://localhost:8080/Plone/@controlpanels/dexterity-types';
api_url = Cypress.env('API_PATH') || 'http://localhost:8080/Plone';
auth = {
user: 'admin',
pass: 'admin',
};
return cy
.request({
method: 'POST',
url: `${api_url}/${name}`,
url: `${api_url}/@controlpanels/dexterity-types/${name}`,
headers: {
Accept: 'application/json',
},
Expand All @@ -153,17 +151,15 @@ Cypress.Commands.add('addContentType', (name) => {
// --- Remove DX behavior ----------------------------------------------------------
Cypress.Commands.add('removeContentType', (name) => {
let api_url, auth;
api_url =
Cypress.env('API_PATH') ||
'http://localhost:8080/Plone/@controlpanels/dexterity-types';
api_url = Cypress.env('API_PATH') || 'http://localhost:8080/Plone';
auth = {
user: 'admin',
pass: 'admin',
};
return cy
.request({
method: 'DELETE',
url: `${api_url}/${name}`,
url: `${api_url}/@controlpanels/dexterity-types/${name}`,
headers: {
Accept: 'application/json',
},
Expand All @@ -176,15 +172,15 @@ Cypress.Commands.add('removeContentType', (name) => {
// --- Add DX field ----------------------------------------------------------
Cypress.Commands.add('addSlateJSONField', (type, name) => {
let api_url, auth;
api_url = Cypress.env('API_PATH') || 'http://localhost:8080/Plone/@types';
api_url = Cypress.env('API_PATH') || 'http://localhost:8080/Plone';
auth = {
user: 'admin',
pass: 'admin',
};
return cy
.request({
method: 'POST',
url: `${api_url}/${type}`,
url: `${api_url}/@types/${type}`,
headers: {
Accept: 'application/json',
},
Expand All @@ -203,15 +199,15 @@ Cypress.Commands.add('addSlateJSONField', (type, name) => {
// --- Remove DX field ----------------------------------------------------------
Cypress.Commands.add('removeSlateJSONField', (type, name) => {
let api_url, auth;
api_url = Cypress.env('API_PATH') || 'http://localhost:8080/Plone/@types';
api_url = Cypress.env('API_PATH') || 'http://localhost:8080/Plone';
auth = {
user: 'admin',
pass: 'admin',
};
return cy
.request({
method: 'DELETE',
url: `${api_url}/${type}/${name}`,
url: `${api_url}/@types/${type}/${name}`,
headers: {
Accept: 'application/json',
},
Expand Down

0 comments on commit 596cbfb

Please sign in to comment.