Skip to content

Commit

Permalink
feat: cypress e2e testing for shareable link
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjibansg committed Jul 12, 2023
1 parent 65b5c30 commit 104f571
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
39 changes: 39 additions & 0 deletions client/cypress/e2e/shareable.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/// <reference types="cypress" />

describe("Substrait Fiddle Shareable Link test", () => {
beforeEach(() => {
cy.visit("/");
});

it("shareable link", () => {
cy.get("select").select("sql");

cy.get("#status").should("have.text", "// Status\n");

cy.get("#editor")
.click()
.focused()
.type("{ctrl}a")
.clear()
.type("select * from lineitem;");

cy.get(".multiselect__tags").click();
cy.contains(".multiselect__option", "2001")
.click()

cy.get("button").contains("Generate").click();

cy.get("button").contains("Copy Link").click();

cy.window().then((window) => {
const link = window.navigator.clipboard.readText();
return link;
}).then((link) => {
cy.visit(link);
cy.get("#editor").should("not.be.empty")
cy.contains(".multiselect__tag", "1002").should("exist");
cy.contains(".multiselect__tag", "2001").should("exist");
});
});
});

2 changes: 1 addition & 1 deletion client/src/views/CodeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ export default {
},
async loadPlan(id) {
const resp = await getPlan(id);
const jsonObject = JSON.parse(resp.data.json_data);
const jsonObject = JSON.parse(resp.data.json_string);
this.code = JSON.stringify(jsonObject, null, 2);
this.language = "json";
Expand Down

0 comments on commit 104f571

Please sign in to comment.