From 1a78b50d888ee2115618765ea91be2e31a31586a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Paix=C3=A3o?= <42840902+LeohsPaixao@users.noreply.github.com> Date: Mon, 2 Dec 2024 15:42:07 -0300 Subject: [PATCH 1/7] TEST: Testes tela cadastro usuarios (#71) * test: instala faker no projeto de teste playwright * test: instala faker no projeto de teste playwright * test: cria pasta de recursos para modular o projeto * test: adiciona testes na tela de cadastro com o projeto playwright * test: melhora os testes de cypress na tela de cadastro --- test/cypress/tests/e2e/shared/fillUserForm.ts | 2 +- .../tests/e2e/specs/registerUser.cy.ts | 10 -- test/playwright/package.json | 7 +- .../shared/commands/fillUserForm.ts | 34 +++++ .../shared/commands/generateValidCPF.ts | 44 +++++++ test/playwright/shared/mocks/.gitkeep | 0 test/playwright/shared/utils/.gitkeep | 0 test/playwright/tests/fixtures/.gitkeep | 0 .../tests/specs/registerUser.spec.ts | 116 ++++++++++++++++++ 9 files changed, 199 insertions(+), 14 deletions(-) create mode 100644 test/playwright/shared/commands/fillUserForm.ts create mode 100644 test/playwright/shared/commands/generateValidCPF.ts create mode 100644 test/playwright/shared/mocks/.gitkeep create mode 100644 test/playwright/shared/utils/.gitkeep create mode 100644 test/playwright/tests/fixtures/.gitkeep diff --git a/test/cypress/tests/e2e/shared/fillUserForm.ts b/test/cypress/tests/e2e/shared/fillUserForm.ts index 99b9c07..b40bb3f 100644 --- a/test/cypress/tests/e2e/shared/fillUserForm.ts +++ b/test/cypress/tests/e2e/shared/fillUserForm.ts @@ -22,7 +22,7 @@ export function fillUserForm() { { element: cy.get('[data-testid="input-socialname"]'), valor: faker.person.middleName() }, { element: cy.get('[data-testid="input-document"]'), valor: cpf }, { element: cy.get('[data-testid="input-phone"]'), valor: faker.phone.number({ style: 'national' }) }, - { element: cy.get('[data-testid="input-email"]'), valor: faker.internet.email() }, + { element: cy.get('[data-testid="input-email"]'), valor: faker.internet.email({ provider: 'example.qa.solar' }) }, { element: cy.get('[data-testid="input-password"]'), valor: '123456' }, ]; diff --git a/test/cypress/tests/e2e/specs/registerUser.cy.ts b/test/cypress/tests/e2e/specs/registerUser.cy.ts index bd44f28..0532961 100644 --- a/test/cypress/tests/e2e/specs/registerUser.cy.ts +++ b/test/cypress/tests/e2e/specs/registerUser.cy.ts @@ -25,7 +25,6 @@ describe('Tela de Cadastro de Usuário', () => { }); it('Não deveria ser possivel criar o usuário com o Nome Completo errado', () => { - fillUserForm(); cy.get('[data-testid="input-fullname"]').type('{selectall}Teste'); cy.get('[data-testid="btn-register"]').should('be.enabled').click(); cy.get('[data-testid="toast-content"]').should('have.text', 'Por favor, corrija os erros no formulário.'); @@ -33,7 +32,6 @@ describe('Tela de Cadastro de Usuário', () => { }); it('Não deveria ser possivel criar o usuário com o CPF inválido', () => { - fillUserForm(); cy.get('[data-testid="input-document"]').type('{selectall}123.456.789-10'); cy.get('[data-testid="btn-register"]').should('be.enabled').click(); cy.get('[data-testid="toast-content"]').should('have.text', 'Por favor, corrija os erros no formulário.'); @@ -41,7 +39,6 @@ describe('Tela de Cadastro de Usuário', () => { }); it('Não deveria ser possivel criar o usuário com o CNPJ inválido', () => { - fillUserForm(); cy.get('[data-testid="select-document-type"]').select('cnpj'); cy.get('[data-testid="input-document"]').type('{selectall}12.456.789/1110-60'); cy.get('[data-testid="btn-register"]').should('be.enabled').click(); @@ -50,7 +47,6 @@ describe('Tela de Cadastro de Usuário', () => { }); it('Não deveria ser possivel colocar letras no campo de telefone', () => { - fillUserForm(); cy.get('[data-testid="input-phone"]').type('{selectall}sdadfafsa'); cy.get('[data-testid="btn-register"]').should('be.enabled').click(); cy.get('[data-testid="toast-content"]').should('have.text', 'Por favor, corrija os erros no formulário.'); @@ -58,7 +54,6 @@ describe('Tela de Cadastro de Usuário', () => { }); it('Não deveria ser possivel colocar mais do que 11 dígitos no campo de telefone', () => { - fillUserForm(); cy.get('[data-testid="input-phone"]').type('{selectall}154542165455454'); cy.get('[data-testid="btn-register"]').should('be.enabled').click(); cy.get('[data-testid="toast-content"]').should('have.text', 'Por favor, corrija os erros no formulário.'); @@ -66,7 +61,6 @@ describe('Tela de Cadastro de Usuário', () => { }); it('Não deveria ser possivel colocar menos do que 10 dígitos no campo de telefone', () => { - fillUserForm(); cy.get('[data-testid="input-phone"]').type('{selectall}123'); cy.get('[data-testid="btn-register"]').should('be.enabled').click(); cy.get('[data-testid="toast-content"]').should('have.text', 'Por favor, corrija os erros no formulário.'); @@ -74,7 +68,6 @@ describe('Tela de Cadastro de Usuário', () => { }); it('Não deveria ser possivel criar o usuário com o email inválido', () => { - fillUserForm(); cy.get('[data-testid="input-email"]').type('{selectall}email@email'); cy.get('[data-testid="btn-register"]').should('be.enabled').click(); cy.get('[data-testid="toast-content"]').should('have.text', 'Por favor, corrija os erros no formulário.'); @@ -82,7 +75,6 @@ describe('Tela de Cadastro de Usuário', () => { }); it('Não deveria ser possivel cadastrar o usuário com uma senha com menos de 6 caracteres', () => { - fillUserForm(); cy.get('[data-testid="input-password"]').type('{selectall}12345'); cy.get('[data-testid="btn-register"]').should('be.enabled').click(); cy.get('[data-testid="toast-content"]').should('have.text', 'Por favor, corrija os erros no formulário.'); @@ -90,7 +82,6 @@ describe('Tela de Cadastro de Usuário', () => { }); it('Não deveria ser possivel cadastrar o usuário com uma senha com mais de 20 caracteres', () => { - fillUserForm(); cy.get('[data-testid="input-password"]').type('{selectall}1234567891012141516131'); cy.get('[data-testid="btn-register"]').should('be.enabled').click(); cy.get('[data-testid="toast-content"]').should('have.text', 'Por favor, corrija os erros no formulário.'); @@ -108,5 +99,4 @@ describe('Tela de Cadastro de Usuário', () => { cy.get('[data-testid="form-login"]').should('be.visible'); cy.get('[data-testid="btn-login"]').should('be.visible'); }); - }); diff --git a/test/playwright/package.json b/test/playwright/package.json index cb1cfbd..a146693 100644 --- a/test/playwright/package.json +++ b/test/playwright/package.json @@ -10,11 +10,12 @@ "play:open": "playwright test --ui", "play:report": "playwright show-report" }, + "dependencies": { + "@faker-js/faker": "^9.2.0", + "dotenv": "^16.4.5" + }, "devDependencies": { "@playwright/test": "^1.49.0", "@types/node": "^22.9.1" - }, - "dependencies": { - "dotenv": "^16.4.5" } } diff --git a/test/playwright/shared/commands/fillUserForm.ts b/test/playwright/shared/commands/fillUserForm.ts new file mode 100644 index 0000000..33d1ec6 --- /dev/null +++ b/test/playwright/shared/commands/fillUserForm.ts @@ -0,0 +1,34 @@ +import { faker } from '@faker-js/faker'; +import { Page } from '@playwright/test'; +import { generateValidCPF } from './generateValidCPF'; + +/** + * Esta função preenche um formulário de usuário com dados gerados aleatoriamente usando Playwright e Faker.js. + * + * @observações + * A função utiliza os atributos data-testid para localizar campos específicos no formulário e digita os dados gerados. + * + * @exemplo + * ```typescript + * fillUserForm(); + * ``` + * + * @retorno {void} A função não retorna nenhum valor. + */ +export async function fillUserForm(page: Page) { + const cpf = generateValidCPF(); + + const formFields = [ + { element: page.locator('[data-testid="input-fullname"]'), valor: faker.person.fullName() }, + { element: page.locator('[data-testid="input-socialname"]'), valor: faker.person.middleName() }, + { element: page.locator('[data-testid="input-document"]'), valor: cpf }, + { element: page.locator('[data-testid="input-phone"]'), valor: faker.phone.number({ style: 'national' }) }, + { element: page.locator('[data-testid="input-email"]'), valor: faker.internet.email({ provider: 'example.qa.solar' }) }, + { element: page.locator('[data-testid="input-password"]'), valor: '123456' }, + ]; + + for (const field of formFields) { + await field.element.waitFor({ state: 'visible' }) + await field.element.fill(field.valor); + } +} diff --git a/test/playwright/shared/commands/generateValidCPF.ts b/test/playwright/shared/commands/generateValidCPF.ts new file mode 100644 index 0000000..71e494d --- /dev/null +++ b/test/playwright/shared/commands/generateValidCPF.ts @@ -0,0 +1,44 @@ +function generateRandomDigits(length: number): string { + return Array.from({ length }, () => Math.floor(Math.random() * 10)).join(''); +} + +function calculateVerifierDigit(base: string): number { + const baseDigits = base.split('').map(Number); + const length = baseDigits.length; + const sum = baseDigits.reduce((acc, digit, index) => acc + digit * (length + 1 - index), 0); + const remainder = sum % 11; + return remainder < 2 ? 0 : 11 - remainder; +} + +function formatCPF(cpf: string): string { + return cpf.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/, '$1.$2.$3-$4'); +} + +/** + * Gera um CPF válido (Cadastro de Pessoas Físicas). + * + * @retorna Uma string representando um CPF válido no formato "XXX.XXX.XXX-XX". + * + * @observações + * Esta função utiliza uma combinação de geração aleatória de dígitos, cálculo de dígitos verificadores + * e formatação para criar um CPF válido. O CPF gerado não está associado a nenhuma pessoa real e + * deve ser usado apenas para fins de teste ou demonstração. + * + * O algoritmo utilizado nesta função segue as regras oficiais de geração de CPF: + * 1. Gera uma base aleatória de 9 dígitos. + * 2. Calcula o primeiro dígito verificador usando a base e a fórmula: + * (10 * d1 + 9 * d2 + 8 * d3 + 7 * d4 + 6 * d5 + 5 * d6 + 4 * d7 + 3 * d8 + 2 * d9) mod 11 + * O resultado deve ser 0 ou 11 - resultado. + * 3. Calcula o segundo dígito verificador usando a base, o primeiro dígito verificador e a fórmula: + * (11 * d1 + 10 * d2 + 9 * d3 + 8 * d4 + 7 * d5 + 6 * d6 + 5 * d7 + 4 * d8 + 3 * d9 + 2 * primeiroVerificador) mod 11 + * O resultado deve ser 0 ou 11 - resultado. + * 4. Combina a base, o primeiro dígito verificador e o segundo dígito verificador para formar o CPF final. + * 5. Formata o CPF no padrão brasileiro: "XXX.XXX.XXX-XX". + */ +export function generateValidCPF(): string { + const baseDigits = generateRandomDigits(9); + const firstVerifier = calculateVerifierDigit(baseDigits); + const secondVerifier = calculateVerifierDigit(baseDigits + firstVerifier); + const cpf = `${baseDigits}${firstVerifier}${secondVerifier}`; + return formatCPF(cpf); +} diff --git a/test/playwright/shared/mocks/.gitkeep b/test/playwright/shared/mocks/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/playwright/shared/utils/.gitkeep b/test/playwright/shared/utils/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/playwright/tests/fixtures/.gitkeep b/test/playwright/tests/fixtures/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/test/playwright/tests/specs/registerUser.spec.ts b/test/playwright/tests/specs/registerUser.spec.ts index e69de29..307b198 100644 --- a/test/playwright/tests/specs/registerUser.spec.ts +++ b/test/playwright/tests/specs/registerUser.spec.ts @@ -0,0 +1,116 @@ +import { faker } from '@faker-js/faker'; +import { expect, test } from '@playwright/test'; +import { generateValidCPF } from '../../shared/commands/generateValidCPF'; + +test.describe('Tela de Cadastro de Usuários', () => { + + test.beforeEach(async ({ page }) => { + await page.goto('/signup') + }); + + test('Deveria ser possivel visualizar os elementos da tela de cadastro', async ({ page }) => { + await expect(page.locator('[data-testid="form-register"]')).toBeVisible(); + await expect(page.locator('.form-group').first()).toBeVisible(); + await expect(page.locator('[data-testid="btn-register"]')).toBeVisible(); + await expect(page.locator('[data-testid="link-go-to-login"]')).toBeVisible(); + }); + + test('Deveria ser possivel visualizar o toast ao clicar no botão sem adicionar algum valor nos campos', async ({ page }) => { + await page.locator('[data-testid="btn-register"]').click(); + await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Por favor, corrija os erros no formulário.'); + + const inputName = ['fullname', 'cpfcnpj', 'email', 'password']; + const inputError = ['O Nome Completo é obrigatório.', 'O CPF/CNPJ é obrigatório.', 'O Email é obrigatório.', 'A Senha é obrigatória.']; + + inputName.forEach((name, index) => { + expect(page.locator(`[data-testid="input-error-${name}"]`)).toHaveText(inputError[index]); + }) + }); + + test('Não deveria ser possivel criar o usuário com o Nome Completo errado', async ({ page }) => { + await page.locator('[data-testid="input-fullname"]').fill('Teste'); + await page.locator('[data-testid="btn-register"]').click(); + await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Por favor, corrija os erros no formulário.'); + await expect(page.locator('[data-testid="input-error-fullname"]')).toHaveText('O Nome Completo deve conter pelo menos Nome e Sobrenome.'); + }); + + test('Não deveria ser possivel criar o usuário com o CPF inválido', async ({ page }) => { + await page.locator('[data-testid="input-document"]').fill('123.456.789-10'); + await page.locator('[data-testid="btn-register"]').click(); + await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Por favor, corrija os erros no formulário.'); + await expect(page.locator('[data-testid="input-error-cpfcnpj"]')).toHaveText('CPF inválido.'); + }) + + test('Não deveria ser possivel criar o usuário com o CNPJ inválido', async ({ page }) => { + await page.locator('[data-testid="select-document-type"]').selectOption('cnpj') + await page.locator('[data-testid="input-document"]').fill('12.456.789/1110-60'); + await page.locator('[data-testid="btn-register"]').click(); + await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Por favor, corrija os erros no formulário.'); + await expect(page.locator('[data-testid="input-error-cpfcnpj"]')).toHaveText('CNPJ inválido.'); + }); + + test('Não deveria ser possivel colocar letras no campo de telefone', async ({ page }) => { + await page.locator('[data-testid="input-phone"]').fill('dfdfsff'); + + await page.locator('[data-testid="btn-register"]').click(); + await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Por favor, corrija os erros no formulário.'); + await expect(page.locator('[data-testid="input-error-phone"]')).toHaveText('O telefone deve conter apenas números.'); + }); + + test('Não deveria ser possivel colocar mais do que 11 dígitos no campo de telefone', async ({ page }) => { + await page.locator('[data-testid="input-phone"]').fill('546521854651854'); + await page.locator('[data-testid="btn-register"]').click(); + await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Por favor, corrija os erros no formulário.'); + await expect(page.locator('[data-testid="input-error-phone"]')).toHaveText('O telefone deve ter no máximo 11 dígitos.'); + }); + + test('Não deveria ser possivel colocar menos do que 10 dígitos no campo de telefone', async ({ page }) => { + await page.locator('[data-testid="input-phone"]').fill('1452'); + await page.locator('[data-testid="btn-register"]').click(); + await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Por favor, corrija os erros no formulário.'); + await expect(page.locator('[data-testid="input-error-phone"]')).toHaveText('O telefone deve ter no mínimo 10 dígitos.'); + }); + + test('Não deveria ser possivel criar o usuário com o email inválido', async ({ page }) => { + await page.locator('[data-testid="input-email"]').fill('email@exassd'); + await page.locator('[data-testid="btn-register"]').click(); + await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Por favor, corrija os erros no formulário.'); + await expect(page.locator('[data-testid="input-error-email"]')).toHaveText('Email inválido.'); + }); + + test('Não deveria ser possivel criar o usuário com uma senha com menos de 6 caracteres', async ({ page }) => { + await page.locator('[data-testid="input-password"]').fill('14521'); + await page.locator('[data-testid="btn-register"]').click(); + await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Por favor, corrija os erros no formulário.'); + await expect(page.locator('[data-testid="input-error-password"]')).toHaveText('A Senha deve ter no mínimo 6 caracteres.'); + }); + + test('Não deveria ser possivel criar o usuário com uma senha com mais de 20 caracteres', async ({ page }) => { + await page.locator('[data-testid="input-password"]').fill('Teste54544dfdf545454d'); + await page.locator('[data-testid="btn-register"]').click(); + await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Por favor, corrija os erros no formulário.'); + await expect(page.locator('[data-testid="input-error-password"]')).toHaveText('A Senha deve ter no máximo 20 caracteres.'); + }); + + test('Deveria ser possivel cadastrar um usuário', async ({ page }) => { + const cpf = generateValidCPF() + + await page.locator('[data-testid="input-fullname"]').fill(faker.person.fullName()); + await page.locator('[data-testid="input-socialname"]').fill(faker.person.middleName()); + await page.locator('[data-testid="input-document"]').fill(cpf); + await page.locator('[data-testid="input-phone"]').fill(faker.phone.number({ style: 'national' })); + await page.locator('[data-testid="input-email"]').fill(faker.internet.email({ provider: 'example.qa.solar' })); + await page.locator('[data-testid="input-password"]').fill('123456') + await page.locator('[data-testid="btn-register"]').click(); + + const toast = page.locator('[data-testid="toast-content"]') + await toast.waitFor({ state: 'visible' }) + await expect(toast).toHaveText('Usuário cadastrado com sucesso!'); + }); + + test('Deveria ser possivel ir para a tela de login ao clicar no link', async ({ page }) => { + await page.locator('[data-testid="link-go-to-login"]').click(); + await expect(page.locator('[data-testid="form-login"]')).toBeVisible(); + await expect(page.locator('[data-testid="btn-login"]')).toBeVisible(); + }); +}) From 5c19a98781124cf89b8a4f5b55d767a83a1ee207 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Paix=C3=A3o?= <42840902+LeohsPaixao@users.noreply.github.com> Date: Mon, 2 Dec 2024 20:53:38 -0300 Subject: [PATCH 2/7] =?UTF-8?q?TEST:=20Testes=20tela=20recupera=C3=A7?= =?UTF-8?q?=C3=A3o=20de=20senha=20(#72)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test: adiciona testes da tela de recuperacao de senha * test: adiciona os changesets --- .changeset/good-paws-punch.md | 5 +++ .changeset/mean-turkeys-juggle.md | 5 +++ .changeset/shy-cameras-accept.md | 5 +++ .../shared/commands/fillUserForm.ts | 0 .../shared/commands/generateValidCPF.ts | 0 .../{ => tests}/shared/mocks/.gitkeep | 0 .../{ => tests}/shared/utils/.gitkeep | 0 .../tests/specs/recoverPassword.spec.ts | 41 +++++++++++++++++++ .../tests/specs/registerUser.spec.ts | 2 +- 9 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 .changeset/good-paws-punch.md create mode 100644 .changeset/mean-turkeys-juggle.md create mode 100644 .changeset/shy-cameras-accept.md rename test/playwright/{ => tests}/shared/commands/fillUserForm.ts (100%) rename test/playwright/{ => tests}/shared/commands/generateValidCPF.ts (100%) rename test/playwright/{ => tests}/shared/mocks/.gitkeep (100%) rename test/playwright/{ => tests}/shared/utils/.gitkeep (100%) create mode 100644 test/playwright/tests/specs/recoverPassword.spec.ts diff --git a/.changeset/good-paws-punch.md b/.changeset/good-paws-punch.md new file mode 100644 index 0000000..7a372ae --- /dev/null +++ b/.changeset/good-paws-punch.md @@ -0,0 +1,5 @@ +--- +"playwright-ui-tests": minor +--- + +test: adiciona testes na tela de cadastro do usuário com o projeto Playwright diff --git a/.changeset/mean-turkeys-juggle.md b/.changeset/mean-turkeys-juggle.md new file mode 100644 index 0000000..92f2680 --- /dev/null +++ b/.changeset/mean-turkeys-juggle.md @@ -0,0 +1,5 @@ +--- +"playwright-ui-tests": minor +--- + +test: adiciona testes na tela de recuperação de senha com o projeto Playwright diff --git a/.changeset/shy-cameras-accept.md b/.changeset/shy-cameras-accept.md new file mode 100644 index 0000000..bd95b04 --- /dev/null +++ b/.changeset/shy-cameras-accept.md @@ -0,0 +1,5 @@ +--- +"cypress-ui-tests": patch +--- + +test: remove o uso da funcao fillUserForm nos testes diff --git a/test/playwright/shared/commands/fillUserForm.ts b/test/playwright/tests/shared/commands/fillUserForm.ts similarity index 100% rename from test/playwright/shared/commands/fillUserForm.ts rename to test/playwright/tests/shared/commands/fillUserForm.ts diff --git a/test/playwright/shared/commands/generateValidCPF.ts b/test/playwright/tests/shared/commands/generateValidCPF.ts similarity index 100% rename from test/playwright/shared/commands/generateValidCPF.ts rename to test/playwright/tests/shared/commands/generateValidCPF.ts diff --git a/test/playwright/shared/mocks/.gitkeep b/test/playwright/tests/shared/mocks/.gitkeep similarity index 100% rename from test/playwright/shared/mocks/.gitkeep rename to test/playwright/tests/shared/mocks/.gitkeep diff --git a/test/playwright/shared/utils/.gitkeep b/test/playwright/tests/shared/utils/.gitkeep similarity index 100% rename from test/playwright/shared/utils/.gitkeep rename to test/playwright/tests/shared/utils/.gitkeep diff --git a/test/playwright/tests/specs/recoverPassword.spec.ts b/test/playwright/tests/specs/recoverPassword.spec.ts new file mode 100644 index 0000000..ad6a685 --- /dev/null +++ b/test/playwright/tests/specs/recoverPassword.spec.ts @@ -0,0 +1,41 @@ +import { expect, test } from '@playwright/test'; + +test.describe('Tela de Recuperação de Senha', () => { + + test.beforeEach(async ({ page }) => { + await page.goto('/recover-password'); + }); + + test('Deveria ser possível visualizar os elementos da tela de Recuperação de Senha', async ({ page }) => { + await expect(page.locator('[data-testid="form-recover-password"]')).toBeVisible(); + await expect(page.locator('[data-testid="input-email-recover-password"]')).toBeVisible(); + await expect(page.locator('[data-testid="btn-recover-password"]')).toBeVisible(); + await expect(page.locator('[data-testid="link-go-to-login"]')).toBeVisible(); + }); + + test('Não deveria ser possível aparecer o toast de feedback para usuário apenas clicando no botão', async ({ page }) => { + await expect(page.locator('[data-testid="btn-recover-password"]')).toBeEnabled(); + await page.locator('[data-testid="btn-recover-password"]').click(); + await expect(page.locator('[data-testid="toast-content"]')).not.toBeVisible(); + }); + + test('Deveria ser possível aparecer um toast de feedback caso coloque um email inválido', async ({ page }) => { + await page.locator('[data-testid="input-email-recover-password"]').fill('email@example.com'); + await expect(page.locator('[data-testid="btn-recover-password"]')).toBeEnabled(); + await page.locator('[data-testid="btn-recover-password"]').click(); + await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Este email não esta cadastrado no banco de dados.'); + }); + + test('Deveria ser possível enviar o email de recuperação de senha', async ({ page }) => { + await page.locator('[data-testid="input-email-recover-password"]').fill('generic@example.com'); + await expect(page.locator('[data-testid="btn-recover-password"]')).toBeEnabled(); + await page.locator('[data-testid="btn-recover-password"]').click(); + await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Um e-mail foi enviado com instruções para recuperar a senha.'); + }); + + test('Deveria ser possível voltar para a tela de login pelo link', async ({ page }) => { + await page.locator('[data-testid="link-go-to-login"]').click(); + await expect(page.locator('[data-testid="form-login"]')).toBeVisible(); + await expect(page.locator('[data-testid="btn-login"]')).toBeVisible(); + }); +}); diff --git a/test/playwright/tests/specs/registerUser.spec.ts b/test/playwright/tests/specs/registerUser.spec.ts index 307b198..b78e460 100644 --- a/test/playwright/tests/specs/registerUser.spec.ts +++ b/test/playwright/tests/specs/registerUser.spec.ts @@ -1,6 +1,6 @@ import { faker } from '@faker-js/faker'; import { expect, test } from '@playwright/test'; -import { generateValidCPF } from '../../shared/commands/generateValidCPF'; +import { generateValidCPF } from '../shared/commands/generateValidCPF'; test.describe('Tela de Cadastro de Usuários', () => { From 8b293f3c3c2932ed2021be8cde2f0dce565860fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Paix=C3=A3o?= <42840902+LeohsPaixao@users.noreply.github.com> Date: Tue, 3 Dec 2024 10:09:18 -0300 Subject: [PATCH 3/7] =?UTF-8?q?TEST:=20Testes=20na=20tela=20perfil=20do=20?= =?UTF-8?q?usu=C3=A1rio=20(#73)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test: cria o comando personalizado para login via api * test: adiciona testes na tela de perfil do usuario * test: adiciona o changeset --- .changeset/weak-suns-unite.md | 5 ++ .../playwright/tests/shared/commands/login.ts | 31 ++++++++ test/playwright/tests/specs/profile.spec.ts | 77 +++++++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 .changeset/weak-suns-unite.md create mode 100644 test/playwright/tests/shared/commands/login.ts create mode 100644 test/playwright/tests/specs/profile.spec.ts diff --git a/.changeset/weak-suns-unite.md b/.changeset/weak-suns-unite.md new file mode 100644 index 0000000..fbe82d8 --- /dev/null +++ b/.changeset/weak-suns-unite.md @@ -0,0 +1,5 @@ +--- +"playwright-ui-tests": minor +--- + +test: adiciona testes na tela de perfil do usuário com o projeto Playwright diff --git a/test/playwright/tests/shared/commands/login.ts b/test/playwright/tests/shared/commands/login.ts new file mode 100644 index 0000000..7d8c451 --- /dev/null +++ b/test/playwright/tests/shared/commands/login.ts @@ -0,0 +1,31 @@ +import { Page } from '@playwright/test'; + +/** + * Realiza a operação de login simulando uma requisição POST para o endpoint de login da API. + * Armazena o token recebido e o e-mail no local storage do navegador. + * + * @param {Page} page - A página do Playwright onde o localStorage será definido. + * @param {string} email - O email do usuário para login. + * @param {string} password - A senha do usuário para login. + * @returns {Promise} - Uma promise que é resolvida quando a operação de login é concluída. + */ +export async function login(page: Page, email: string, password: string): Promise { + + const response = await page.request.fetch('http://localhost:3001/login', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + data: { + email, + password + } + }) + + const { token } = JSON.parse(await response.text()) + + await page.evaluate(({ email, token }) => { + localStorage.setItem('user-token', token); + localStorage.setItem('user-email', email); + }, { email, token }); +} diff --git a/test/playwright/tests/specs/profile.spec.ts b/test/playwright/tests/specs/profile.spec.ts new file mode 100644 index 0000000..ffaa21d --- /dev/null +++ b/test/playwright/tests/specs/profile.spec.ts @@ -0,0 +1,77 @@ +import { faker } from '@faker-js/faker'; +import { expect, test } from '@playwright/test'; +import { login } from '../shared/commands/login'; + +test.describe('Tela de Perfil', () => { + + test.beforeEach(async ({ page }) => { + login(page, 'generic@example.com', '123456'); + await page.goto('/profile') + await page.waitForURL('/profile'); + }); + + test('Deveria ser possível visualizar os elementos da tela de Perfil', async ({ page }) => { + await expect(page.locator('[data-testid="form-profile"]')).toBeVisible(); + await expect(page.locator('.form-group').first()).toBeVisible(); + await expect(page.locator('[data-testid="btn-save-profile"]')).toBeVisible(); + await expect(page.locator('[data-testid="btn-save-profile"]')).toBeDisabled(); + }); + + test('Não deveria ser possível salvar a alteração sem colocar algum dado no Nome Completo', async ({ page }) => { + await page.fill('[data-testid="input-fullname-profile"]', ' '); + await page.click('[data-testid="btn-save-profile"]'); + await expect(page.locator('[data-testid="toast-content"]')).toBeVisible(); + await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Por favor, corrija os erros antes de salvar.'); + await expect(page.locator('[data-testid="input-error-fulname-profile"]')).toBeVisible(); + await expect(page.locator('[data-testid="input-error-fulname-profile"]')).toHaveText('O Nome Completo é obrigatório.'); + }); + + test('Não deveria ser possível salvar a alteração com apenas o nome', async ({ page }) => { + await page.fill('[data-testid="input-fullname-profile"]', 'testname'); + await page.click('[data-testid="btn-save-profile"]'); + await expect(page.locator('[data-testid="toast-content"]')).toBeVisible(); + await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Por favor, corrija os erros antes de salvar.'); + await expect(page.locator('[data-testid="input-error-fulname-profile"]')).toBeVisible(); + await expect(page.locator('[data-testid="input-error-fulname-profile"]')).toHaveText('O Nome Completo deve conter pelo menos Nome e Sobrenome.'); + }); + + test('Não deveria ser possível salvar a alteração com letras no telefone', async ({ page }) => { + await page.fill('[data-testid="input-phone-profile"]', 'testphone'); + await page.click('[data-testid="btn-save-profile"]'); + await expect(page.locator('[data-testid="toast-content"]')).toBeVisible(); + await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Por favor, corrija os erros antes de salvar.'); + await expect(page.locator('[data-testid="input-error-phone-profile"]')).toBeVisible(); + await expect(page.locator('[data-testid="input-error-phone-profile"]')).toHaveText('O telefone deve conter apenas números.'); + }); + + test('Não deveria ser possível salvar a alteração com mais de 11 dígitos no telefone', async ({ page }) => { + await page.fill('[data-testid="input-phone-profile"]', '1452145214521452'); + await page.click('[data-testid="btn-save-profile"]'); + await expect(page.locator('[data-testid="toast-content"]')).toBeVisible(); + await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Por favor, corrija os erros antes de salvar.'); + await expect(page.locator('[data-testid="input-error-phone-profile"]')).toBeVisible(); + await expect(page.locator('[data-testid="input-error-phone-profile"]')).toHaveText('O telefone deve ter no máximo 11 dígitos.'); + }); + + test('Não deveria ser possível salvar a alteração com menos de 10 dígitos no telefone', async ({ page }) => { + await page.fill('[data-testid="input-phone-profile"]', '1452'); + await page.click('[data-testid="btn-save-profile"]'); + await expect(page.locator('[data-testid="toast-content"]')).toBeVisible(); + await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Por favor, corrija os erros antes de salvar.'); + await expect(page.locator('[data-testid="input-error-phone-profile"]')).toBeVisible(); + await expect(page.locator('[data-testid="input-error-phone-profile"]')).toHaveText('O telefone deve ter no mínimo 10 dígitos.'); + }); + + test('Deveria ser possível salvar a alteração', async ({ page }) => { + const fullName = faker.person.fullName(); + const phone = faker.phone.number({ style: 'national' }); + const socialName = faker.person.firstName(); + + await page.fill('[data-testid="input-fullname-profile"]', fullName); + await page.fill('[data-testid="input-phone-profile"]', phone); + await page.fill('[data-testid="input-socialname-profile"]', socialName); + await page.click('[data-testid="btn-save-profile"]'); + await expect(page.locator('[data-testid="toast-content"]')).toBeVisible(); + await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Usuário alterado com sucesso.'); + }); +}); From c647a8197c27927e2bc7a446725d9c61674634cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Paix=C3=A3o?= <42840902+LeohsPaixao@users.noreply.github.com> Date: Tue, 3 Dec 2024 19:45:51 -0300 Subject: [PATCH 4/7] =?UTF-8?q?TEST:=20Testes=20na=20tela=20de=20tabela=20?= =?UTF-8?q?de=20usu=C3=A1rios=20(#74)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test: altera a configuracao dos workers * test: ajusta um teste flacky * test: cria mock para gerar usuarios fakers * test: adiciona testes na tela de lista de usuarios * test: adiciona o changesets --- .changeset/breezy-moose-tap.md | 5 +++ test/playwright/playwright.config.ts | 2 +- test/playwright/tests/shared/mocks/.gitkeep | 0 .../tests/shared/mocks/generateUsers.ts | 37 +++++++++++++++++ test/playwright/tests/specs/listUsers.spec.ts | 40 +++++++++++++++++++ .../tests/specs/registerUser.spec.ts | 10 +++-- 6 files changed, 89 insertions(+), 5 deletions(-) create mode 100644 .changeset/breezy-moose-tap.md delete mode 100644 test/playwright/tests/shared/mocks/.gitkeep create mode 100644 test/playwright/tests/shared/mocks/generateUsers.ts create mode 100644 test/playwright/tests/specs/listUsers.spec.ts diff --git a/.changeset/breezy-moose-tap.md b/.changeset/breezy-moose-tap.md new file mode 100644 index 0000000..1654cf2 --- /dev/null +++ b/.changeset/breezy-moose-tap.md @@ -0,0 +1,5 @@ +--- +"playwright-ui-tests": minor +--- + +test: adiciona testes na tela de listagem de usuários com o projeto Playwright diff --git a/test/playwright/playwright.config.ts b/test/playwright/playwright.config.ts index 12df229..61884cc 100644 --- a/test/playwright/playwright.config.ts +++ b/test/playwright/playwright.config.ts @@ -5,7 +5,7 @@ export default defineConfig({ fullyParallel: true, forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, - workers: process.env.CI ? 1 : undefined, + workers: 1, reporter: 'html', use: { baseURL: 'http://localhost:8181', diff --git a/test/playwright/tests/shared/mocks/.gitkeep b/test/playwright/tests/shared/mocks/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/test/playwright/tests/shared/mocks/generateUsers.ts b/test/playwright/tests/shared/mocks/generateUsers.ts new file mode 100644 index 0000000..2957eef --- /dev/null +++ b/test/playwright/tests/shared/mocks/generateUsers.ts @@ -0,0 +1,37 @@ +import { faker } from '@faker-js/faker'; +import { request } from '@playwright/test'; +import { generateValidCPF } from '../commands/generateValidCPF'; + +/** + * Realiza o mock de criação de um usuário através de requisições HTTP. + */ +async function mockGenerateUsers(): Promise { + const apiContext = await request.newContext({ + baseURL: 'http://localhost:3001/register', + }); + + const response = await apiContext.post('/register', { + data: { + fullName: faker.person.fullName(), + socialName: faker.person.lastName(), + document: generateValidCPF(), + docType: 'cpf', + phone: faker.phone.number({ style: 'national' }), + email: faker.internet.email({ provider: 'example.qa.solar' }), + password: '123456', + }, + }); + + if (!response.ok()) { + throw new Error(`Erro ao criar usuário: ${response.status()}`); + } +} + +/** + * Gera múltiplos usuários simulados. + */ +export async function generateUsers(): Promise { + for (let i = 0; i < 10; i++) { + await mockGenerateUsers(); + } +} diff --git a/test/playwright/tests/specs/listUsers.spec.ts b/test/playwright/tests/specs/listUsers.spec.ts new file mode 100644 index 0000000..31813cb --- /dev/null +++ b/test/playwright/tests/specs/listUsers.spec.ts @@ -0,0 +1,40 @@ +import { expect, test } from '@playwright/test'; +import { login } from '../shared/commands/login'; +import { generateUsers } from '../shared/mocks/generateUsers'; + +test.describe('Tela de listagem de Usuários', () => { + + test.beforeAll(async () => { + await generateUsers(); + }); + + test.beforeEach(async ({ page }) => { + login(page, 'generic@example.com', '123456'); + await page.goto('/listusers') + await page.waitForURL('/listusers'); + }); + + test('Deveria ser possível visualizar os elementos da tela de listagem de Usuários', async ({ page }) => { + await expect(page.locator('[data-testid="table-users"]')).toBeVisible(); + await expect(page.locator('[data-testid="checkbox-select-all"]')).toBeVisible(); + await page.locator('[data-testid="btn-delete-user"]').scrollIntoViewIfNeeded(); + await expect(page.locator('[data-testid="btn-delete-user"]')).toBeVisible(); + }); + + test('Deveria ser possível selecionar todos os usuários', async ({ page }) => { + const selectAllCheckbox = page.locator('[data-testid="checkbox-select-all"]'); + await selectAllCheckbox.check(); + await expect(selectAllCheckbox).toBeChecked(); + }); + + test('Deveria ser possível selecionar um usuário e excluí-lo', async ({ page }) => { + const userCheckbox = page.locator('[data-testid="checkbox-select-users"]').nth(2); + await userCheckbox.check(); + const deleteButton = page.locator('[data-testid="btn-delete-user"]'); + await deleteButton.scrollIntoViewIfNeeded(); + await deleteButton.click(); + const toastContent = page.locator('[data-testid="toast-content"]').first(); + await expect(toastContent).toBeVisible(); + await expect(toastContent).toHaveText('1 usuário(s) excluído(s) com sucesso!'); + }); +}); diff --git a/test/playwright/tests/specs/registerUser.spec.ts b/test/playwright/tests/specs/registerUser.spec.ts index b78e460..f1411b5 100644 --- a/test/playwright/tests/specs/registerUser.spec.ts +++ b/test/playwright/tests/specs/registerUser.spec.ts @@ -15,16 +15,18 @@ test.describe('Tela de Cadastro de Usuários', () => { await expect(page.locator('[data-testid="link-go-to-login"]')).toBeVisible(); }); - test('Deveria ser possivel visualizar o toast ao clicar no botão sem adicionar algum valor nos campos', async ({ page }) => { + test('Deveria ser possível visualizar o toast ao clicar no botão sem adicionar algum valor nos campos', async ({ page }) => { await page.locator('[data-testid="btn-register"]').click(); await expect(page.locator('[data-testid="toast-content"]')).toHaveText('Por favor, corrija os erros no formulário.'); const inputName = ['fullname', 'cpfcnpj', 'email', 'password']; const inputError = ['O Nome Completo é obrigatório.', 'O CPF/CNPJ é obrigatório.', 'O Email é obrigatório.', 'A Senha é obrigatória.']; - inputName.forEach((name, index) => { - expect(page.locator(`[data-testid="input-error-${name}"]`)).toHaveText(inputError[index]); - }) + for (let i = 0; i < inputName.length; i++) { + const name = inputName[i]; + const error = inputError[i]; + await expect(page.locator(`[data-testid="input-error-${name}"]`)).toHaveText(error); + } }); test('Não deveria ser possivel criar o usuário com o Nome Completo errado', async ({ page }) => { From ffccc3d98197bc6cd451f97e4e58f3f2d18073ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Paix=C3=A3o?= <42840902+LeohsPaixao@users.noreply.github.com> Date: Tue, 3 Dec 2024 20:06:03 -0300 Subject: [PATCH 5/7] TEST: Adiciona as env no projeto playwright (#75) * test: adiciona as variaveis de ambientes no projeto playwright * test: adiciona o changeset * test: adiciona as envs no workflow do playwright --- .changeset/spicy-spoons-flow.md | 5 +++++ .github/workflows/main.yml | 3 +++ test/playwright/.env.example | 2 ++ test/playwright/playwright.config.ts | 5 ++++- test/playwright/tests/shared/commands/login.ts | 2 +- test/playwright/tests/shared/mocks/generateUsers.ts | 2 +- 6 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 .changeset/spicy-spoons-flow.md create mode 100644 test/playwright/.env.example diff --git a/.changeset/spicy-spoons-flow.md b/.changeset/spicy-spoons-flow.md new file mode 100644 index 0000000..d617f8e --- /dev/null +++ b/.changeset/spicy-spoons-flow.md @@ -0,0 +1,5 @@ +--- +"playwright-ui-tests": patch +--- + +test: adiciona variaveis de ambiente para o projeto Playwright diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d88431a..4f22abb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -142,6 +142,9 @@ jobs: run: | cd test/playwright yarn play:run + env: + PLAY_API_URL: ${{ secrets.PLAY_API_URL }} + PLAY_BASE_URL: ${{ secrets.PLAY_BASE_URL }} - name: Upload de relatório Playwright if: ${{ failure() }} diff --git a/test/playwright/.env.example b/test/playwright/.env.example new file mode 100644 index 0000000..497a9e5 --- /dev/null +++ b/test/playwright/.env.example @@ -0,0 +1,2 @@ +PLAY_BASE_URL = "http://localhost:8181" +PLAY_API_URL = "http://localhost:3001" \ No newline at end of file diff --git a/test/playwright/playwright.config.ts b/test/playwright/playwright.config.ts index 61884cc..041ae34 100644 --- a/test/playwright/playwright.config.ts +++ b/test/playwright/playwright.config.ts @@ -1,4 +1,7 @@ import { defineConfig, devices } from '@playwright/test'; +import dotenv from 'dotenv' + +dotenv.config() export default defineConfig({ testDir: './tests/specs', @@ -8,7 +11,7 @@ export default defineConfig({ workers: 1, reporter: 'html', use: { - baseURL: 'http://localhost:8181', + baseURL: process.env.PLAY_BASE_URL, trace: 'on-first-retry', }, projects: [ diff --git a/test/playwright/tests/shared/commands/login.ts b/test/playwright/tests/shared/commands/login.ts index 7d8c451..8278b19 100644 --- a/test/playwright/tests/shared/commands/login.ts +++ b/test/playwright/tests/shared/commands/login.ts @@ -11,7 +11,7 @@ import { Page } from '@playwright/test'; */ export async function login(page: Page, email: string, password: string): Promise { - const response = await page.request.fetch('http://localhost:3001/login', { + const response = await page.request.fetch(`${process.env.PLAY_API_URL}/login`, { method: 'POST', headers: { 'Content-Type': 'application/json' diff --git a/test/playwright/tests/shared/mocks/generateUsers.ts b/test/playwright/tests/shared/mocks/generateUsers.ts index 2957eef..27ecac1 100644 --- a/test/playwright/tests/shared/mocks/generateUsers.ts +++ b/test/playwright/tests/shared/mocks/generateUsers.ts @@ -7,7 +7,7 @@ import { generateValidCPF } from '../commands/generateValidCPF'; */ async function mockGenerateUsers(): Promise { const apiContext = await request.newContext({ - baseURL: 'http://localhost:3001/register', + baseURL: `${process.env.PLAY_API_URL}/register`, }); const response = await apiContext.post('/register', { From 02e9cc6cc039472e0549880f9c423216694371dd Mon Sep 17 00:00:00 2001 From: Leonardo Paixao Date: Tue, 3 Dec 2024 20:09:36 -0300 Subject: [PATCH 6/7] story: playwright minor 1.2.0 --- .changeset/breezy-moose-tap.md | 5 ----- .changeset/good-paws-punch.md | 5 ----- .changeset/mean-turkeys-juggle.md | 5 ----- .changeset/shy-cameras-accept.md | 5 ----- .changeset/spicy-spoons-flow.md | 5 ----- .changeset/weak-suns-unite.md | 5 ----- test/cypress/CHANGELOG.md | 6 ++++++ test/cypress/package.json | 2 +- test/playwright/CHANGELOG.md | 13 +++++++++++++ test/playwright/package.json | 2 +- 10 files changed, 21 insertions(+), 32 deletions(-) delete mode 100644 .changeset/breezy-moose-tap.md delete mode 100644 .changeset/good-paws-punch.md delete mode 100644 .changeset/mean-turkeys-juggle.md delete mode 100644 .changeset/shy-cameras-accept.md delete mode 100644 .changeset/spicy-spoons-flow.md delete mode 100644 .changeset/weak-suns-unite.md diff --git a/.changeset/breezy-moose-tap.md b/.changeset/breezy-moose-tap.md deleted file mode 100644 index 1654cf2..0000000 --- a/.changeset/breezy-moose-tap.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"playwright-ui-tests": minor ---- - -test: adiciona testes na tela de listagem de usuários com o projeto Playwright diff --git a/.changeset/good-paws-punch.md b/.changeset/good-paws-punch.md deleted file mode 100644 index 7a372ae..0000000 --- a/.changeset/good-paws-punch.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"playwright-ui-tests": minor ---- - -test: adiciona testes na tela de cadastro do usuário com o projeto Playwright diff --git a/.changeset/mean-turkeys-juggle.md b/.changeset/mean-turkeys-juggle.md deleted file mode 100644 index 92f2680..0000000 --- a/.changeset/mean-turkeys-juggle.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"playwright-ui-tests": minor ---- - -test: adiciona testes na tela de recuperação de senha com o projeto Playwright diff --git a/.changeset/shy-cameras-accept.md b/.changeset/shy-cameras-accept.md deleted file mode 100644 index bd95b04..0000000 --- a/.changeset/shy-cameras-accept.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"cypress-ui-tests": patch ---- - -test: remove o uso da funcao fillUserForm nos testes diff --git a/.changeset/spicy-spoons-flow.md b/.changeset/spicy-spoons-flow.md deleted file mode 100644 index d617f8e..0000000 --- a/.changeset/spicy-spoons-flow.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"playwright-ui-tests": patch ---- - -test: adiciona variaveis de ambiente para o projeto Playwright diff --git a/.changeset/weak-suns-unite.md b/.changeset/weak-suns-unite.md deleted file mode 100644 index fbe82d8..0000000 --- a/.changeset/weak-suns-unite.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"playwright-ui-tests": minor ---- - -test: adiciona testes na tela de perfil do usuário com o projeto Playwright diff --git a/test/cypress/CHANGELOG.md b/test/cypress/CHANGELOG.md index 8651378..4ea2a39 100644 --- a/test/cypress/CHANGELOG.md +++ b/test/cypress/CHANGELOG.md @@ -1,5 +1,11 @@ # cypress-ui-tests +## 1.3.1 + +### Patch Changes + +- 5c19a98: test: remove o uso da funcao fillUserForm nos testes + ## 1.3.0 ### Minor Changes diff --git a/test/cypress/package.json b/test/cypress/package.json index 8a2f138..244c85f 100644 --- a/test/cypress/package.json +++ b/test/cypress/package.json @@ -1,6 +1,6 @@ { "name": "cypress-ui-tests", - "version": "1.3.0", + "version": "1.3.1", "description": "Project Tests Cypress", "author": "Leonardo Paixao ", "license": "MIT", diff --git a/test/playwright/CHANGELOG.md b/test/playwright/CHANGELOG.md index e4ba7c8..24c2d4f 100644 --- a/test/playwright/CHANGELOG.md +++ b/test/playwright/CHANGELOG.md @@ -1,5 +1,18 @@ # playwright-ui-tests +## 1.2.0 + +### Minor Changes + +- c647a81: test: adiciona testes na tela de listagem de usuários com o projeto Playwright +- 5c19a98: test: adiciona testes na tela de cadastro do usuário com o projeto Playwright +- 5c19a98: test: adiciona testes na tela de recuperação de senha com o projeto Playwright +- 8b293f3: test: adiciona testes na tela de perfil do usuário com o projeto Playwright + +### Patch Changes + +- ffccc3d: test: adiciona variaveis de ambiente para o projeto Playwright + ## 1.1.5 ### Patch Changes diff --git a/test/playwright/package.json b/test/playwright/package.json index a146693..43382c8 100644 --- a/test/playwright/package.json +++ b/test/playwright/package.json @@ -1,6 +1,6 @@ { "name": "playwright-ui-tests", - "version": "1.1.5", + "version": "1.2.0", "description": "Project Tests Playwright", "author": "Leonardo Paixao ", "license": "MIT", From 70ace607cc2236612eac5885005c26a8e2654107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Paix=C3=A3o?= <42840902+LeohsPaixao@users.noreply.github.com> Date: Tue, 3 Dec 2024 20:16:12 -0300 Subject: [PATCH 7/7] chore: remove o script wait until (#77) --- .github/workflows/main.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4f22abb..18ed34f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,9 +47,7 @@ jobs: - name: Iniciar backend run: | cd backend - yarn api & - chmod +x .github/scripts/wait_until.sh - .github/scripts/wait_until.sh localhost:3001 + nohup yarn api & env: DATABASE_URL: ${{ secrets.DATABASE_URL }} JWT_SECRET: ${{ secrets.JWT_SECRET }} @@ -57,9 +55,7 @@ jobs: - name: Iniciar frontend run: | cd frontend - yarn serve & - chmod +x .github/scripts/wait_until.sh - .github/scripts/wait_until.sh 127.0.0.1:8181 + nohup yarn serve & - name: Executar testes Cypress run: |