Clean test and add comments

This commit is contained in:
Michael
2021-08-02 17:52:03 +02:00
parent 86404ecb3d
commit e572cafb1f
2 changed files with 13 additions and 15 deletions

View File

@@ -40,15 +40,11 @@ const Nav = (props) => {
)}
<Link href='/pricing'>
<a className='nav-btn' id='pricingLink'>
Pricing
</a>
<a className='nav-btn'>Pricing</a>
</Link>
<Link href='/contact'>
<a className='nav-btn' id='contactLink'>
Contact Us
</a>
<a className='nav-btn'>Contact Us</a>
</Link>
{props.user ? (
@@ -78,7 +74,7 @@ const Nav = (props) => {
<div className='hidden lg:flex text-center ml-auto'>{NavMenu}</div>
</div>
<div className='flex-none'>
<div className='dropdown dropdown-end' data-cy="dropdown">
<div className='dropdown dropdown-end' data-cy='dropdown'>
<div tabIndex='0' className='m-1 cursor-pointer lg:hidden'>
<Menu />
</div>

View File

@@ -1,9 +1,12 @@
/*
This is a basic test to show you how cypress works (and how easy it is to build tests!)
It will launch the homepage and navigate through 2 differents pages (Pricing and Contact).
You can see that it will do this twice, with 2 different resolution, to test the mobile version of the site.
*/
describe("Basic Test", () => {
context("Desktop resolution", () => {
// run these tests as if in a desktop
// browser with a 720p monitor
it("Visits the homepage and nav links", () => {
it("Visits the homepage and nav links (Desktop)", () => {
cy.viewport(1280, 720);
cy.visit("");
@@ -16,15 +19,14 @@ describe("Basic Test", () => {
});
context("Mobile resolution", () => {
// run these tests as if in a desktop
// browser with a 720p monitor
it("Visits the homepage and nav links", () => {
it("Visits the homepage and nav links (Mobile)", () => {
cy.viewport(680, 720);
cy.visit("");
cy.get("[data-cy=dropdown]").click();
cy.get("[data-cy=dropdown]").contains("Pricing").click();
cy.url().should("include", "/pricing");
cy.get("[data-cy=dropdown]").click();
cy.get("[data-cy=dropdown]").contains("Contact").click();
cy.url().should("include", "/contact");