Skip to content

Commit 4168325

Browse files
Merge pull request #3 from AndressaKarla/refatoracoes
Ajustando seletores home-page; scripts, trecho workflow, parte descrição readme com SOs, arquivo config pw com firefox, etc
2 parents d172f0f + 9db4e13 commit 4168325

File tree

5 files changed

+59
-5
lines changed

5 files changed

+59
-5
lines changed

.github/workflows/workflow-testes-automatizados-web-front-serve-rest-playwright.yml

+44-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
workflow_dispatch:
1212

1313
jobs:
14-
testes-automatizados-web-front-serve-rest-playwright-chrome:
14+
playwright-chrome:
1515
# agente de execução/runner do tipo máquina virtual bem enxuta, sem interface gráfica
1616
runs-on: ubuntu-latest
1717
steps:
@@ -55,3 +55,46 @@ jobs:
5555
name: playwright-relatorio-html-chrome
5656
path: ./playwright-report
5757
retention-days: 30
58+
59+
playwright-firefox:
60+
# esse job "playwright-firefox" somente é executado se o job anterior "playwright-chrome" for executado com sucesso
61+
needs: playwright-chrome
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: Passo 1 - Obter cópia do código-fonte do repositório
65+
uses: actions/checkout@v3
66+
67+
- name: Passo 2 - Redirecionar os conteúdos de "secrets.LOGIN_ENV", "secrets.USUARIO_ENV", para os arquivos "login.json", "usuario.json", etc
68+
run: |
69+
echo '${{ secrets.LOGIN_ENV }}' > ./tests/support/fixtures/login.json
70+
echo '${{ secrets.USUARIO_ENV }}' > ./tests/support/fixtures/usuario.json
71+
72+
- name: Passo 3 - Instalar node versão 18
73+
uses: actions/setup-node@v3
74+
with:
75+
node-version: 18
76+
77+
- name: Passo 4 - Instalar dependências do projeto
78+
run: npm install --force
79+
80+
- name: Passo 5 - Instalar navegadores do Playwright
81+
run: npx playwright install --with-deps
82+
83+
- name: Passo 6 - Executar testes em modo headless (2º plano) em um ambiente de produção e Gerar os resultados dos testes
84+
run: npm run test:ff
85+
86+
- name: Passo 7 - Armazenar os resultados dos testes em screenshots e vídeos
87+
uses: actions/upload-artifact@v3
88+
if: ${{ always() }}
89+
with:
90+
name: playwright-screenshots-videos-firefox
91+
path: ./test-results
92+
retention-days: 30
93+
94+
- name: Passo 8 - Armazenar os resultados dos testes em relatório html
95+
uses: actions/upload-artifact@v3
96+
if: ${{ always() }}
97+
with:
98+
name: playwright-relatorio-html-firefox
99+
path: ./playwright-report
100+
retention-days: 30

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Projeto de Testes Automatizados Web | Playwright | Javascript | Page Objects | GitHub Actions :test_tube:
33
---
44
# :information_source: Introdução
5-
Me baseei e adaptei parte do que foi ensinado nos cursos ["Playwright eXpress"](https://www.udemy.com/course/playwright-express) e ["Playwright Zombie Edition"](https://www.udemy.com/course/playwright-zombie) da ["QAx"](https://www.udemy.com/user/weare-qax) para esse projeto "testes-automatizados-web-front-serve-rest_playwright-javascript" que é executado em um ambiente de produção no ["front"](https://front.serverest.dev) e na ["API REST"](https://serverest.dev) do ["ServeRest"](https://github.com/ServeRest) que simula uma loja virtual, e que foi desenvolvido com o objetivo de me aprofundar um pouco mais nos estudos sobre testes automatizados web em Playwright, Javascript, Page Objects e GitHub Actions.
5+
Me baseei e adaptei parte do que foi ensinado nos cursos ["Playwright eXpress"](https://www.udemy.com/course/playwright-express) e ["Playwright Zombie Edition"](https://www.udemy.com/course/playwright-zombie) da ["QAx"](https://www.udemy.com/user/weare-qax) para esse projeto "testes-automatizados-web-front-serve-rest_playwright-javascript" que é executado em um ambiente de produção no ["front"](https://front.serverest.dev) e na ["API REST"](https://serverest.dev) do ["ServeRest"](https://github.com/ServeRest) que simula uma loja virtual, nos navegadores Chrome e Firefox, Sistemas Operacionais Windows e Linux Ubuntu, e que foi desenvolvido com o objetivo de me aprofundar um pouco mais nos estudos sobre testes automatizados web em Playwright, Javascript, Page Objects e GitHub Actions.
66

77

88
---

package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@
77
"pw:ui": "playwright test --ui",
88
"pw:ui:local": "ENV environment=local playwright test --ui",
99
"test": "playwright test --project=chromium",
10+
"test:ff": "playwright test --project=firefox",
1011
"test:local": "ENV environment=local playwright test --project=chromium",
12+
"test:local:ff": "ENV environment=local playwright test --project=firefox",
1113
"test:headed": "playwright test --project=chromium --headed",
12-
"test:local:headed": "ENV environment=local playwright test --project=chromium --headed"
14+
"test:headed:ff": "playwright test --project=firefox --headed",
15+
"test:local:headed": "ENV environment=local playwright test --project=chromium --headed",
16+
"test:local:headed:ff": "ENV environment=local playwright test --project=firefox --headed"
1317
},
1418
"author": "Andressa Karla",
1519
"license": "ISC",

playwright.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ module.exports = defineConfig({
4141
...devices['Desktop Chrome'],
4242
baseURL: baseURLFront
4343
},
44+
},
45+
{
46+
name: 'firefox',
47+
use: {
48+
...devices['Desktop Firefox'],
49+
baseURL: baseURLFront
50+
},
4451
}
4552
]
4653
})

tests/pages/home-page.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
class HomePage {
22
constructor(page) {
33
this.page = page;
4-
this.textoBemVindo = page.locator('#root > div > div > h1')
5-
this.textoSistemaAdministrarEcommerce = page.locator('#root > div > div > p.lead')
4+
this.textoBemVindo = page.locator('h1')
5+
this.textoSistemaAdministrarEcommerce = page.locator('p.lead')
66
}
77
}
88

0 commit comments

Comments
 (0)