Skip to content

Commit

Permalink
add gitlab ci example
Browse files Browse the repository at this point in the history
  • Loading branch information
razvanvancea committed Jul 31, 2020
1 parent 1b335e9 commit c7860a7
Show file tree
Hide file tree
Showing 11 changed files with 1,826 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cypress-gitlab-continuous-integration/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
cypress/videos
cypress/screenshots
cypress/reports
mochawesome-report
.DS_Store
9 changes: 9 additions & 0 deletions cypress-gitlab-continuous-integration/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
image: cypress/base:10

stages:
- test
test:
stage: test
script:
- npm install
- npm run runHeadless
1 change: 1 addition & 0 deletions cypress-gitlab-continuous-integration/cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
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"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
describe("login test suite", function () {
beforeEach(function () {
cy.visit("https://qa-automation-practice.netlify.app");
cy.get("#forms").click();
});

it("login", function () {
// this is a comment
cy.get("#login").click();
cy.get("#email").type("[email protected]");
cy.get("#password").type("admin123");
cy.get("#submitLoginBtn").click();
cy.get("#message").should("contain", "You have successfully logged in!");
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
describe("user actions test suite", function () {
beforeEach(function () {
cy.visit("https://qa-automation-practice.netlify.app");
cy.get("#forms").click();
});

it("register scenario", function () {
cy.get("#register").click();
cy.get("#firstName").type("Razvan");
cy.get("#lastName").type("Van");
cy.get("#phone").type("0799876567");
cy.get("#countries-dropdown-menu").select("Romania");
cy.get("#emailAddress").type("[email protected]");
cy.get("#password").type("123456");
cy.get("#exampleCheck1").check().should("be.checked");
cy.get("#registerBtn").click();
cy.get("#message").should(
"contain",
"The account has been successfully created!"
);
});
});
21 changes: 21 additions & 0 deletions cypress-gitlab-continuous-integration/cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/// <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}
*/
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}
25 changes: 25 additions & 0 deletions cypress-gitlab-continuous-integration/cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -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 changes: 20 additions & 0 deletions cypress-gitlab-continuous-integration/cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -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')
Loading

0 comments on commit c7860a7

Please sign in to comment.