-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'staging' into block-navigation-to-setting-when-not-admin
- Loading branch information
Showing
30 changed files
with
862 additions
and
54 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
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 |
---|---|---|
|
@@ -41,3 +41,5 @@ next-env.d.ts | |
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ | ||
/e2e/playwright/.auth | ||
/playwright |
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
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
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
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
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
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
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
This file was deleted.
Oops, something went wrong.
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,16 @@ | ||
{ | ||
"api": { | ||
"addGraphUrl": "http://localhost:3000/api/graph/", | ||
"LoginApiUrl": "http://localhost:3000/api/auth/providers", | ||
"deleteGraphUrl": "http://localhost:3000/api/graph/" | ||
}, | ||
|
||
"falkorDBWeb": "https://www.falkordb.com/", | ||
"localHost": "http://localhost:3000", | ||
"loginUrl":"http://localhost:3000/login", | ||
"graphUrl": "http://localhost:3000/graph", | ||
"schemaUrl": "http://localhost:3000/schema", | ||
"settingsUrl": "http://localhost:3000/settings", | ||
"documentationUrl": "https://docs.falkordb.com/", | ||
"supportUrl": "https://www.falkordb.com/contact-us/" | ||
} |
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,14 @@ | ||
{ | ||
"user1":{ | ||
"userName": "test1", | ||
"role": "Read-Write", | ||
"password": "Test111@", | ||
"confirmPassword": "Test111@" | ||
}, | ||
"user2":{ | ||
"userName": "test2", | ||
"role": "Read-Write", | ||
"password": "Test222@", | ||
"confirmPassword": "Test222@" | ||
} | ||
} |
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,25 @@ | ||
import { APIRequestContext, request } from "@playwright/test" | ||
|
||
|
||
const getRequest = async (url: string, body: any, availableRequest?: APIRequestContext, headers?: Record<string, string>) => { | ||
const requestOptions = { | ||
data: body, | ||
headers: headers || undefined, | ||
}; | ||
|
||
const requestContext = availableRequest || (await request.newContext()); | ||
return await requestContext.get(url, requestOptions); | ||
}; | ||
|
||
const deleteRequest = async (url: string, headers?: Record<string, string>) => { | ||
const requestOptions = { | ||
headers: headers || undefined, | ||
}; | ||
|
||
const requestContext = await request.newContext(); | ||
return await requestContext.delete(url, requestOptions); | ||
}; | ||
|
||
|
||
|
||
export{ getRequest, deleteRequest } |
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,22 @@ | ||
import { Page } from 'playwright'; | ||
|
||
export default class BasePage { | ||
protected page: Page; | ||
|
||
constructor(page: Page) { | ||
this.page = page; | ||
} | ||
|
||
async initPage(){ | ||
await this.page.waitForLoadState() | ||
} | ||
|
||
getCurrentURL() : string { | ||
return this.page.url(); | ||
} | ||
|
||
async refreshPage(){ | ||
await this.page.reload(); | ||
} | ||
|
||
} |
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,66 @@ | ||
import { chromium, Browser, BrowserContext, Page } from 'playwright'; | ||
import BasePage from './basePage'; | ||
|
||
export default class BrowserWrapper { | ||
|
||
private browser: Browser | null = null; | ||
|
||
private context: BrowserContext | null = null; | ||
|
||
private page: Page | null = null; | ||
|
||
async createNewPage<T extends BasePage>(pageClass: new (page: Page) => T, url?: string) { | ||
if (!this.browser) { | ||
this.browser = await chromium.launch(); | ||
} | ||
if (!this.context) { | ||
this.context = await this.browser.newContext(); | ||
} | ||
if (!this.page) { | ||
this.page = await this.context.newPage(); | ||
} | ||
if (url) { | ||
await this.navigateTo(url) | ||
} | ||
|
||
const pageInstance = new pageClass(this.page); | ||
return pageInstance; | ||
} | ||
|
||
getContext(): BrowserContext | null { | ||
return this.context; | ||
} | ||
|
||
async getPage() { | ||
if (!this.page) { | ||
throw new Error('Browser is not launched yet!'); | ||
} | ||
return this.page; | ||
} | ||
|
||
async setPageToFullScreen() { | ||
if (!this.page) { | ||
throw new Error('Browser is not launched yet!'); | ||
} | ||
await this.page.setViewportSize({ width: 1920, height: 1080 }); | ||
} | ||
|
||
async navigateTo(url: string) { | ||
if (!this.page) { | ||
throw new Error('Browser is not launched yet!'); | ||
} | ||
await this.page.goto(url); | ||
} | ||
|
||
async closePage() { | ||
this.page ? await this.page.close() : this.page = null; | ||
} | ||
|
||
async closeBrowser() { | ||
if (this.browser) { | ||
await this.browser.close(); | ||
} | ||
} | ||
|
||
} | ||
|
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,21 @@ | ||
import { Locator, Page } from "playwright"; | ||
|
||
export const waitForElementToBeVisible = async (locator:Locator,time=400,retry=5):Promise<boolean> => { | ||
|
||
while(retry >0){ | ||
if(await locator.isVisible()){ | ||
return true | ||
} | ||
retry = retry-1 | ||
await delay(time) | ||
} | ||
return false | ||
} | ||
|
||
export function delay(ms: number) { | ||
return new Promise( resolve => setTimeout(resolve, ms) ); | ||
} | ||
|
||
export const waitForTimeOut = async (page: Page, time=500) => { | ||
await page.waitForTimeout(time); | ||
} |
Oops, something went wrong.