Skip to content

Commit

Permalink
fix: yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxiran committed Jan 27, 2021
1 parent 3ab8f52 commit 2507fa8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion web/cypress/fixtures/selector.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"dropdown": ".rc-virtual-list",
"notification": ".ant-notification-notice-message",
"drawerBody": ".ant-drawer-wrapper-body",
"notificationCloseIcon": "ant-notification-close-icon",
"notificationCloseIcon": ".ant-notification-close-icon",
"notificationDesc": ".ant-notification-notice-description"
}
9 changes: 7 additions & 2 deletions web/cypress/integration/route/import_export_route.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import actionBarUS from '../../../src/components/ActionBar/locales/en-US';
import componentLocaleUS from '../../../src/locales/en-US/component';
import menuLocaleUS from '../../../src/locales/en-US/menu';
import routeLocaleUS from '../../../src/pages/Route/locales/en-US';
import yaml from 'js-yaml';

context('import and export routes', () => {
const domSelector = {
Expand All @@ -42,6 +43,7 @@ context('import and export routes', () => {
yamlMask: 'cypress/downloads/*.yaml',
jsonFile:
'{"components":{},"info":{"title":"RoutesExport","version":"3.0.0"},"openapi":"3.0.0","paths":{"/{params}":{"get":{"operationId":"route_name_0GET","parameters":[{"description":"params in path","in":"path","name":"params","required":true,"schema":{"type":"string"}}],"requestBody":{},"responses":{"default":{"description":""}},"x-apisix-enable_websocket":false,"x-apisix-plugins":{},"x-apisix-priority":0,"x-apisix-status":1,"x-apisix-upstream":{"nodes":[{"host":"1.1.1.1","port":80,"weight":1}],"timeout":{"connect":6000,"read":6000,"send":6000},"type":"roundrobin","pass_host":"pass"},"x-apisix-vars":[]}}}}',
yamlFile:'{"components":{},"info":{"title":"RoutesExport","version":"3.0.0"},"openapi":"3.0.0","paths":{"/{params}":{"get":{"operationId":"route_name_0GET","parameters":[{"description":"params in path","in":"path","name":"params","required":true,"schema":{"type":"string"}}],"requestBody":{},"responses":{"default":{"description":""}},"x-apisix-enable_websocket":false,"x-apisix-plugins":{},"x-apisix-priority":0,"x-apisix-status":1,"x-apisix-upstream":{"nodes":[{"host":"1.1.1.1","port":80,"weight":1}],"timeout":{"connect":6000,"read":6000,"send":6000},"type":"roundrobin","pass_host":"pass"},"x-apisix-vars":[]}},"/{params}-APISIX-REPEAT-URI-2":{"get":{"operationId":"route_name_1GET","parameters":[{"description":"params in path","in":"path","name":"params","required":true,"schema":{"type":"string"}},{"description":"params in path","in":"path","name":"params","required":true,"schema":{"type":"string"}}],"requestBody":{},"responses":{"default":{"description":""}},"x-apisix-enable_websocket":false,"x-apisix-plugins":{},"x-apisix-priority":0,"x-apisix-status":1,"x-apisix-upstream":{"nodes":[{"host":"2.2.2.2","port":80,"weight":1}],"timeout":{"connect":6000,"read":6000,"send":6000},"type":"roundrobin","pass_host":"pass"},"x-apisix-vars":[]}}}}',
};

beforeEach(() => {
Expand Down Expand Up @@ -117,6 +119,9 @@ context('import and export routes', () => {
cy.task('findFile', data.yamlMask).then((yamlFile) => {
cy.log(`found file ${yamlFile}`);
cy.log('**confirm downloaded yaml file**');
cy.readFile(yamlFile).then((fileContent) => {
expect(JSON.stringify(yaml.load(fileContent), null, null)).to.equal(data.yamlFile);
});
});
});

Expand All @@ -132,7 +137,7 @@ context('import and export routes', () => {
}
});

/* it('should import route(s) from be test files', function() {
it('should import route(s) from be test files', function() {
cy.visit('/');
cy.contains('Route').click();

Expand Down Expand Up @@ -160,5 +165,5 @@ context('import and export routes', () => {
cy.get(this.domSelector.notificationCloseIcon).click();
}
})
}); */
});
});

0 comments on commit 2507fa8

Please sign in to comment.