shishir 3 anni fa
parent
commit
7060363f60

+ 12 - 49
.gitignore

@@ -1,50 +1,13 @@
-# These are some examples of commonly ignored file patterns.
-# You should customize this list as applicable to your project.
-# Learn more about .gitignore:
-#     https://www.atlassian.com/git/tutorials/saving-changes/gitignore
-
-# Node artifact files
-node_modules/
-dist/
-
-# Compiled Java class files
-*.class
-
-# Compiled Python bytecode
-*.py[cod]
-
-# Log files
-*.log
-
-# Package files
-*.jar
-
-# Maven
-target/
-dist/
-
-# JetBrains IDE
-.idea/
-
-# Unit test reports
-TEST*.xml
-
-# Generated by MacOS
+node_modules
+.vscode
+.idea
 .DS_Store
-
-# Generated by Windows
-Thumbs.db
-
-# Applications
-*.app
-*.exe
-*.war
-
-# Large media files
-*.mp4
-*.tiff
-*.avi
-*.flv
-*.mov
-*.wmv
-
+npm-debug.log
+*.iml
+*.patch
+package-lock.json
+cypress/videos/
+cypress/screenshots/
+cypress/results/
+cypress/testResults/
+mochawesome-report/

+ 62 - 0
README.md

@@ -0,0 +1,62 @@
+# Introduction
+
+This a bare minimum framework setup of cypress for SDET Assessment
+
+## Tests Covered:
+
+* UI
+
+## Framework used:
+
+* Cypress
+
+## Design Pattern used:
+* Page Object Model _(POM)_
+
+## Prerequisite:
+* npm - 7.24.0
+* node - 16.10.0
+
+## Steps to Run:
+
+1. Clone GIT repository in named directory.
+
+   **_Run:_**
+    ```
+     > cd ~/workspace/
+     > mkdir <cypress_directory_name>
+     > cd <cypress_directory_name>
+     > git clone https://krshishir@bitbucket.org/livelike/cypress.git
+    ```     
+
+2. Install all dependencies -
+
+   **_Run:_**
+    ```
+        > cd ~/workspace/<cypress_directory_name>/<where_your_package.json_is>
+        > npm install cypress
+        > npm install
+     ```       
+   **Note**: This will install all dependencies project will be using for executing.
+
+
+3. To run test -
+
+   **_Run:_**
+    ```
+    > cd ~/workspace/<cypress_directory_name>
+    > npx cypress open
+    ```
+    - This will run all tests under <cypress_directory_name> directory
+
+## Additional Information
+
+* cypress.json can be use to make any config change i.e baseUrl
+
+## Author
+
+* Tarun Maini
+
+## References
+
+* <https://www.cypress.io/>

+ 3 - 0
cypress.json

@@ -0,0 +1,3 @@
+{
+  "baseUrl": "https://www.google.co.in"
+}

+ 4 - 0
cypress/fixtures/example.json

@@ -0,0 +1,4 @@
+{
+  "name": "Using fixtures to represent data",
+  "body": "Fixtures are a great way to mock data for responses to routes"
+}

+ 14 - 0
cypress/integration/sampleTest.js

@@ -0,0 +1,14 @@
+describe('Google', function(){
+ before('before', function(){
+        cy.visit(Cypress.config().baseUrl)
+    })
+
+    it('Validate Protocol', function(){
+        cy.location('protocol').should('eq','https:')
+    })
+
+    it('Validate Search', function(){
+        cy.get('input[name=q]').type('Earth').type('{enter}')
+
+    })
+})

+ 22 - 0
cypress/plugins/index.js

@@ -0,0 +1,22 @@
+/// <reference types="cypress" />
+// ***********************************************************
+// 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
+}

+ 25 - 0
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) => { ... })

+ 20 - 0
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')

+ 5 - 0
package.json

@@ -0,0 +1,5 @@
+{
+  "dependencies": {
+    "cypress": "^9.0.0"
+  }
+}