Skip to content

Ajustando seletores home-page; scripts, trecho workflow, parte descrição readme com SOs, arquivo config pw com firefox, etc #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
workflow_dispatch:

jobs:
testes-automatizados-web-front-serve-rest-playwright-chrome:
playwright-chrome:
# agente de execução/runner do tipo máquina virtual bem enxuta, sem interface gráfica
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -55,3 +55,46 @@ jobs:
name: playwright-relatorio-html-chrome
path: ./playwright-report
retention-days: 30

playwright-firefox:
# esse job "playwright-firefox" somente é executado se o job anterior "playwright-chrome" for executado com sucesso
needs: playwright-chrome
runs-on: ubuntu-latest
steps:
- name: Passo 1 - Obter cópia do código-fonte do repositório
uses: actions/checkout@v3

- name: Passo 2 - Redirecionar os conteúdos de "secrets.LOGIN_ENV", "secrets.USUARIO_ENV", para os arquivos "login.json", "usuario.json", etc
run: |
echo '${{ secrets.LOGIN_ENV }}' > ./tests/support/fixtures/login.json
echo '${{ secrets.USUARIO_ENV }}' > ./tests/support/fixtures/usuario.json

- name: Passo 3 - Instalar node versão 18
uses: actions/setup-node@v3
with:
node-version: 18

- name: Passo 4 - Instalar dependências do projeto
run: npm install --force

- name: Passo 5 - Instalar navegadores do Playwright
run: npx playwright install --with-deps

- name: Passo 6 - Executar testes em modo headless (2º plano) em um ambiente de produção e Gerar os resultados dos testes
run: npm run test:ff

- name: Passo 7 - Armazenar os resultados dos testes em screenshots e vídeos
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: playwright-screenshots-videos-firefox
path: ./test-results
retention-days: 30

- name: Passo 8 - Armazenar os resultados dos testes em relatório html
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: playwright-relatorio-html-firefox
path: ./playwright-report
retention-days: 30
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Projeto de Testes Automatizados Web | Playwright | Javascript | Page Objects | GitHub Actions :test_tube:
---
# :information_source: Introdução
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.
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.


---
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
"pw:ui": "playwright test --ui",
"pw:ui:local": "ENV environment=local playwright test --ui",
"test": "playwright test --project=chromium",
"test:ff": "playwright test --project=firefox",
"test:local": "ENV environment=local playwright test --project=chromium",
"test:local:ff": "ENV environment=local playwright test --project=firefox",
"test:headed": "playwright test --project=chromium --headed",
"test:local:headed": "ENV environment=local playwright test --project=chromium --headed"
"test:headed:ff": "playwright test --project=firefox --headed",
"test:local:headed": "ENV environment=local playwright test --project=chromium --headed",
"test:local:headed:ff": "ENV environment=local playwright test --project=firefox --headed"
},
"author": "Andressa Karla",
"license": "ISC",
Expand Down
7 changes: 7 additions & 0 deletions playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ module.exports = defineConfig({
...devices['Desktop Chrome'],
baseURL: baseURLFront
},
},
{
name: 'firefox',
use: {
...devices['Desktop Firefox'],
baseURL: baseURLFront
},
}
]
})
Expand Down
4 changes: 2 additions & 2 deletions tests/pages/home-page.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
class HomePage {
constructor(page) {
this.page = page;
this.textoBemVindo = page.locator('#root > div > div > h1')
this.textoSistemaAdministrarEcommerce = page.locator('#root > div > div > p.lead')
this.textoBemVindo = page.locator('h1')
this.textoSistemaAdministrarEcommerce = page.locator('p.lead')
}
}

Expand Down
Loading