Skip to content
Merged
Show file tree
Hide file tree
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 Jul 22, 2019
68a520f
test fix netlify
berthieresteban Jul 29, 2019
9cc266e
test fix netlify
berthieresteban Jul 29, 2019
149d54f
test fix netlify
berthieresteban Jul 29, 2019
d25d801
Merge branch '6-dev' of github.com:kuzzleio/sdk-javascript into getti…
berthieresteban Aug 1, 2019
225d946
refresh index for tests
berthieresteban Aug 1, 2019
31afb1c
Update doc/6/getting-started/vuejs/standalone/index.md
berthieresteban Aug 16, 2019
9afd13e
Update doc/6/getting-started/vuejs/standalone/index.md
berthieresteban Aug 16, 2019
41083c6
Update doc/6/getting-started/vuejs/standalone/index.md
berthieresteban Aug 16, 2019
c892487
Update doc/6/getting-started/vuejs/standalone/index.md
berthieresteban Aug 16, 2019
fc40cda
Update doc/6/getting-started/vuejs/standalone/index.md
berthieresteban Aug 16, 2019
feffc90
Apply suggestions from code review
berthieresteban Aug 16, 2019
75789c2
remove cypress unused file and comments
berthieresteban Aug 16, 2019
c57fa9f
precise readme
berthieresteban Aug 16, 2019
708816e
camelCase
berthieresteban Aug 16, 2019
9beca09
Merge branch 'master' of github.com:kuzzleio/sdk-javascript into gett…
berthieresteban Aug 16, 2019
50040c4
Apply suggestions from code review
berthieresteban Aug 23, 2019
2ebcea5
flatten + catch promises & delete version.md & previous version of d…
berthieresteban Aug 27, 2019
f6caa53
cypress command
berthieresteban Sep 6, 2019
13b08ff
cypress commands
berthieresteban Sep 6, 2019
d20ca66
typo
berthieresteban Sep 6, 2019
8618a39
cypress tests
berthieresteban Oct 2, 2019
51cad6e
Merge branch 'master' of github.com:kuzzleio/sdk-javascript into gett…
berthieresteban Oct 2, 2019
d985d97
Merge branch 'getting-started-vuejs-standalone' of github.com:kuzzlei…
berthieresteban Oct 2, 2019
c441bd1
cypress tests
berthieresteban Oct 3, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ examples/node_modules/
coverage/

doc/framework
dead_links.json
dead_links.json
doc/6/getting-started/.vuejs/cypress/screenshots/
doc/6/getting-started/.vuejs/cypress/videos/
16 changes: 16 additions & 0 deletions doc/6/getting-started/.vuejs/cypress.json
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"
}
}
}
3 changes: 3 additions & 0 deletions doc/6/getting-started/.vuejs/cypress/fixtures/Elrond.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"username": "Elrond"
}
23 changes: 23 additions & 0 deletions doc/6/getting-started/.vuejs/cypress/fixtures/Legolas.json
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"
}
}
]
}
7 changes: 7 additions & 0 deletions doc/6/getting-started/.vuejs/cypress/fixtures/Sam.json
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!"
}
}
7 changes: 7 additions & 0 deletions doc/6/getting-started/.vuejs/cypress/fixtures/Sauron.json
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 doc/6/getting-started/.vuejs/cypress/integration/chat.spec.js
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);
});
});
});
});
17 changes: 17 additions & 0 deletions doc/6/getting-started/.vuejs/cypress/plugins/index.js
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
}
96 changes: 96 additions & 0 deletions doc/6/getting-started/.vuejs/cypress/support/commands.js
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);
});
}
});
1 change: 1 addition & 0 deletions doc/6/getting-started/.vuejs/cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './commands'
Loading