Skip to content

Commit

Permalink
cypress test test.html in cypress/pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Kurtil committed May 12, 2020
1 parent b558ebc commit d9d3d9e
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cypress.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"baseUrl": "http://localhost:3030"
"baseUrl": "http://localhost:3030/cypress/pages/"
}
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
22 changes: 19 additions & 3 deletions cypress/integration/test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
describe('My First Test', () => {
it('Does not do much!', () => {
expect(true).to.equal(true)
describe('Starting with simple area', () => {
beforeEach(() => {
cy.visit('test');
const cfg = {
components: [{ render(h) { return h("div", "Hey !") } }],
layout: {
componentIndex: 0
}
};
cy.window().then(win => {
win.areas = win.mountApp(cfg);
});
});

it('Should render the simple area', () => {
cy.get("#window-1").contains("Hey !");
cy.window().then(win => {
cy.get("#app").then(app => expect(win.areas.$el).to.equal(app))
})
});
});
33 changes: 33 additions & 0 deletions cypress/pages/test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Window manager</title>
</head>

<body>
<div id="app"></div>
<script type="module">
import Vue from 'https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.esm.browser.js';
import WindowManager from "../../dist/windowmanager.esm.js";

window.mountApp = cfg =>
new Vue({
render(h) {
return h("div", { style: "width: 80%; margin: auto; height: 600px;", domProps: { id: "app" } }, [h(WindowManager,
{
ref: "windowmanager",
props: {
cfg
}
}
)]);
},
}).$mount('#app');
// vm.$refs.windowmanager.getComponentByName("comp1").cfg.props.text = "Youhou ! =D"; // This is reactive !
</script>
</body>

</html>
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"scripts": {
"test:unit": "jest ./unitTest",
"test:e2e": "npm run build:prod && start-server-and-test 'npm run serve -- -p 3030' 3030 cy:run",
"serve": "http-server . -c-1",
"cy:run": "cypress run",
"serve": "http-server -c-1",
"cy:run": "cypress open",
"build:dev": "rollup -c --environment BUILD:development",
"build:prod": "rollup -c --environment BUILD:production",
"prebuild": "rm -rf dist",
Expand Down

0 comments on commit d9d3d9e

Please sign in to comment.