From 4fbad3da957d5d3d317257e30a47a6e72c3cda73 Mon Sep 17 00:00:00 2001 From: Renata Valois Date: Fri, 3 May 2024 16:27:34 -0300 Subject: [PATCH 1/4] added baseUrl to playwright config --- playwright.config.js | 2 +- tests/perfil.spec.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/playwright.config.js b/playwright.config.js index b15af2e..0137e5e 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -25,7 +25,7 @@ module.exports = defineConfig({ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */ - // baseURL: 'http://127.0.0.1:3000', + baseURL: 'https://frontend-nnf7bytugq-uc.a.run.app/', /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'on-first-retry', diff --git a/tests/perfil.spec.js b/tests/perfil.spec.js index 778728a..7deb9a7 100644 --- a/tests/perfil.spec.js +++ b/tests/perfil.spec.js @@ -1,7 +1,7 @@ const { test, expect } = require('@playwright/test'); test('acessar perfil', async ({ page }) => { - await page.goto('https://frontend-nnf7bytugq-uc.a.run.app/user/profile?show=profile'); + await page.goto('/user/profile?show=profile'); await expect(page).toHaveTitle(/Tem Vaga Mestre/); @@ -11,3 +11,5 @@ test('acessar perfil', async ({ page }) => { await page.getByRole('button', { name: 'Ver mais'}).click(); }); +// Como utilizar baseUrl - criar uma branch +// criar a tarefa, criar a branch e checkout From 181d6c6cd1abdf7585d035356285839ecdf23dfe Mon Sep 17 00:00:00 2001 From: Renata Valois Date: Tue, 7 May 2024 14:17:41 -0300 Subject: [PATCH 2/4] =?UTF-8?q?remo=C3=A7=C3=A3o=20das=20linhas=20de=20com?= =?UTF-8?q?ent=C3=A1rio=2014=20e=2015?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/perfil.spec.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/perfil.spec.js b/tests/perfil.spec.js index 7deb9a7..e24d8fa 100644 --- a/tests/perfil.spec.js +++ b/tests/perfil.spec.js @@ -11,5 +11,3 @@ test('acessar perfil', async ({ page }) => { await page.getByRole('button', { name: 'Ver mais'}).click(); }); -// Como utilizar baseUrl - criar uma branch -// criar a tarefa, criar a branch e checkout From a74eddba6f2e11bade4bde284f298a16422e893c Mon Sep 17 00:00:00 2001 From: brunomachadors Date: Tue, 14 May 2024 15:15:51 +0100 Subject: [PATCH 3/4] criando arquivo de constants e removendo testes de exemplo --- .gitignore | 1 + tests/example.spec.js | 19 ------------------- tests/perfil.spec.js | 12 +++++++----- 3 files changed, 8 insertions(+), 24 deletions(-) delete mode 100644 tests/example.spec.js diff --git a/.gitignore b/.gitignore index 68c5d18..07919b8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ node_modules/ /playwright-report/ /blob-report/ /playwright/.cache/ +.env diff --git a/tests/example.spec.js b/tests/example.spec.js deleted file mode 100644 index 40eddb8..0000000 --- a/tests/example.spec.js +++ /dev/null @@ -1,19 +0,0 @@ -// @ts-check -const { test, expect } = require('@playwright/test'); - -test('has title', async ({ page }) => { - await page.goto('https://playwright.dev/'); - - // Expect a title "to contain" a substring. - await expect(page).toHaveTitle(/Playwright/); -}); - -test('get started link', async ({ page }) => { - await page.goto('https://playwright.dev/'); - - // Click the get started link. - await page.getByRole('link', { name: 'Get started' }).click(); - - // Expects page to have a heading with the name of Installation. - await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible(); -}); diff --git a/tests/perfil.spec.js b/tests/perfil.spec.js index e24d8fa..10ef1e2 100644 --- a/tests/perfil.spec.js +++ b/tests/perfil.spec.js @@ -1,13 +1,15 @@ const { test, expect } = require('@playwright/test'); +const { PATH } = require('../utils/constants'); test('acessar perfil', async ({ page }) => { - await page.goto('/user/profile?show=profile'); - + await page.goto(PATH.perfil); + await expect(page).toHaveTitle(/Tem Vaga Mestre/); - await expect(page.getByRole('heading', { name: 'Estilos preferidos' })).toBeVisible(); + 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(); + await page.getByRole('button', { name: 'Ver mais' }).click(); }); - From ce481a04927f57c04f58c51616edbdafdf1b0f7d Mon Sep 17 00:00:00 2001 From: brunomachadors Date: Tue, 14 May 2024 15:16:01 +0100 Subject: [PATCH 4/4] criando arquivo de constants e removendo testes de exemplo --- utils/constants.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 utils/constants.js diff --git a/utils/constants.js b/utils/constants.js new file mode 100644 index 0000000..72ce782 --- /dev/null +++ b/utils/constants.js @@ -0,0 +1,3 @@ +export const PATH = { + perfil: '/user/profile?show=profile', +};