Skip to content

Commit

Permalink
Adding new test for about page
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzalo-diamend committed Jun 27, 2024
1 parent d1e6edc commit ec61d68
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ jobs:
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test
run: npx playwright test --project=chromium
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
75 changes: 75 additions & 0 deletions src/pageObjects/aboutPage/aboutPage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
const { expect } = require('@playwright/test');

class AboutPage {
constructor(page) {
this.page = page;
}

async checkAboutPageTitle() {
await this.#gotoAboutPage();
await this.#acceptCookies();
await expect(this.page).toHaveURL('https://rs2-0-1.webflow.io/about');
}

async #gotoAboutPage() {
await this.page.goto('https://rs2-0-1.webflow.io/about');
}

async #acceptCookies() {
await this.page.getByRole('button', { name: 'Accept' }).click();
}
async frontPageAbout() {
await expect(this.page.getByRole('heading', { name: 'Calm, Steady Hands for the' })).toBeVisible();
await expect(this.page.getByText('Since 2011, we\'ve navigated')).toBeVisible();
await expect(this.page.getByRole('heading', { name: 'Our Product Is Our People.' })).toBeVisible();
await expect(this.page.getByText('We utilize the collective')).toBeVisible();
await expect(this.page.getByRole('heading', { name: 'Our Goal Is Helping You' })).toBeVisible();
await expect(this.page.getByText('We are a nearshore software')).toBeVisible();
await expect(this.page.getByRole('heading', { name: 'It\'s Simple. Technology' })).toBeVisible();
await expect(this.page.getByText('At the heart of each')).toBeVisible();

}
async coreValuesAbout() {
await expect(this.page.getByRole('heading', { name: 'Our Core Values nurture human' })).toBeVisible();
await expect(this.page.getByText('Developed collaboratively in')).toBeVisible();
await expect(this.page.getByText('Developed collaboratively in')).toHaveText('Developed collaboratively in partnership with our entire team, our values are irrefutable foundations for the company that guide how we think, live, and interact with each other and with our client partners.');
await expect(this.page.getByRole('heading', { name: 'Growth Mindset' })).toBeVisible();
await expect(this.page.getByText('We seek to exceed')).toBeVisible();
await expect(this.page.getByText('We seek to exceed')).toHaveText('We seek to exceed expectations in every facet of our work and choose courage over comfort.');
await expect(this.page.getByRole('heading', { name: 'Caring' })).toBeVisible();
await expect(this.page.getByText('We empathize with our')).toBeVisible();
await expect(this.page.getByText('We empathize with our')).toHaveText('We empathize with our partners\' challenges and work tirelessly to find the best solutions.');
await expect(this.page.getByRole('heading', { name: 'Adaptability' })).toBeVisible();
await expect(this.page.getByText('We embrace change, are')).toBeVisible();
await expect(this.page.getByText('We embrace change, are')).toHaveText('We embrace change, are constantly curious, and love feedback.');
await expect(this.page.getByRole('heading', { name: 'Respect' })).toBeVisible();
await expect(this.page.getByText('We engage in direct and')).toBeVisible();
await expect(this.page.getByText('We engage in direct and')).toHaveText('We engage in direct and honest conversations to seek understanding and truth.');
await expect(this.page.getByRole('heading', { name: 'Ownership' })).toBeVisible();
await expect(this.page.getByText('We measure our own success by')).toBeVisible();
await expect(this.page.getByText('We measure our own success by')).toHaveText('We measure our own success by the success of our clients and the products we build.');
}
async mapAbout() {
await expect(this.page.getByRole('heading', { name: 'Our ‍‍Hubs' })).toBeVisible();
await expect(this.page.getByText('Uruguay')).toBeVisible();
await this.page.getByText('Uruguay').hover();
await expect(this.page.getByText('Montevideo')).toBeVisible();
await this.page.getByText('Montevideo').hover();
await expect(this.page.getByText('Argentina')).toBeVisible();
await this.page.getByText('Argentina').hover();
await expect(this.page.getByText('Buenos Aires')).toBeVisible();
await this.page.getByText('Buenos Aires').hover();
await expect(this.page.getByText('Colombia')).toBeVisible();
await this.page.getByText('Colombia').hover();
await expect(this.page.getByText('Medellin')).toBeVisible();
await this.page.getByText('Medellin').hover();
await expect(this.page.getByText('USA')).toBeVisible();
await this.page.getByText('USA').hover();
await expect(this.page.getByText('Los Angeles')).toBeVisible();
await this.page.getByText('Los Angeles').hover();
await expect(this.page.getByText('Around the World')).toBeVisible();
await this.page.getByText('Around the World').hover();
}
}

module.exports = AboutPage;
22 changes: 22 additions & 0 deletions src/tests/about.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const { test, } = require('@playwright/test');
const AboutPage = require('../pageObjects/aboutPage/aboutPage');


test.describe('Home Tests', () => {
let aboutPage;

test.beforeEach(async ({ page }) => {
aboutPage = new AboutPage(page);
});

test('Check About Page Title', async ({ page }) => {
await aboutPage.checkAboutPageTitle();
});

test('Check About Page components', async ({ page }) => {
await aboutPage.checkAboutPageTitle();
await aboutPage.frontPageAbout();
await aboutPage.coreValuesAbout();
await aboutPage.mapAbout();
});
});

0 comments on commit ec61d68

Please sign in to comment.