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
const router = require('../services/router') | |
Cypress.Commands.add('goTo', (routeName) => { | |
cy.visit(router.resolve(routeName)) | |
}) |
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
const routes = { | |
home: 'https://workshop-cypress-kaliop.netlify.app/', | |
login: 'https://workshop-cypress-kaliop.netlify.app/login', | |
signup: 'https://workshop-cypress-kaliop.netlify.app/signup', | |
} | |
const router = { | |
resolve: (name) => routes[name], | |
} |
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
describe('Homepage', () => { | |
it('Checks if everything is in the page', () => { | |
cy.goTo('home') | |
cy.get('[data-cy="home-title"]').should('exist') | |
cy.get('[data-cy="home-gif"]').should('exist') | |
}) | |
}) |
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
describe('Signup', () => { | |
it('Should signup the user', () => { | |
cy.visit(`https://workshop-cypress-kaliop.netlify.app/signup`) | |
cy.get(`[data-cy="signup-gif"]`).should('exist') | |
cy.get('[data-cy="firstname-input"]').type('Jordan') | |
cy.get('[data-cy="lastname-input"]').type('Jordan') | |
cy.get('[data-cy="email-input"]').type('[email protected]') | |
cy.get('[data-cy="password-input"]').type('*secretPassword*') | |
cy.get('[data-cy="submit-button"]').click() |
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
const axios = require('axios') | |
module.exports = (on, config) => { | |
on('task', { | |
getCode() { | |
return axios | |
.get('https://us-central1-random-d85ea.cloudfunctions.net/codeWorkshop') | |
.then((response) => response.data.code) | |
}, | |
}) |
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
describe('Login', () => { | |
it('Should log the user from home page', () => { | |
cy.visit('https://workshop-cypress-kaliop.netlify.app/') | |
cy.get('[data-cy="login-link"]').click() | |
cy.url().should('eq', 'https://workshop-cypress-kaliop.netlify.app/login') | |
cy.get('[data-cy="login-gif"]').should('exist') | |
cy.get('[data-cy="email-input"]').type('[email protected]') | |
cy.get('[data-cy="password-input"]').type('*secretPassword*') |
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
describe('Homepage', () => { | |
it('Checks if everything is in the page', () => { | |
cy.visit('https://workshop-cypress-kaliop.netlify.app/') | |
cy.get('[data-cy="home-title"]').should('exist') | |
cy.get('[data-cy="home-gif"]').should('exist') | |
}) | |
}) |
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
{ | |
"took": 29, | |
"timed_out": false, | |
"_shards": { | |
"total": 5, | |
"successful": 5, | |
"failed": 0 | |
}, | |
"hits": { | |
"total": 3, |
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
curl -X GET "localhost:9200/useralgo/_search" -H 'Content-Type: application/json' -d' | |
{ | |
"query": { | |
"function_score": { | |
"query": {"match_all": {}}, | |
"functions": [ | |
{ | |
"filter": { | |
"bool": { | |
"must_not": { |
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
curl -X GET "localhost:9200/useralgo/_search" -H 'Content-Type: application/json' -d' | |
{ | |
"query": { | |
"function_score": { | |
"query": {"match_all": {}}, | |
"functions": [ | |
{ | |
"filter": { | |
"bool": { | |
"must_not": { |
NewerOlder