-
-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests - Add E2E for header info login
- Loading branch information
Showing
2 changed files
with
61 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// @ts-check | ||
import { test, expect } from '@playwright/test'; | ||
import {ProjectPage} from "./pages/project"; | ||
|
||
test.describe('Header', | ||
{ | ||
tag: ['@readonly'], | ||
}, | ||
() => { | ||
|
||
test('Login info as user A on the landing page', async ({ browser }) => { | ||
const userA = await browser.newContext({ storageState: 'playwright/.auth/user_in_group_a.json' }); | ||
const page = await userA.newPage(); | ||
await page.goto('index.php'); | ||
|
||
// Fixme, class "hide" but visible ? | ||
await expect(page.locator("#info-user-login")).toHaveText("user_in_group_a"); | ||
await expect(page.locator("#info-user-firstname")).toHaveText("User A"); | ||
await expect(page.locator("#info-user-firstname")).toHaveClass("hide"); | ||
await expect(page.locator("#info-user-firstname")).toBeVisible(); | ||
await expect(page.locator("#info-user-lastname")).toHaveText("Testadiferro"); | ||
await expect(page.locator("#info-user-lastname")).toHaveClass("hide"); | ||
await expect(page.locator("#info-user-lastname")).toBeVisible(); | ||
await expect(page.locator("#info-user-organization")).toHaveText("Make it KISS"); | ||
await expect(page.locator("#info-user-organization")).toHaveClass("hide"); | ||
await expect(page.locator("#info-user-organization")).toBeVisible(); | ||
}); | ||
|
||
test('Login info as user A on project page', async ({ browser }) => { | ||
const userA = await browser.newContext({ storageState: 'playwright/.auth/user_in_group_a.json' }); | ||
const userPage = await userA.newPage(); | ||
const projectPage = new ProjectPage(userPage, 'world-3857'); | ||
await projectPage.open(); | ||
|
||
await expect(userPage.locator("#info-user-login")).toHaveText("user_in_group_a"); | ||
await expect(userPage.locator("#info-user-firstname")).toHaveText("User A"); | ||
await expect(userPage.locator("#info-user-firstname")).toHaveClass("hide"); | ||
await expect(userPage.locator("#info-user-firstname")).not.toBeVisible(); | ||
await expect(userPage.locator("#info-user-lastname")).toHaveText("Testadiferro"); | ||
await expect(userPage.locator("#info-user-lastname")).toHaveClass("hide"); | ||
await expect(userPage.locator("#info-user-lastname")).not.toBeVisible(); | ||
await expect(userPage.locator("#info-user-organization")).toHaveText("Make it KISS"); | ||
await expect(userPage.locator("#info-user-organization")).toHaveClass("hide"); | ||
await expect(userPage.locator("#info-user-organization")).not.toBeVisible(); | ||
}); | ||
|
||
test('Login info as anonymous on the landing page', async ({ page }) => { | ||
await page.goto('index.php'); | ||
await expect(page.locator("#headermenu .login")).toHaveText("Connect"); | ||
}); | ||
|
||
test('Login info as anonymous on project page', async ({ page }) => { | ||
const projectPage = new ProjectPage(page, 'world-3857'); | ||
await projectPage.open(); | ||
await expect(page.locator("#headermenu .login")).toHaveText("Connect"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,11 @@ INSERT INTO lizmap.jacl2_group( | |
|
||
-- Users | ||
INSERT INTO lizmap.jlx_user( | ||
usr_login, usr_email, usr_password, status, create_date) | ||
usr_login, usr_email, usr_password, status, create_date, firstname, lastname, organization) | ||
VALUES | ||
('user_in_group_a', '[email protected]', '$2y$10$d2KZfxeYJP0l3YbNyDMZYe2vGSA3JWa8kFJSdecmSEIqInjnunTJ.', 1, NOW()), | ||
('user_in_group_b', '[email protected]', '$2y$10$d2KZfxeYJP0l3YbNyDMZYe2vGSA3JWa8kFJSdecmSEIqInjnunTJ.', 1, NOW()), | ||
('publisher', '[email protected]', '$2y$10$d2KZfxeYJP0l3YbNyDMZYe2vGSA3JWa8kFJSdecmSEIqInjnunTJ.', 1, NOW()) | ||
('user_in_group_a', '[email protected]', '$2y$10$d2KZfxeYJP0l3YbNyDMZYe2vGSA3JWa8kFJSdecmSEIqInjnunTJ.', 1, NOW(), 'User A', 'Testadiferro', 'Make it KISS'), | ||
('user_in_group_b', '[email protected]', '$2y$10$d2KZfxeYJP0l3YbNyDMZYe2vGSA3JWa8kFJSdecmSEIqInjnunTJ.', 1, NOW(), 'User B', 'Testillano', 'Make it KISS'), | ||
('publisher', '[email protected]', '$2y$10$d2KZfxeYJP0l3YbNyDMZYe2vGSA3JWa8kFJSdecmSEIqInjnunTJ.', 1, NOW(), 'Publisher', 'Testla', 'Make it KISS') | ||
ON CONFLICT DO NOTHING | ||
; | ||
|
||
|