Skip to content

Commit

Permalink
Adicionei Page Object
Browse files Browse the repository at this point in the history
  • Loading branch information
JessieFerraz committed May 8, 2024
1 parent 8f04be0 commit 3136802
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
22 changes: 22 additions & 0 deletions pages/perfilpage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { expect } from "@playwright/test"

class PerfilPage{

constructor(page){
this.page = page
this.extenderBio = "//button[contains(.,'Ver mais')]"
this.reduzirBio = "//button[contains(.,'Ver menos')]"
this.estilosPreferidos = "(//h1[contains(.,'Estilos preferidos')])[1]"
this.conquistas = "(//h1[contains(.,'Conquistas')])[1]"
}

async conferirElementosTela(){
await this.page.click(this.extenderBio)
await this.page.click(this.reduzirBio)

await expect(this.page.locator(this.estilosPreferidos)).toBeVisible()
await expect(this.page.locator(this.conquistas)).toBeVisible()
}
};

export default PerfilPage;
13 changes: 5 additions & 8 deletions tests/perfil.spec.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
const { test, expect } = require('@playwright/test');
import PerfilPage from '../pages/PerfilPage';

test('acessar perfil', async ({ page }) => {
test('Acessar Perfil', async ({ page }) => {
await page.goto('https://frontend-nnf7bytugq-uc.a.run.app/user/profile?show=profile');

await expect(page).toHaveTitle(/Tem Vaga Mestre/);

await expect(page.getByRole('heading', { name: 'Estilos preferidos' })).toBeVisible();
await expect(page.getByRole('heading', { name: 'Conquistas' })).toBeVisible();

await page.getByRole('button', { name: 'Ver mais'}).click();
});
const perfilPage = new PerfilPage(page)

await perfilPage.conferirElementosTela()
});

0 comments on commit 3136802

Please sign in to comment.