Skip to content

Commit

Permalink
fix: move requestWithToken position
Browse files Browse the repository at this point in the history
  • Loading branch information
oil-oil committed Apr 29, 2022
1 parent b23afeb commit 5b6671c
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,19 @@ context('Table Auto Jump When No Data', () => {
};

before(() => {
cy.login();
Array.from({ length: 11 }).forEach((value, key) => {
const payload = {
username: data.consumerName + key,
plugins: {
'key-auth': {
key: 'test',
disable: false,
cy.login().then(() => {
Array.from({ length: 11 }).forEach((value, key) => {
const payload = {
username: data.consumerName + key,
plugins: {
'key-auth': {
key: 'test',
disable: false,
},
},
},
};
cy.requestWithToken({ method: 'PUT', payload, url: '/apisix/admin/consumers' });
};
cy.requestWithToken({ method: 'PUT', payload, url: '/apisix/admin/consumers' });
});
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ context('Batch Create Proto And Delete Proto', () => {
};

before(() => {
cy.login();
Array.from({ length: 11 }).forEach(async (value, key) => {
const payload = {
content: 'test',
desc: '',
id: `protoId${key}`,
};
cy.requestWithToken({ method: 'POST', payload, url: '/apisix/admin/proto' });
cy.login().then(() => {
Array.from({ length: 11 }).forEach(async (value, key) => {
const payload = {
content: 'test',
desc: '',
id: `protoId${key}`,
};
cy.requestWithToken({ method: 'POST', payload, url: '/apisix/admin/proto' });
});
});
});

Expand Down
59 changes: 30 additions & 29 deletions web/cypress/integration/route/table-auto-jump-when-no-data.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,36 +32,37 @@ context('Table Auto Jump When No Data', () => {
};

before(() => {
cy.login();
Array.from({ length: 11 }).forEach((value, key) => {
const payload = {
methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS', 'CONNECT', 'TRACE'],
priority: 0,
name: `routeName${key}`,
desc: '',
status: 1,
labels: {},
uri: '/*',
upstream: {
type: 'roundrobin',
pass_host: 'pass',
scheme: 'http',
timeout: {
connect: 6,
send: 6,
read: 6,
cy.login().then(() => {
Array.from({ length: 11 }).forEach((value, key) => {
const payload = {
methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS', 'CONNECT', 'TRACE'],
priority: 0,
name: `routeName${key}`,
desc: '',
status: 1,
labels: {},
uri: '/*',
upstream: {
type: 'roundrobin',
pass_host: 'pass',
scheme: 'http',
timeout: {
connect: 6,
send: 6,
read: 6,
},
keepalive_pool: {
size: 320,
idle_timeout: 60,
requests: 1000,
},
nodes: {
'127.0.0.1': 1,
},
},
keepalive_pool: {
size: 320,
idle_timeout: 60,
requests: 1000,
},
nodes: {
'127.0.0.1': 1,
},
},
};
cy.requestWithToken({ method: 'POST', payload, url: '/apisix/admin/routes' });
};
cy.requestWithToken({ method: 'POST', payload, url: '/apisix/admin/routes' });
});
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,32 @@ context('Table Auto Jump When No Data', () => {
};

beforeEach(() => {
cy.login();
Array.from({ length: 11 }).forEach((value, key) => {
const payload = {
name: `serviceName${key}`,
plugins: {},
upstream: {
type: 'roundrobin',
pass_host: 'pass',
scheme: 'http',
timeout: {
connect: 6,
send: 6,
read: 6,
cy.login().then(() => {
Array.from({ length: 11 }).forEach((value, key) => {
const payload = {
name: `serviceName${key}`,
plugins: {},
upstream: {
type: 'roundrobin',
pass_host: 'pass',
scheme: 'http',
timeout: {
connect: 6,
send: 6,
read: 6,
},
keepalive_pool: {
size: 320,
idle_timeout: 60,
requests: 1000,
},
nodes: {
'127.0.0.1': 1,
},
},
keepalive_pool: {
size: 320,
idle_timeout: 60,
requests: 1000,
},
nodes: {
'127.0.0.1': 1,
},
},
};
cy.requestWithToken({ method: 'POST', payload, url: '/apisix/admin/services' });
};
cy.requestWithToken({ method: 'POST', payload, url: '/apisix/admin/services' });
});
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,29 @@ context('Table Auto Jump When No Data', () => {
};

beforeEach(() => {
cy.login();
Array.from({ length: 11 }).forEach((value, key) => {
const payload = {
name: `upstreamName${key}`,
type: 'roundrobin',
pass_host: 'pass',
scheme: 'http',
timeout: {
connect: 6,
send: 6,
read: 6,
},
keepalive_pool: {
size: 320,
idle_timeout: 60,
requests: 1000,
},
nodes: {
'127.0.0.1': 1,
},
};
cy.requestWithToken({ method: 'POST', payload, url: `/apisix/admin/upstreams` });
cy.login().then(() => {
Array.from({ length: 11 }).forEach((value, key) => {
const payload = {
name: `upstreamName${key}`,
type: 'roundrobin',
pass_host: 'pass',
scheme: 'http',
timeout: {
connect: 6,
send: 6,
read: 6,
},
keepalive_pool: {
size: 320,
idle_timeout: 60,
requests: 1000,
},
nodes: {
'127.0.0.1': 1,
},
};
cy.requestWithToken({ method: 'POST', payload, url: `/apisix/admin/upstreams` });
});
});
});

Expand Down

0 comments on commit 5b6671c

Please sign in to comment.