Skip to content

Commit

Permalink
Week 7 -8
Browse files Browse the repository at this point in the history
  • Loading branch information
MendDemo committed Feb 25, 2024
1 parent 63cb4cb commit b59d3c6
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 5 deletions.
15 changes: 10 additions & 5 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default defineConfig({
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
retries: process.env.CI ? 2 : 1,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
Expand All @@ -36,11 +36,16 @@ export default defineConfig({

/* Configure projects for major browsers */
projects: [


{
name: 'chromium',

use: { ...devices['Desktop Chrome'] },
},
name: 'Microsoft Edge',
use: { ...devices['Desktop Edge'], channel: 'msedge' },
},
{
name: 'Google Chrome',
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
},

// {
// name: 'firefox',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions tests/w7d2_PWFeatues/ConsoleLogs.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { test } from "@playwright/test";


test.only("Test case to check device emulation with config file change", async ({page}) => {

page.on('console',message=>{

console.log(`Received message >>> ${message.type()} and ${message.text()} `)

})

await page.goto("https://testleaf.com");

})
9 changes: 9 additions & 0 deletions tests/w7d2_PWFeatues/DeviceEmulation.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { test } from "@playwright/test";


test.only("Test case to check device emulation with config file change", async ({page}) => {


await page.goto("https://leafground.com/alert.xhtml");

})
13 changes: 13 additions & 0 deletions tests/w7d2_PWFeatues/DeviceemulationAtTestcaseLevel.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { chromium, devices, firefox, test } from "@playwright/test";


test.only("Test case to check device emulation with config file change", async () => {

const mydevice=devices['Galaxy Note 3']
const browser= await firefox.launch();
const context=await browser.newContext({...mydevice,viewport:{width:596,height:123}});
const page=await context.newPage();
await page.goto("https://www.google.com")


})
10 changes: 10 additions & 0 deletions tests/w7d2_PWFeatues/RetryfailedCases.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {test} from "@playwright/test";


test('Printing all console messages', async({page})=> {
page.on('console', message=> {
console.log(`Messages >> ${message.type()} and ${message.text()}`)
})
await page.goto("https://www.redbus.in/");
await page.waitForTimeout(10000);
})
33 changes: 33 additions & 0 deletions tests/w8d1/persistentAndBasicAuth.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { chromium, test } from "@playwright/test";


test(`Persistent Context`, async () => {


const userDataDir = "./myUserDataDir";


//Launch a persistent context
const context = await chromium.launchPersistentContext(userDataDir, {
headless:false,
httpCredentials:{
username: "admin",
password: "testleaf",
origin: "http://leafground.com:8090"
}
});


const page = await context.newPage();
await page.goto("https://leafground.com/auth.xhtml");


await page.getByRole('button', {name:'Basic Auth'}).click();


await page.waitForTimeout(5000);




})

0 comments on commit b59d3c6

Please sign in to comment.