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

Sign out #57

Open
wants to merge 2 commits into
base: develop
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
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,19 @@ npx cypress run --testFile.js
npx cypress run --record --key 49bfa993-ad20-464c-b7ab-d9d27ae262c0
```



Generate With Reports:
Generate With Reports:

```bash
npx cypress run --reporter mochawesome
```

Combine the reports:
Combine the reports:

```bash
npx mochawesome-merge "cypress/results/*.json" > mochawesome.json
```

Generate the HTML Report:
Generate the HTML Report:

```bash
npx merge mochawesome.json
Expand Down Expand Up @@ -91,3 +89,8 @@ cartBuynow
buyNow.spect.js
cartKeepbuying
keepBuying.spect.js

---

**FashionPage:**
Cypress.Commands.add("loginFashionPage", function (user)
10 changes: 5 additions & 5 deletions cypress/integration/Fashion/CYP-63-Login.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/// <reference types="Cypress" />

describe("Checking cart and sign out", () => {
it("Checking cart and sign out", () => {
describe('Making Sign in Process', () => {
it('Making Sign in Process', () => {
//test steps
cy.loginFashionPage({ email: "rodrigo032792@gmail.com", pwd: "Club2021*" });
});
});
cy.loginFashionPage({ email: 'rodrigo032792@gmail.com', pwd: 'Club2021*' })
})
})
13 changes: 13 additions & 0 deletions cypress/integration/Fashion/CYP-64-logout.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/// <reference types="Cypress" />

describe('Checking cart and sign out', () => {
it('Checking cart and sign out', () => {
//test steps
cy.loginFashionPage({ email: 'rodrigo032792@gmail.com', pwd: 'Club2021*' })
cy.get('[title="View my shopping cart"]').click()
cy.get('.navigation_page').contains('cart')
cy.wait(3000)
cy.get('.logout').click()
cy.get('.login').contains('Sign in')
})
})
63 changes: 33 additions & 30 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
import "@testing-library/cypress/add-commands";
import '@testing-library/cypress/add-commands'

Cypress.Commands.add("amazonWebSite", function () {
cy.visit("https://www.amazon.com/");
});
Cypress.Commands.add('amazonWebSite', function () {
cy.visit('https://www.amazon.com/')
})

Cypress.Commands.add("loginFashionPage", function (user) {
cy.visit("http://automationpractice.com/index.php");
cy.get(".login").click();
cy.get("#email").type(user.email);
cy.get("#passwd").type(user.pwd);
cy.get("#SubmitLogin > span").click();
cy.get(".logout").contains("Sign out").should("have.text","\n\t\t\tSign out\n\t\t");
});
// Este es el comando para reutilizar en sus casos prueba de fashion page
Cypress.Commands.add('loginFashionPage', function (user) {
cy.visit('http://automationpractice.com/index.php')
cy.get('.login').click()
cy.get('#email').type(user.email)
cy.get('#passwd').type(user.pwd, { sensitive: true })
cy.get('#SubmitLogin > span').click()
cy.get('.logout')
.contains('Sign out')
.should('have.text', '\n\t\t\tSign out\n\t\t')
})

Cypress.Commands.add("loginAmazon", function (user) {
cy.visit("https://www.amazon.com/");
cy.contains("Sign in").click();
cy.get("#ap_email").clear().type(user.email);
cy.get(".a-button-inner > #continue").click();
cy.get("#ap_password").clear().type(user.pwd);
cy.get("#signInSubmit").click();
});
Cypress.Commands.add('loginAmazon', function (user) {
cy.visit('https://www.amazon.com/')
cy.contains('Sign in').click()
cy.get('#ap_email').clear().type(user.email)
cy.get('.a-button-inner > #continue').click()
cy.get('#ap_password').clear().type(user.pwd)
cy.get('#signInSubmit').click()
})

Cypress.Commands.add("selectSectionYT", function (label, sectionTab) {
cy.visit("https://www.youtube.com/");
cy.get("#guide-button").click();
cy.contains(label).click();
cy.get("ytd-game-details-renderer")
.find("a")
Cypress.Commands.add('selectSectionYT', function (label, sectionTab) {
cy.visit('https://www.youtube.com/')
cy.get('#guide-button').click()
cy.contains(label).click()
cy.get('ytd-game-details-renderer')
.find('a')
.each(function ($el, index, $list) {
const textSectionTab = $el.find("#title").text();
const textSectionTab = $el.find('#title').text()
if (textSectionTab.includes(sectionTab)) {
$el.find("#img").click();
$el.find('#img').click()
}
});
});
})
})