Skip to content

Commit

Permalink
add language fr and digirisk element page test
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-micka committed Dec 1, 2023
1 parent 27abeda commit cea5f00
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 12 deletions.
20 changes: 15 additions & 5 deletions playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ module.exports = defineConfig({
name: 'chromium',
use: {
...devices['Desktop Chrome'],
locale: 'fr-CA',
// Use prepared auth state.
storageState: 'playwright/.auth/user.json',
},
Expand All @@ -48,6 +49,7 @@ module.exports = defineConfig({
name: 'firefox',
use: {
...devices['Desktop Firefox'],
locale: 'fr-CA',
// Use prepared auth state.
storageState: 'playwright/.auth/user.json',
},
Expand All @@ -56,7 +58,9 @@ module.exports = defineConfig({

{
name: 'webkit',
use: { ...devices['Desktop Safari'],
use: {
...devices['Desktop Safari'],
locale: 'fr-CA',
// Use prepared auth state.
storageState: 'playwright/.auth/user.json',
},
Expand All @@ -78,10 +82,16 @@ module.exports = defineConfig({
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
// {
// name: 'Google Chrome',
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
// },
{
name: 'Google Chrome',
use: {
...devices['Desktop Chrome'],
locale: 'fr-CA',
// Use prepared auth state.
storageState: 'playwright/.auth/user.json',
channel: 'chrome',
},
},
],

/* Run your local dev server before starting the tests */
Expand Down
14 changes: 7 additions & 7 deletions tests/page_view.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ test('has title', async ({ page }) => {
await page.goto(digiriskUrl + 'digiriskdolibarrindex.php');

// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Welcome to DigiriskDolibarr 9.14.0/);
await expect(page).toHaveTitle(/Bienvenue sur DigiriskDolibarr 9.14.0/);
});

test('get DU page', async ({ page }) => {
Expand All @@ -25,7 +25,7 @@ test('get RiskList page', async ({ page }) => {
const locator = page.locator('.titre.inline-block');

await expect(locator).toBeVisible();
await expect(locator).toContainText('DigiriskElementRisksList');
await expect(locator).toContainText('Liste des risques');
});

test('get PreventionPlanList page', async ({ page }) => {
Expand All @@ -34,7 +34,7 @@ test('get PreventionPlanList page', async ({ page }) => {
const locator = page.locator('.titre.inline-block');

await expect(locator).toBeVisible();
await expect(locator).toContainText('PreventionPlanList');
await expect(locator).toContainText('Liste des plans de prévention');
});

test('get FirePermitList page', async ({ page }) => {
Expand All @@ -43,7 +43,7 @@ test('get FirePermitList page', async ({ page }) => {
const locator = page.locator('.titre.inline-block');

await expect(locator).toBeVisible();
await expect(locator).toContainText('FirePermitList');
await expect(locator).toContainText('Liste des permis de feu');
});

test('get AccidentList page', async ({ page }) => {
Expand All @@ -52,7 +52,7 @@ test('get AccidentList page', async ({ page }) => {
const locator = page.locator('.titre.inline-block');

await expect(locator).toBeVisible();
await expect(locator).toContainText('AccidentList');
await expect(locator).toContainText('Liste des accidents');
});

test('get AccidentsCategoriesArea page', async ({ page }) => {
Expand All @@ -61,7 +61,7 @@ test('get AccidentsCategoriesArea page', async ({ page }) => {
const locator = page.locator('.titre.inline-block');

await expect(locator).toBeVisible();
await expect(locator).toContainText('AccidentsCategoriesArea');
await expect(locator).toContainText('Espace des tags/catégories des accidents');
});

test('get AccidentInvestigationList page', async ({ page }) => {
Expand All @@ -70,7 +70,7 @@ test('get AccidentInvestigationList page', async ({ page }) => {
const locator = page.locator('.titre.inline-block');

await expect(locator).toBeVisible();
await expect(locator).toContainText('AccidentInvestigationList');
await expect(locator).toContainText('Liste des enquêtes accidents');
});

test('get GPUT Organization page', async ({ page }) => {
Expand Down
28 changes: 28 additions & 0 deletions tests/risk.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { test, expect } from '@playwright/test';

const dolibarrUrl = 'http://localhost/dolibarr/htdocs/';
const digiriskUrl = dolibarrUrl + 'custom/digiriskdolibarr/';

test('digirisk element page', async ({ page }) => {
await page.goto(digiriskUrl + 'view/digiriskstandard/digiriskstandard_card.php');

// Looking for first groupment (id1 = Trash)
const gp_one = page.locator('.linkElement.id2');

await gp_one.click();

const gp_id = page.locator('.refid');

await expect(gp_id).toBeVisible();
await expect(gp_id).toContainText('GP1');

const gp_info = page.locator('.refidno');

await expect(gp_id).toBeVisible();
await expect(gp_id).toContainText('Document Unique');

const risklist = page.locator('.titre.inline-block');

await expect(risklist).toBeVisible();
await expect(risklist).toContainText('Liste des risques');
});

0 comments on commit cea5f00

Please sign in to comment.