-
Notifications
You must be signed in to change notification settings - Fork 17
Add getting started Vue.js #431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
a956d99
Add getting started Vue.js
Aschen 68a520f
test fix netlify
berthieresteban 9cc266e
test fix netlify
berthieresteban 149d54f
test fix netlify
berthieresteban d25d801
Merge branch '6-dev' of github.com:kuzzleio/sdk-javascript into getti…
berthieresteban 225d946
refresh index for tests
berthieresteban 31afb1c
Update doc/6/getting-started/vuejs/standalone/index.md
berthieresteban 9afd13e
Update doc/6/getting-started/vuejs/standalone/index.md
berthieresteban 41083c6
Update doc/6/getting-started/vuejs/standalone/index.md
berthieresteban c892487
Update doc/6/getting-started/vuejs/standalone/index.md
berthieresteban fc40cda
Update doc/6/getting-started/vuejs/standalone/index.md
berthieresteban feffc90
Apply suggestions from code review
berthieresteban 75789c2
remove cypress unused file and comments
berthieresteban c57fa9f
precise readme
berthieresteban 708816e
camelCase
berthieresteban 9beca09
Merge branch 'master' of github.com:kuzzleio/sdk-javascript into gett…
berthieresteban 50040c4
Apply suggestions from code review
berthieresteban 2ebcea5
flatten + catch promises & delete version.md & previous version of d…
berthieresteban f6caa53
cypress command
berthieresteban 13b08ff
cypress commands
berthieresteban d20ca66
typo
berthieresteban 8618a39
cypress tests
berthieresteban 51cad6e
Merge branch 'master' of github.com:kuzzleio/sdk-javascript into gett…
berthieresteban d985d97
Merge branch 'getting-started-vuejs-standalone' of github.com:kuzzlei…
berthieresteban c441bd1
cypress tests
berthieresteban File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"baseUrl": "http://localhost:8080", | ||
"projectId": "ce9wca", | ||
"videoUploadOnPasses": false, | ||
"viewportWidth": 1400, | ||
"viewportHeight": 900, | ||
"defaultCommandTimeout": 5000, | ||
"env": { | ||
"kuzzle": { | ||
"host": "localhost", | ||
"port": "7512", | ||
"index": "chat", | ||
"collection": "messages" | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"username": "Elrond" | ||
} |
23 changes: 23 additions & 0 deletions
23
doc/6/getting-started/.vuejs/cypress/fixtures/Legolas.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"username": "Legolas", | ||
"messages": [ | ||
{ | ||
"body": { | ||
"value": "It still only counts as one!", | ||
"username": "Gimli" | ||
} | ||
}, | ||
{ | ||
"body": { | ||
"value": "What do your elf eyes see?", | ||
"username": "Aragorn" | ||
} | ||
}, | ||
{ | ||
"body": { | ||
"value": "What about side by side with a friend?", | ||
"username": "Legolas" | ||
} | ||
} | ||
] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"username": "Sam", | ||
"body": { | ||
"username": "Sam", | ||
"value": "I can't carry it for you, But I can carry you!" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"username": "Sauron", | ||
"body": { | ||
"username": "Eowyn", | ||
"value": "I am no man" | ||
} | ||
} |
86 changes: 86 additions & 0 deletions
86
doc/6/getting-started/.vuejs/cypress/integration/chat.spec.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
describe('test realtime chat', () => { | ||
|
||
it('should enter a nickname', function () { | ||
cy.fixture(`Elrond.json`).as('fixt') | ||
.then(() => cy.loadEnvironment(this.fixt)) | ||
.then(() => cy.wait(2000)) | ||
.then(() => { | ||
cy.visit('/'); | ||
cy.get('[placeholder="Enter your message"]') | ||
.should('not.exist'); | ||
|
||
cy.get('[placeholder="Enter your nickname"]') | ||
.type(this.fixt.username); | ||
|
||
cy.contains('Valid') | ||
.click(); | ||
|
||
cy.get('[placeholder="Enter your message"]') | ||
.should('exist'); | ||
cy.get('[placeholder="Enter your nickname"]') | ||
.should('not.exist'); | ||
}); | ||
}); | ||
|
||
it('should fetch and display some messages', function () { | ||
cy.fixture(`Legolas.json`).as('fixt') | ||
.then(() => cy.loadEnvironment(this.fixt)) | ||
.then(() => cy.wait(2000)) | ||
.then(() => { | ||
cy.visit('/'); | ||
cy.get('[placeholder="Enter your nickname"]') | ||
.type(this.fixt.username); | ||
cy.contains('Valid') | ||
.click(); | ||
for (const message of this.fixt.messages) { | ||
cy.get(message.body.username === this.fixt.username ? '.fromMe' : '.fromOthers') | ||
.within(() => { | ||
cy.contains(message.body.username); | ||
cy.contains(message.body.value); | ||
}); | ||
} | ||
}); | ||
}); | ||
|
||
it('should send a message', function () { | ||
cy.fixture(`Sam.json`).as('fixt') | ||
.then(() => cy.loadEnvironment(this.fixt)) | ||
.then(() => cy.wait(2000)) | ||
.then(() => { | ||
cy.visit('/'); | ||
cy.get('[placeholder="Enter your nickname"]') | ||
.type(this.fixt.username); | ||
cy.contains('Valid') | ||
.click(); | ||
cy.get('[placeholder="Enter your message"]') | ||
.type(this.fixt.body.value); | ||
cy.contains('Send') | ||
.click(); | ||
cy.get('.fromMe') | ||
.within(() => { | ||
cy.contains(this.fixt.body.value); | ||
cy.contains(this.fixt.body.username); | ||
}); | ||
}); | ||
}); | ||
|
||
it('should receive a message', function () { | ||
cy.fixture(`Sauron.json`).as('fixt') | ||
.then(() => cy.loadEnvironment(this.fixt)) | ||
.then(() => cy.wait(2000)) | ||
.then(() => { | ||
cy.visit('/'); | ||
cy.get('[placeholder="Enter your nickname"]') | ||
.type(this.fixt.username); | ||
cy.contains('Valid') | ||
.click(); | ||
cy.wait(2000) | ||
cy.createMessage(this.fixt.body); | ||
cy.get('.fromOthers') | ||
.within(() => { | ||
cy.contains(this.fixt.body.value); | ||
cy.contains(this.fixt.body.username); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// *********************************************************** | ||
// This example plugins/index.js can be used to load plugins | ||
// | ||
// You can change the location of this file or turn off loading | ||
// the plugins file with the 'pluginsFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/plugins-guide | ||
// *********************************************************** | ||
|
||
// This function is called when a project is opened or re-opened (e.g. due to | ||
// the project's config changing) | ||
|
||
module.exports = (on, config) => { | ||
// `on` is used to hook into various events Cypress emits | ||
// `config` is the resolved Cypress config | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
function reinitialisation() { | ||
const kuzzle = Cypress.env('kuzzle'); | ||
// Clear collection | ||
return cy | ||
.request({ | ||
url: `http://${kuzzle.host}:${kuzzle.port}/${kuzzle.index}`, | ||
method: 'DELETE', | ||
failOnStatusCode: false | ||
}) | ||
.then(deleteResponse => { | ||
cy.log(`Request : delete ${kuzzle.index} status : ${deleteResponse.status}`); | ||
cy.wait(2000); | ||
// Create index | ||
}); | ||
} | ||
|
||
Cypress.Commands.add('createMessage', (body) => { | ||
const kuzzle = Cypress.env('kuzzle'); | ||
return cy | ||
.request({ | ||
url: `http://${kuzzle.host}:${kuzzle.port}/${kuzzle.index}/${kuzzle.collection}/_create`, | ||
method: 'POST', | ||
body: body, | ||
}) | ||
.its('body') | ||
.then(response => { | ||
cy.log(`Create status : ${response.status} {${body.username} / ${body.value}}`); | ||
cy.wait(500); | ||
}); | ||
}); | ||
|
||
Cypress.Commands.add('initialisation', () => { | ||
const kuzzle = Cypress.env('kuzzle'); | ||
// Delete index if exists | ||
return cy | ||
.request({ | ||
url: `http://${kuzzle.host}:${kuzzle.port}/${kuzzle.index}`, | ||
method: 'DELETE', | ||
failOnStatusCode: false | ||
}) | ||
.then(deleteResponse => { | ||
cy.log(`Request : delete ${kuzzle.index} status : ${deleteResponse.status}`); | ||
// Create index | ||
return cy | ||
.request({ | ||
url: `http://${kuzzle.host}:${kuzzle.port}/${kuzzle.index}/_create`, | ||
method: 'POST', | ||
}) | ||
}) | ||
.then(createIndexResponse => { | ||
cy.log(`Request : create ${kuzzle.index} status : ${createIndexResponse.status}`); | ||
cy.wait(500); | ||
// Create collection | ||
return cy | ||
.request({ | ||
url: `http://${kuzzle.host}:${kuzzle.port}/${kuzzle.index}/${kuzzle.collection}`, | ||
method: 'PUT', | ||
body: {} | ||
}) | ||
}) | ||
.then(createCollectionResponse => { | ||
cy.log(`Request : create ${kuzzle.collection} status : ${createCollectionResponse.status}`); | ||
cy.wait(500); | ||
}); | ||
}); | ||
|
||
Cypress.Commands.add('loadEnvironment', (env) => { | ||
const kuzzle = Cypress.env('kuzzle'); | ||
if (!env.messages) { | ||
return reinitialisation(); | ||
} else { | ||
return cy | ||
.initialisation() | ||
.then(() => { | ||
return cy | ||
.request({ | ||
url: `http://${kuzzle.host}:${kuzzle.port}/${kuzzle.index}/${kuzzle.collection}/_mCreate`, | ||
method: 'POST', | ||
body: { "documents": env.messages }, | ||
}) | ||
}) | ||
.then(response => { | ||
cy.log(`mCreate status : ${response.status}`); | ||
cy.wait(500); | ||
return cy | ||
.request({ | ||
url: `http://${kuzzle.host}:${kuzzle.port}/${kuzzle.index}/_refresh`, | ||
method: 'POST', | ||
}) | ||
}) | ||
.then((response) => { | ||
cy.log(`refresh status : ${response.status}`); | ||
cy.wait(500); | ||
}); | ||
} | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import './commands' |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.