From b87e7534ce2121e9dd1d809d3c8c0af91bdc24ae Mon Sep 17 00:00:00 2001 From: "acciojob-4[bot]" <123375191+acciojob-4[bot]@users.noreply.github.com> Date: Sat, 1 Feb 2025 18:23:44 +0000 Subject: [PATCH] Initial commit --- .github/workflows/test.yml | 10 ++++++++++ .gitignore | 1 + README.md | 3 +++ acciotest.json | 4 ++++ cypress.json | 1 + cypress/fixtures/example.json | 5 +++++ cypress/plugins/index.js | 22 ++++++++++++++++++++++ cypress/support/commands.js | 25 +++++++++++++++++++++++++ cypress/support/index.js | 20 ++++++++++++++++++++ index.js | 21 +++++++++++++++++++++ main.html | 16 ++++++++++++++++ package-lock.json | 5 +++++ package.json | 24 ++++++++++++++++++++++++ script.js | 1 + server.js | 4 ++++ styles.css | 1 + 16 files changed, 163 insertions(+) create mode 100644 .github/workflows/test.yml create mode 100644 .gitignore create mode 100644 README.md create mode 100644 acciotest.json create mode 100644 cypress.json create mode 100644 cypress/fixtures/example.json create mode 100644 cypress/plugins/index.js create mode 100644 cypress/support/commands.js create mode 100644 cypress/support/index.js create mode 100644 index.js create mode 100644 main.html create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 script.js create mode 100644 server.js create mode 100644 styles.css diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..55047f4 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,10 @@ +name: Acciojob Tests + +on: + push: + branches: [ "main","master" ] + +jobs: + calling-acciojob-main-action: + uses: acciojob/acciojob-tests-action/.github/workflows/main-action.yml@main + secrets: inherit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..40b878d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..646368b --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +## Create a card for pricing section of the page as shown below + +![card_image](https://storage.googleapis.com/acciojob-open-file-collections/pricing-card.png) diff --git a/acciotest.json b/acciotest.json new file mode 100644 index 0000000..af498de --- /dev/null +++ b/acciotest.json @@ -0,0 +1,4 @@ +{ + "testRepo": "pricing-card-solution", + "pathToFile": "cypress/integration/tests/test.spec.js" +} diff --git a/cypress.json b/cypress.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/cypress.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/cypress/fixtures/example.json b/cypress/fixtures/example.json new file mode 100644 index 0000000..e11abf5 --- /dev/null +++ b/cypress/fixtures/example.json @@ -0,0 +1,5 @@ +{ + "name": "Using fixtures to represent data", + "email": "hello@cypress.io", + "body": "Fixtures are a great way to mock data for responses to routes" +} \ No newline at end of file diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js new file mode 100644 index 0000000..0a2b59f --- /dev/null +++ b/cypress/plugins/index.js @@ -0,0 +1,22 @@ +/// +// *********************************************************** +// 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) + +/** + * @type {Cypress.PluginConfig} + */ +// eslint-disable-next-line no-unused-vars +module.exports = (on, config) => { + // `on` is used to hook into various events Cypress emits + // `config` is the resolved Cypress config +} \ No newline at end of file diff --git a/cypress/support/commands.js b/cypress/support/commands.js new file mode 100644 index 0000000..66ea16e --- /dev/null +++ b/cypress/support/commands.js @@ -0,0 +1,25 @@ +// *********************************************** +// This example commands.js 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) => { ... }) \ No newline at end of file diff --git a/cypress/support/index.js b/cypress/support/index.js new file mode 100644 index 0000000..63268c1 --- /dev/null +++ b/cypress/support/index.js @@ -0,0 +1,20 @@ +// *********************************************************** +// This example support/index.js 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') \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..d05aa5b --- /dev/null +++ b/index.js @@ -0,0 +1,21 @@ +// This file is not to be modified. Please ignore this. +// We will understand all of this later in the course. +// DO NOT MODIFY THIS FILE + +const express = require('express'); +const path = require('path'); + +const app = express(); + +app.use(express.static(__dirname)) + +app.get('/', (req, res) => { + res.sendFile(path.join(__dirname + '/main.html')); +}); +//your code here +app.post('/add', (req, res) => { + const {a,b} = req.body; + res.status(200).send(a+b); + // res.sendFile(path.join(__dirname + '/main.html')); +}); +module.exports = app; \ No newline at end of file diff --git a/main.html b/main.html new file mode 100644 index 0000000..b168043 --- /dev/null +++ b/main.html @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..53ef4fc --- /dev/null +++ b/package-lock.json @@ -0,0 +1,5 @@ +{ + "name": "Accio assignment solution", + "version": "1.0.0", + "lockfileVersion": 1 +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..bde4e65 --- /dev/null +++ b/package.json @@ -0,0 +1,24 @@ +{ + "name": "Accio assignment solution", + "version": "1.0.0", + "description": "Solution Template repo for Acciojob assignments", + "main": "index.js", + "scripts": { + "test": "jest --env=jsdom", + "start": "node server.js" + }, + "jest": { + "verbose": true, + "testEnvironment": "jsdom" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "cypress": "^9.5.0", + "express": "^4.17.1", + "index.js": "0.0.3", + "jsdom": "^16.5.3", + "supertest": "^6.1.3" + } +} diff --git a/script.js b/script.js new file mode 100644 index 0000000..dc7fed3 --- /dev/null +++ b/script.js @@ -0,0 +1 @@ +//your JS code here. If required. diff --git a/server.js b/server.js new file mode 100644 index 0000000..52d2ed3 --- /dev/null +++ b/server.js @@ -0,0 +1,4 @@ +const app = require("./index.js"); +app.listen(3000, () => { + console.log('server started'); +}); \ No newline at end of file diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..8b464dc --- /dev/null +++ b/styles.css @@ -0,0 +1 @@ +/* your css code here. If applicable */