diff --git a/software/day05/Svelte/.gitignore b/software/day05/Svelte/.gitignore new file mode 100644 index 0000000..a547bf3 --- /dev/null +++ b/software/day05/Svelte/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/software/day05/Svelte/.vscode/extensions.json b/software/day05/Svelte/.vscode/extensions.json new file mode 100644 index 0000000..bdef820 --- /dev/null +++ b/software/day05/Svelte/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["svelte.svelte-vscode"] +} diff --git a/software/day05/Svelte/README.md b/software/day05/Svelte/README.md new file mode 100644 index 0000000..49c7c1c --- /dev/null +++ b/software/day05/Svelte/README.md @@ -0,0 +1,287 @@ +# PoC Software Pool 2023 - Day 05 - Svelte + +**Day purposes** + +โ Create your own User Interface (UI) with Svelte and Flowbite Svelte โจ + +โ Structure your UI ๐ง + +โ Test your UI ๐งโ๐ป + +## Introduction + +*[Svelte](https://svelte.dev/) is a Javascript library to build user interfaces.* + +**What is a user interface?** + +A user interface (UI) is the point at which humans interact with a computer, a website or an application. ๐ป + +For instance, your terminal is a user interface. + +**What does this Javascript library allow us to do?** + +Thanks to Svelte, you can build [components](https://svelte.dev/docs/svelte-components). A component is a Javascript function that returns a Javascript object representing a DOM element in memory. + +> ๐ก DOM stands for Document Object Model, which is the HTML representation of a web page. As a consequence, a DOM element is a part of the HTML representation of a web page. + +However, unlike [React](https://en.reactjs.org/), Svelte doesn't rely on a virtual DOM to update the actual DOM. Instead, it compiles your components into optimized Javascript code. This approach makes the rendering of your app more efficient. ๐ + +> The real DOM is the HTML representation of the web page that the user sees. It's updated by [queries](https://burlingtoncodeacademy.github.io/webdev-prework-track/DOM_queries). The virtual DOM is a copy of the real DOM. + +
+ + + +
+ +> ๐ Don't hesitate to follow us on our different networks, and put a star ๐ on `PoC's` repositories. diff --git a/software/day05/Svelte/cypress.config.ts b/software/day05/Svelte/cypress.config.ts new file mode 100644 index 0000000..8f32dff --- /dev/null +++ b/software/day05/Svelte/cypress.config.ts @@ -0,0 +1,8 @@ +import { defineConfig } from 'cypress'; + +export default defineConfig({ + e2e: { + supportFile: false, + baseUrl: 'http://localhost:5173', + }, +}); diff --git a/software/day05/Svelte/cypress/e2e/home.cy.ts b/software/day05/Svelte/cypress/e2e/home.cy.ts new file mode 100644 index 0000000..480004e --- /dev/null +++ b/software/day05/Svelte/cypress/e2e/home.cy.ts @@ -0,0 +1,58 @@ +describe('Good front for Home page', () => { + + it('Go to home Page', () => { + cy.visit('/'); + }); + + beforeEach(() => { + cy.visit('/'); + }); + + it('Good title', () => { + cy.get('#app-title').should('contain', 'Artists Book'); + }); + + it('Good sub title', () => { + cy.get('#app-sub-title').should('contain', 'Manage your favorite Artists'); + }); + + it('Good number of buttons', () => { + cy.get('button').should('have.length', 2); + }); + + it('Good name for create account button', () => { + cy.get('#homePage-register-button').should('contain', 'Create an account'); + }); + + it('Good name for login button', () => { + cy.get('#homePage-login-button').should('contain', 'Login'); + }); +}); + +describe('Create account button for Home page', () => { + it('Go to home Page', () => { + cy.visit('/'); + }); + + beforeEach(() => { + cy.visit('/'); + }); + + it('Good URL redirect for create account button', () => { + cy.get('#homePage-register-button').click().url().should('eq', `${Cypress.config().baseUrl}/register`); + }); +}); + +describe('Login button in Home page', () => { + it('Go to home Page', () => { + cy.visit('/'); + }); + + beforeEach(() => { + cy.visit('/'); + }); + + it('Good URL redirect for login button', () => { + cy.get('#homePage-login-button').click().url().should('eq', `${Cypress.config().baseUrl}/login`); + }); +}); diff --git a/software/day05/Svelte/cypress/e2e/login.cy.ts b/software/day05/Svelte/cypress/e2e/login.cy.ts new file mode 100644 index 0000000..887240d --- /dev/null +++ b/software/day05/Svelte/cypress/e2e/login.cy.ts @@ -0,0 +1,39 @@ +describe('Good front for Login page', () => { + it('Go to login page', () => { + cy.visit('/login'); + }); + + beforeEach(() => { + cy.visit('/login'); + }); + + it('Good number of buttons', () => { + cy.get('button').should('have.length', 2); + }); + + it('Good number of inputs', () => { + cy.get('input').should('have.length', 2); + }); + + it('Good name for login button', () => { + cy.get('#loginPage-login-button').should('contain', 'Login'); + }); + + it('Good name for register button', () => { + cy.get('#loginPage-register-button').should('contain', 'New user ? Register'); + }); +}); + +describe('Register button in Login page', () => { + it('Go to login page', () => { + cy.visit('/login'); + }); + + beforeEach(() => { + cy.visit('/login'); + }); + + it('Good URL redirect for register button', () => { + cy.get('#loginPage-register-button').click().url().should('eq', `${Cypress.config().baseUrl}/register`); + }); +}); diff --git a/software/day05/Svelte/cypress/e2e/register.cy.ts b/software/day05/Svelte/cypress/e2e/register.cy.ts new file mode 100644 index 0000000..8b61868 --- /dev/null +++ b/software/day05/Svelte/cypress/e2e/register.cy.ts @@ -0,0 +1,39 @@ +describe('Good front for Register page', () => { + it('Go to register page', () => { + cy.visit('/register'); + }); + + beforeEach(() => { + cy.visit('/register'); + }); + + it('Good number of buttons', () => { + cy.get('button').should('have.length', 2); + }); + + it('Good number of inputs', () => { + cy.get('input').should('have.length', 3); + }); + + it('Good name for register button', () => { + cy.get('#registerPage-register-button').should('contain', 'Register'); + }); + + it('Good name for login button', () => { + cy.get('#registerPage-login-button').should('contain', 'Already a user ? Login'); + }); +}); + +describe('Login button in register page', () => { + it('Go to register page', () => { + cy.visit('/register'); + }); + + beforeEach(() => { + cy.visit('/register'); + }); + + it('Good URL redirect for login button', () => { + cy.get('#registerPage-login-button').click().url().should('eq', `${Cypress.config().baseUrl}/login`); + }); +}); diff --git a/software/day05/Svelte/cypress/screenshots/home.cy.ts/Create account button for Home page -- Good URL redirect for create account button (failed).png b/software/day05/Svelte/cypress/screenshots/home.cy.ts/Create account button for Home page -- Good URL redirect for create account button (failed).png new file mode 100644 index 0000000..eed024e Binary files /dev/null and b/software/day05/Svelte/cypress/screenshots/home.cy.ts/Create account button for Home page -- Good URL redirect for create account button (failed).png differ diff --git a/software/day05/Svelte/cypress/screenshots/home.cy.ts/Good front for Home page -- Good name for create account button (failed).png b/software/day05/Svelte/cypress/screenshots/home.cy.ts/Good front for Home page -- Good name for create account button (failed).png new file mode 100644 index 0000000..39a1220 Binary files /dev/null and b/software/day05/Svelte/cypress/screenshots/home.cy.ts/Good front for Home page -- Good name for create account button (failed).png differ diff --git a/software/day05/Svelte/cypress/screenshots/home.cy.ts/Good front for Home page -- Good name for login button (failed).png b/software/day05/Svelte/cypress/screenshots/home.cy.ts/Good front for Home page -- Good name for login button (failed).png new file mode 100644 index 0000000..da61b99 Binary files /dev/null and b/software/day05/Svelte/cypress/screenshots/home.cy.ts/Good front for Home page -- Good name for login button (failed).png differ diff --git a/software/day05/Svelte/cypress/screenshots/home.cy.ts/Good front for Home page -- Good number of buttons (failed).png b/software/day05/Svelte/cypress/screenshots/home.cy.ts/Good front for Home page -- Good number of buttons (failed).png new file mode 100644 index 0000000..924ec50 Binary files /dev/null and b/software/day05/Svelte/cypress/screenshots/home.cy.ts/Good front for Home page -- Good number of buttons (failed).png differ diff --git a/software/day05/Svelte/cypress/screenshots/home.cy.ts/Good front for Home page -- Good sub title (failed).png b/software/day05/Svelte/cypress/screenshots/home.cy.ts/Good front for Home page -- Good sub title (failed).png new file mode 100644 index 0000000..bc46446 Binary files /dev/null and b/software/day05/Svelte/cypress/screenshots/home.cy.ts/Good front for Home page -- Good sub title (failed).png differ diff --git a/software/day05/Svelte/cypress/screenshots/home.cy.ts/Good front for Home page -- Good title (failed).png b/software/day05/Svelte/cypress/screenshots/home.cy.ts/Good front for Home page -- Good title (failed).png new file mode 100644 index 0000000..52ce1ed Binary files /dev/null and b/software/day05/Svelte/cypress/screenshots/home.cy.ts/Good front for Home page -- Good title (failed).png differ diff --git a/software/day05/Svelte/cypress/screenshots/home.cy.ts/Login button in Home page -- Good URL redirect for login button (failed).png b/software/day05/Svelte/cypress/screenshots/home.cy.ts/Login button in Home page -- Good URL redirect for login button (failed).png new file mode 100644 index 0000000..4e0a848 Binary files /dev/null and b/software/day05/Svelte/cypress/screenshots/home.cy.ts/Login button in Home page -- Good URL redirect for login button (failed).png differ diff --git a/software/day05/Svelte/cypress/screenshots/login.cy.ts/Good front for Login page -- Good title (failed).png b/software/day05/Svelte/cypress/screenshots/login.cy.ts/Good front for Login page -- Good title (failed).png new file mode 100644 index 0000000..40e5001 Binary files /dev/null and b/software/day05/Svelte/cypress/screenshots/login.cy.ts/Good front for Login page -- Good title (failed).png differ diff --git a/software/day05/Svelte/cypress/tsconfig.json b/software/day05/Svelte/cypress/tsconfig.json new file mode 100644 index 0000000..8ad6a6e --- /dev/null +++ b/software/day05/Svelte/cypress/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "target": "ES2022", + "types": ["cypress"] + }, + "include": [ + "e2e/**/*.ts", + ] +} diff --git a/software/day05/Svelte/index.html b/software/day05/Svelte/index.html new file mode 100644 index 0000000..b6c5f0a --- /dev/null +++ b/software/day05/Svelte/index.html @@ -0,0 +1,13 @@ + + + + + + +{artist.name}
+{artist.nationality}
+{artist.musicGender}
+Rate the artist
+ {#each ratings as score, i} + rating = score }> +Manage your favorite Artists
+