Skip to content
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

Tobias Casazza Movie Task #665

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions jobs/Frontend/movie-searcher/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_TMDB_AUTH_KEY=03b8572954325680265531140190fd2a
23 changes: 23 additions & 0 deletions jobs/Frontend/movie-searcher/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
46 changes: 46 additions & 0 deletions jobs/Frontend/movie-searcher/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
9 changes: 9 additions & 0 deletions jobs/Frontend/movie-searcher/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from "cypress";

export default defineConfig({
e2e: {
setupNodeEvents(on, config) {},
baseUrl: "http://localhost:3000",
experimentalStudio: true,
},
});
148 changes: 148 additions & 0 deletions jobs/Frontend/movie-searcher/cypress/e2e/search.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
describe("Quick test about the search of the app", () => {
beforeEach(() => {
cy.viewport(1000, 1000);
cy.visit("http://localhost:3000/");
});
it("Searching in the two fields works", () => {
cy.get(".MuiAutocomplete-root.css-b36q3f-MuiAutocomplete-root");
cy.get(
".sc-khLCKb > .MuiStack-root > .MuiAutocomplete-root > .MuiFormControl-root > .MuiInputBase-root > #customized-autocomplete"
).type("s");
cy.get(
".sc-khLCKb > .MuiStack-root > .MuiAutocomplete-root > .MuiFormControl-root > .MuiInputBase-root > #customized-autocomplete"
).type("t");
cy.get(
".sc-khLCKb > .MuiStack-root > .MuiAutocomplete-root > .MuiFormControl-root > .MuiInputBase-root > #customized-autocomplete"
).type("ar ");
cy.get(
".sc-khLCKb > .MuiStack-root > .MuiAutocomplete-root > .MuiFormControl-root > .MuiInputBase-root > #customized-autocomplete"
).type("wars");

cy.get(":nth-child(1) > .sc-cHqXqK > .sc-cEzcPc").should(
"include.text",
"Star Wars"
);

cy.wait(1000);
cy.get(":nth-child(1) > .sc-cHqXqK > .sc-cEzcPc").should(
"include.text",
" "
);

cy.get(
".sc-kEfuZE > .MuiStack-root > .MuiAutocomplete-root > .MuiFormControl-root > .MuiInputBase-root > #customized-autocomplete"
).type("inception");
cy.wait(1000);
cy.get(
".sc-kEfuZE > .MuiStack-root > .MuiAutocomplete-root > .MuiFormControl-root > .MuiInputBase-root > #customized-autocomplete"
).type(" ");
cy.get(":nth-child(1) > .sc-cHqXqK > .sc-cEzcPc").should(
"have.text",
"InceptionLanguage: enRelease: 2010-07-15Popularity: 124.3Vote Average: 8.369/10Cobb, a skilled thief who commits corporate espionage by infiltrating the subconscious of his targets is offered a chance to regain his old life as payment for a task considered to be impossible: \"inception\", the implantation of another person's idea into a target's subconscious."
);

cy.get(":nth-child(1) > .sc-cHqXqK > .sc-cEzcPc > .sc-eOzmre").click();
cy.get(".sc-jtQUzJ").should("be.visible");
cy.get(".sc-iqyJx").should("have.text", "Inception");
cy.get(".sc-CNKsk > :nth-child(4) > .sc-eWPXlR").should(
"have.text",
"Production Companies"
);
cy.get(":nth-child(1) > .sc-eWPXlR").should("have.text", "Genres");
cy.get(":nth-child(6) > .sc-eWPXlR").should("have.text", "Origin Country");
cy.get(":nth-child(9) > .sc-eWPXlR").should(
"have.text",
"Spoken Languages"
);
});
it("Sliders and home features works", () => {
cy.get(".sc-diYFot").should("have.text", "Movie Searcher");
cy.get(".sc-diYFot").click();
cy.get(
':nth-child(2) > .sc-iuUfFv > .eObrNj > [data-testid="KeyboardArrowRightIcon"]'
).click();
cy.get(
':nth-child(2) > .sc-iuUfFv > .eObrNj > [data-testid="KeyboardArrowRightIcon"]'
).click();
cy.get(
':nth-child(2) > .sc-iuUfFv > .eObrNj > [data-testid="KeyboardArrowRightIcon"]'
).click();
cy.get(
':nth-child(2) > .sc-iuUfFv > .eObrNj > [data-testid="KeyboardArrowRightIcon"]'
).click();
cy.get(
':nth-child(2) > .sc-iuUfFv > .eObrNj > [data-testid="KeyboardArrowRightIcon"]'
).click();
cy.get(
':nth-child(2) > .sc-iuUfFv > .eObrNj > [data-testid="KeyboardArrowRightIcon"]'
).click();
cy.get(
':nth-child(2) > .sc-iuUfFv > .eObrNj > [data-testid="KeyboardArrowRightIcon"]'
).click();
cy.get(
':nth-child(2) > .sc-iuUfFv > .eObrNj > [data-testid="KeyboardArrowRightIcon"]'
).click();
cy.get(
':nth-child(2) > .sc-iuUfFv > .eObrNj > [data-testid="KeyboardArrowRightIcon"]'
).click();
cy.get(
':nth-child(2) > .sc-iuUfFv > .eObrNj > [data-testid="KeyboardArrowRightIcon"]'
).click();

cy.get(
":nth-child(3) > .sc-iuUfFv > .sc-eUlrpB > .sc-geXuza > :nth-child(2) > .sc-cHqXqK > .sc-cEzcPc"
).should(
"have.text",
"The GodfatherLanguage: enRelease: 1972-03-14Popularity: 170.4Vote Average: 8.689/10Spanning the years 1945 to 1955, a chronicle of the fictional Italian-American Corleone crime family. When organized crime family patriarch, Vito Corleone barely survives an attempt on his life, his youngest son, Michael steps in to take care of the would-be killers, launching a campaign of bloody revenge."
);

cy.get(
':nth-child(3) > .sc-iuUfFv > .eObrNj > [data-testid="KeyboardArrowRightIcon"]'
).click();
cy.get(
':nth-child(3) > .sc-iuUfFv > .eObrNj > [data-testid="KeyboardArrowRightIcon"]'
).click();
cy.get(
':nth-child(3) > .sc-iuUfFv > .eObrNj > [data-testid="KeyboardArrowRightIcon"]'
).click();
cy.get(
':nth-child(3) > .sc-iuUfFv > .eObrNj > [data-testid="KeyboardArrowRightIcon"]'
).click();
cy.get(
':nth-child(3) > .sc-iuUfFv > .eObrNj > [data-testid="KeyboardArrowRightIcon"]'
).click();
cy.get(
':nth-child(3) > .sc-iuUfFv > .eObrNj > [data-testid="KeyboardArrowRightIcon"]'
).click();
cy.get(
':nth-child(3) > .sc-iuUfFv > .eObrNj > [data-testid="KeyboardArrowRightIcon"]'
).click();

cy.get(
":nth-child(3) > .sc-iuUfFv > .sc-eUlrpB > .sc-geXuza > :nth-child(8) > .sc-cHqXqK > .sc-cEzcPc"
).should(
"have.text",
"The Dark KnightLanguage: enRelease: 2008-07-16Popularity: 170.6Vote Average: 8.5/10Batman raises the stakes in his war on crime. With the help of Lt. Jim Gordon and District Attorney Harvey Dent, Batman sets out to dismantle the remaining criminal organizations that plague the streets. The partnership proves to be effective, but they soon find themselves prey to a reign of chaos unleashed by a rising criminal mastermind known to the terrified citizens of Gotham as the Joker."
);
});

it("The quick search in searchers works", () => {
cy.get(
".sc-khLCKb > .MuiStack-root > .MuiAutocomplete-root > .MuiFormControl-root > .MuiInputBase-root > #customized-autocomplete"
).type("the lo");
cy.get("#customized-autocomplete-option-0 > .sc-gtLWhw").click();
cy.get(".sc-iqyJx").should(
"have.text",
"The Lord of the Rings: The Fellowship of the Ring"
);
cy.get(".sc-diYFot").click();

cy.get(
".sc-kEfuZE > .MuiStack-root > .MuiAutocomplete-root > .MuiFormControl-root > .MuiInputBase-root > #customized-autocomplete"
).type("Harry");
cy.get(
"#customized-autocomplete-option-1 > .sc-gtLWhw > .sc-dntaoT"
).click();
cy.get(".sc-iqyJx").should("include.text", "Harry Potter");
});
});
5 changes: 5 additions & 0 deletions jobs/Frontend/movie-searcher/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"
}
37 changes: 37 additions & 0 deletions jobs/Frontend/movie-searcher/cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/// <reference types="cypress" />
// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }
20 changes: 20 additions & 0 deletions jobs/Frontend/movie-searcher/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
Loading