Skip to content

Commit

Permalink
fix secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
oumeimaelisbihani committed Nov 13, 2024
1 parent 84a9d73 commit d2a4920
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 4 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
env:
PDE_API_BASEURL: '${{secrets.PDE_API_BASEURL}}'
BREVO_DEAL_PIPELINE: '${{secrets.BREVO_DEAL_PIPELINE}}'
strategy:
matrix:
node-version: [ '20.x' ]
Expand All @@ -26,8 +29,6 @@ jobs:
- name: Run Playwright tests
env:
TEST: true
PDE_API_BASEURL: '${{secrets.PDE_API_BASEURL}}'
BREVO_DEAL_PIPELINE: '${{secrets.BREVO_DEAL_PIPELINE}}'
run: npm run e2e
- uses: actions/upload-artifact@v4
if: always()
Expand Down
4 changes: 2 additions & 2 deletions apps/web-e2e/src/formResults.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ tests.forEach((singleTest) => {

await submitButton.click()

/* const expectedCallbackSelector = singleTest.valid
const expectedCallbackSelector = singleTest.valid
? '[teste2e-selector="success-callback-contact-form"]'
: '[teste2e-selector="error-callback-contact-form"]'

await expect(page.locator(expectedCallbackSelector)).toBeVisible({ timeout: 1000 }) */
await expect(page.locator(expectedCallbackSelector)).toBeVisible({ timeout: 1000 })
} else {
await expect(submitButton).toBeDisabled()
}
Expand Down
29 changes: 29 additions & 0 deletions apps/web-e2e/src/programResults.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { test, expect } from '@playwright/test'
import { tests } from './programResultsData'

/**
* Test the number of programs proposed as a result of a list of queries and their order.
*/
tests.forEach((singleTest) => {
test(`Test id ${singleTest.id} - Verify programs number and order for query ${singleTest.url}`, async ({ page }) => {
await page.goto(singleTest.url)
try {
await page.waitForSelector('.teste2e-program-target', { timeout: 3000 })
} catch (error) {
// this is an expected error what can happen
// - if the number of results is 0
// - in some mobile data browser
}
const elementsLocal = await page.$$eval('.teste2e-program-target', (els) => els.map((el) => el.innerHTML.trim()))

// console.warn(singleTest.values)
// console.warn(elementsLocal)

expect(elementsLocal.length).toBe(singleTest.count ?? singleTest.values.length)
if (singleTest.count < 100) {
for (let i = 0; i < elementsLocal.length; i++) {
expect(elementsLocal[i]).toBe(singleTest.values[i])
}
}
})
})
55 changes: 55 additions & 0 deletions apps/web-e2e/src/projectResults.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { test, expect } from '@playwright/test'
import { tests } from './projectResultsData'

tests.forEach((singleTest) => {
test(`Test id ${singleTest.id} - Verify content and elements for query ${singleTest.url}`, async ({ page }) => {
await page.goto(singleTest.url)
try {
await page.waitForSelector('.teste2e-project-target', { timeout: 3000 })
} catch (error) {
// this is an expected error that can happen
// - if the number of results is 0
// - in some mobile data browser
}
const elementsLocal = await page.$$eval('.teste2e-project-target h3 a', (els) => els.map((el) => el.innerHTML.trim()))

// console.warn(singleTest.values)
// console.warn(elementsLocal)

expect(elementsLocal.length).toBe(singleTest.count ?? singleTest.values.length)
for (let i = 0; i < elementsLocal.length; i++) {
expect(elementsLocal[i]).toBe(singleTest.values[i])
}
})
})

test(`Check projects found while initially selecting different tags`, async ({ page }) => {
const urlTag1 = 'questionnaire/resultat?choix-du-parcours=j-ai-un-projet&siret=83014132100034&effectif=TPE&objectifs=mobility'
const urlTag2 = 'questionnaire/resultat?choix-du-parcours=j-ai-un-projet&siret=83014132100034&effectif=TPE&objectifs=building'

await page.goto(urlTag1)
try {
await page.waitForSelector('.teste2e-project-target', { timeout: 3000 })
} catch (error) {
// this is an expected error that can happen
// - if the number of results is 0
// - in some mobile data browser
}
const elementsurlTag1 = await page.$$eval('.teste2e-project-target h3 a', (els) => els.map((el) => el.innerHTML.trim()))
await page.goto(urlTag2)
try {
await page.waitForSelector('.teste2e-project-target', { timeout: 3000 })
} catch (error) {
// this is an expected error that can happen
// - if the number of results is 0
// - in some mobile data browser
}
await page.click('//button[normalize-space(.)="🚲 mobilité"]')

const elementsurlTag2 = await page.$$eval('.teste2e-project-target h3 a', (els) => els.map((el) => el.innerHTML.trim()))

expect(elementsurlTag1.length).toBe(elementsurlTag2.length)
for (let i = 0; i < elementsurlTag2.length; i++) {
expect(elementsurlTag1[i]).toBe(elementsurlTag2[i])
}
})

0 comments on commit d2a4920

Please sign in to comment.