From 144478383269c7ee16a11e73306acb4136decf38 Mon Sep 17 00:00:00 2001
From: akshatnema <20bcs022@iiitdmj.ac.in>
Date: Mon, 17 Jul 2023 21:05:08 +0530
Subject: [PATCH] Update code formatting and spacing
---
cypress/test/newsroom/Newsroom.cy.js | 7 ++-----
cypress/test/newsroom/NewsroomArticle.cy.js | 1 -
cypress/test/newsroom/NewsroomSection.cy.js | 5 +----
cypress/test/newsroom/NewsroomYoutube.cy.js | 8 ++++----
cypress/test/newsroom/swiper.cy.js | 2 --
5 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/cypress/test/newsroom/Newsroom.cy.js b/cypress/test/newsroom/Newsroom.cy.js
index 811715a0df9..6764307f6a0 100644
--- a/cypress/test/newsroom/Newsroom.cy.js
+++ b/cypress/test/newsroom/Newsroom.cy.js
@@ -5,23 +5,20 @@ describe('Newsroom Component', () => {
beforeEach(() => {
mount();
});
+
it('renders without errors', () => {
cy.get('[data-testid="Newsroom-main"]').contains(newsroomHeadings[0])
cy.get('[data-testid="Newsroom-sub-div"]').contains(newsroomHeadings[1])
cy.get('[data-testid="Newsroom-Blog"]').should('exist')
-
-
});
+
it('checks link href', () => {
cy.get('[data-testid="Newsroom-Blog-Link"]').find('a').should('have.attr', 'href', '/blog') // Check the blog href attribute
cy.get('[ data-testid="Newsroom-Twitter-Link"]').find('a').should('have.attr', 'href', 'https://twitter.com/AsyncAPISpec') //check twitter
cy.get('[data-testid="Newsroom-Youtube"]').find('a').should('have.attr', 'href', 'https://www.youtube.com/c/AsyncAPI') //check youtube link
-
});
it('checks TwitterTimelineEmbed', () => {
cy.get('[data-testid="Newsroom-Twitter"]').should('exist'); // data-test was not working
});
-
-
});
diff --git a/cypress/test/newsroom/NewsroomArticle.cy.js b/cypress/test/newsroom/NewsroomArticle.cy.js
index 5f49663e8e7..bda9ddeff1a 100644
--- a/cypress/test/newsroom/NewsroomArticle.cy.js
+++ b/cypress/test/newsroom/NewsroomArticle.cy.js
@@ -9,7 +9,6 @@ describe('Newsroom Article Component', () => {
cy.get(`[data-testid="NewsroomArticle-${ index }"]`).should('have.attr', 'href', article.url);
cy.get(`[data-testid="NewsroomArticle-${ index }"]`).should('contain.text', article.title);
cy.get(`[data-testid="NewsroomArticle-${ index }"]`).should('contain.text', article.publishDate);
-
});
});
});
\ No newline at end of file
diff --git a/cypress/test/newsroom/NewsroomSection.cy.js b/cypress/test/newsroom/NewsroomSection.cy.js
index fd3f59367e0..a7d5b451de5 100644
--- a/cypress/test/newsroom/NewsroomSection.cy.js
+++ b/cypress/test/newsroom/NewsroomSection.cy.js
@@ -6,17 +6,14 @@ describe('Newsroom Section Component', () => {
mount();
});
- it('renders without errors', () => {
+ it('renders without errors', () => {});
- });
it('check if Features Blog Post exists', () => {
cy.get('[data-testid="NewsroomSection-Featured"]').should('exist');
-
});
it('check content of Newsroom component', () => {
cy.get('[data-testid="NewsroomSection-main"]').contains(newsroom[0]);
})
-
});
diff --git a/cypress/test/newsroom/NewsroomYoutube.cy.js b/cypress/test/newsroom/NewsroomYoutube.cy.js
index 216ded8ab7b..21ffaee96bc 100644
--- a/cypress/test/newsroom/NewsroomYoutube.cy.js
+++ b/cypress/test/newsroom/NewsroomYoutube.cy.js
@@ -4,18 +4,18 @@ import NewsroomYoutube from '../../../components/newsroom/NewsroomYoutube';
describe('Newsroom Youtube', () => {
beforeEach(() => {
mount();
- });
- it('renders without errors', () => {
-
});
+ it('renders without errors', () => {});
+
it('checks if swiper component is present', () => {
cy.get('[ data-testid="NewsroomYoutube-main"]').should('exist')
-
});
+
it('checks if the first slide is active', () => {
cy.get('.swiper-slide-active').should('exist')
});
+
it('slides to the next slide', () => {
cy.get('[data-testid="Youtube-Next-button"]').click({force: true })
cy.get('.swiper-slide-active').should('exist')
diff --git a/cypress/test/newsroom/swiper.cy.js b/cypress/test/newsroom/swiper.cy.js
index b7863747fc9..e000cadd018 100644
--- a/cypress/test/newsroom/swiper.cy.js
+++ b/cypress/test/newsroom/swiper.cy.js
@@ -3,12 +3,10 @@ import { checkLastSnapIndex } from '../../../components/newsroom/swiper';
describe('checkLastSnapIndex', () => {
it('should check the last snap index correctly for different viewport widths', () => {
cy.viewport(1280, 720); // Set the viewport width to 1280px
-
const isLastSnapIndex1 = checkLastSnapIndex(3);
expect(isLastSnapIndex1).to.be.false;
cy.viewport(640, 480); // Set the viewport width to 640px
-
const isLastSnapIndex2 = checkLastSnapIndex(4);
expect(isLastSnapIndex2).to.be.true;
});