From 5bd50ae689c232328142543e3074136bea78e005 Mon Sep 17 00:00:00 2001 From: Lara Date: Sun, 28 Apr 2024 13:10:15 +0200 Subject: [PATCH] descomentando e2e --- .github/workflows/release.yml | 40 +++++++------- webapp/e2e/steps/01-register-form.steps.js | 52 ------------------- .../steps/{03-home.steps.js => home.steps.js} | 0 .../{02-login.steps.js => login.steps.js} | 0 4 files changed, 20 insertions(+), 72 deletions(-) delete mode 100644 webapp/e2e/steps/01-register-form.steps.js rename webapp/e2e/steps/{03-home.steps.js => home.steps.js} (100%) rename webapp/e2e/steps/{02-login.steps.js => login.steps.js} (100%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 628c986..9e4a6a3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,28 +27,28 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} -# e2e-tests: -# needs: [unit-tests] -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v4 -# - uses: actions/setup-node@v4 -# with: -# node-version: 20 -# - run: npm --prefix userservice/authservice install -# - run: npm --prefix userservice/userservice install -# - run: npm --prefix gatewayservice install -# - run: npm --prefix questionservice install -# - run: npm --prefix webapp install -# - run: npm --prefix webapp run build -# - run: npm --prefix webapp run test:e2e + e2e-tests: + needs: [unit-tests] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm --prefix userservice/authservice install + - run: npm --prefix userservice/userservice install + - run: npm --prefix gatewayservice install + - run: npm --prefix questionservice install + - run: npm --prefix webapp install + - run: npm --prefix webapp run build + - run: npm --prefix webapp run test:e2e docker-push-webapp: name: Push webapp Docker Image to GitHub Packages runs-on: ubuntu-latest permissions: contents: read packages: write -# needs: [e2e-tests] + needs: [e2e-tests] steps: - uses: actions/checkout@v4 - name: Publish to Registry @@ -68,7 +68,7 @@ jobs: permissions: contents: read packages: write -# needs: [e2e-tests] + needs: [e2e-tests] steps: - uses: actions/checkout@v4 - name: Publish to Registry @@ -85,7 +85,7 @@ jobs: permissions: contents: read packages: write -# needs: [e2e-tests] + needs: [e2e-tests] steps: - uses: actions/checkout@v4 - name: Publish to Registry @@ -102,7 +102,7 @@ jobs: permissions: contents: read packages: write -# needs: [e2e-tests] + needs: [e2e-tests] steps: - uses: actions/checkout@v4 - name: Update OpenAPI configuration @@ -123,7 +123,7 @@ jobs: permissions: contents: read packages: write -# needs: [e2e-tests] + needs: [e2e-tests] steps: - uses: actions/checkout@v4 - name: Publish to Registry diff --git a/webapp/e2e/steps/01-register-form.steps.js b/webapp/e2e/steps/01-register-form.steps.js deleted file mode 100644 index e54df87..0000000 --- a/webapp/e2e/steps/01-register-form.steps.js +++ /dev/null @@ -1,52 +0,0 @@ -const puppeteer = require('puppeteer'); -const { defineFeature, loadFeature }=require('jest-cucumber'); -const setDefaultOptions = require('expect-puppeteer').setDefaultOptions -const feature = loadFeature('./features/register-form.feature'); - -let page; -let browser; - -defineFeature(feature, test => { - - beforeAll(async () => { - browser = process.env.GITHUB_ACTIONS - ? await puppeteer.launch() - : await puppeteer.launch({ headless: false, slowMo: 100 }); - page = await browser.newPage(); - //Way of setting up the timeout - setDefaultOptions({ timeout: 10000 }) - - await page - .goto("http://localhost:3000", { - waitUntil: "networkidle0", - }) - .catch(() => {}); - }); - - test('The user is not registered in the site', ({given,when,then}) => { - - let username; - let password; - - given('An unregistered user', async () => { - username = "pablo@gmail.com" - password = "pabloasw1" - await expect(page).toClick("button", { text: "REGÍSTRATE" }); - }); - - when('I fill the data in the form and press submit', async () => { - await expect(page).toFill('input[name="username"]', username); - await expect(page).toFill('input[name="password"]', password); - await expect(page).toClick('button', { text: 'Crear' }) - }); - - then('A confirmation message should be shown in the screen', async () => { - await expect(page).toMatchElement("div", { text: "Usuario creado correctamente" }); - }); - }) - - afterAll(async ()=>{ - browser.close() - }) - -}); \ No newline at end of file diff --git a/webapp/e2e/steps/03-home.steps.js b/webapp/e2e/steps/home.steps.js similarity index 100% rename from webapp/e2e/steps/03-home.steps.js rename to webapp/e2e/steps/home.steps.js diff --git a/webapp/e2e/steps/02-login.steps.js b/webapp/e2e/steps/login.steps.js similarity index 100% rename from webapp/e2e/steps/02-login.steps.js rename to webapp/e2e/steps/login.steps.js