Skip to content

Instantly share code, notes, and snippets.

View PierreCavalet's full-sized avatar

Pierre Cavalet PierreCavalet

  • Kaliop Interactive Media
  • Montpellier, France
View GitHub Profile
const router = require('../services/router')
Cypress.Commands.add('goTo', (routeName) => {
cy.visit(router.resolve(routeName))
})
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],
}
@PierreCavalet
PierreCavalet / homepage.spec.js
Last active May 6, 2020 08:44
with goTo command
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')
})
})
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('myemail@email.com')
cy.get('[data-cy="password-input"]').type('*secretPassword*')
cy.get('[data-cy="submit-button"]').click()
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)
},
})
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('myemail@email.com')
cy.get('[data-cy="password-input"]').type('*secretPassword*')
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')
})
})
{
"took": 29,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 3,
curl -X GET "localhost:9200/useralgo/_search" -H 'Content-Type: application/json' -d'
{
"query": {
"function_score": {
"query": {"match_all": {}},
"functions": [
{
"filter": {
"bool": {
"must_not": {
curl -X GET "localhost:9200/useralgo/_search" -H 'Content-Type: application/json' -d'
{
"query": {
"function_score": {
"query": {"match_all": {}},
"functions": [
{
"filter": {
"bool": {
"must_not": {