Skip to content

Commit 32f4954

Browse files
Update tags
1 parent 32085d1 commit 32f4954

17 files changed

+44
-39
lines changed

playwright.config.ts

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,7 @@ export default defineConfig({
5757
/* Run tests in files in parallel */
5858
fullyParallel: true,
5959
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
60-
use: {
61-
actionTimeout: 0,
62-
/* Base URL to use in actions like `await page.goto('/')`. */
63-
// baseURL: testConfig[process.env.ENV],
64-
testIdAttribute: 'data-testid',
65-
headless: false,
66-
viewport: { width: 1500, height: 800 },
67-
ignoreHTTPSErrors: true,
68-
screenshot: 'only-on-failure',
69-
video: `on`,
70-
trace: `on`,
71-
},
60+
7261
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
7362
// reporter: 'html',
7463
reporter: [
@@ -107,18 +96,33 @@ export default defineConfig({
10796
],
10897
],
10998
/* Folder for test artifacts such as screenshots, videos, traces, etc. */
110-
outputDir: 'reports/test-artifacts/',
99+
outputDir: envConfig.testArtifacts,
100+
use: {
101+
actionTimeout: 0,
102+
/* Base URL to use in actions like `await page.goto('/')`. */
103+
// baseURL: testConfig[process.env.ENV],
104+
testIdAttribute: 'data-testid',
105+
headless: false,
106+
viewport: { width: 1400, height: 800 },
107+
ignoreHTTPSErrors: true,
108+
screenshot: 'only-on-failure',
109+
video: 'retain-on-failure',
110+
trace: `on`,
111+
},
111112
/* Configure projects for major browsers */
112113
projects: [
113114
// {
114115
// name: "Setup",
115116
// testMatch: "global-setup.ts",
116117
// },
117118
{
118-
name: `Chrome`,
119+
name: `Chrome - UI`,
120+
grep: /@examples/,
119121
use: {
120122
browserName: `chromium`,
121123
// storageState: testConfig.ownerAuth,
124+
// baseURL: ENV,
125+
// headless: false,
122126
channel: `chrome`,
123127
//Slows down execution by ms
124128
launchOptions: {
@@ -130,12 +134,12 @@ export default defineConfig({
130134
// {
131135
// name: `Device`,
132136
// use: {
133-
// // ...devices[`Pixel 4a (5G)`],
137+
// ...devices[`Pixel 4a (5G)`],
134138
// ...devices[`iPhone 11 Pro Max`],
135139
// browserName: `chromium`,
136140
// storageState: testConfig.ownerAuth,
137141
// channel: `chrome`,
138-
// //Slows down execution by ms
142+
//Slows down execution by ms
139143
// launchOptions: {
140144
// slowMo: 0
141145
// }
@@ -145,12 +149,12 @@ export default defineConfig({
145149
// {
146150
// name: `Chrome`,
147151
// use: {
148-
// // Configure the browser to use.
152+
// Configure the browser to use.
149153
// browserName: `chromium`,
150154
// storageState: testConfig.adminAuth,
151-
// //Chrome Browser Config
155+
//Chrome Browser Config
152156
// channel: `chrome`,
153-
// //Slows down execution by ms
157+
//Slows down execution by ms
154158
// launchOptions: {
155159
// slowMo: 0
156160
// }

src/config/global-setup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { RegisterPage } from '@pages/nopCommerce/registerPage';
55
import { LoginPage } from '@pages/nopCommerce/loginPage';
66
import { FakerData } from '@lib/FakerData';
77
import { rimraf } from 'rimraf';
8-
import { testConfig } from './envConfig';
8+
import envConfig from '../constants/envConfig';
99

1010
async function globalSetup(): Promise<void> {
1111
await new Promise((resolve) => {
@@ -34,7 +34,7 @@ setup('Register by Owner', async ({ page, context }) => {
3434
await registerPage.validateSuccessMessage('Your registration completed');
3535
await nopHomePage.openLoginPage();
3636
await loginPage.doLogin(email, password);
37-
await page.context().storageState({ path: testConfig.ownerAuth });
37+
await page.context().storageState({ path: envConfig.ownerAuth });
3838
});
3939
// setup('Register by Admin', async ({ page, context }) => {
4040
// allure.owner('Ismail elshafeiy');
@@ -56,6 +56,6 @@ setup('Register by Owner', async ({ page, context }) => {
5656
// await registerPage.validateSuccessMessage('Your registration completed');
5757
// await nopHomePage.openLoginPage();
5858
// await loginPage.doLogin(email, password);
59-
// await page.context().storageState({ path: testConfig.adminAuth });
59+
// await page.context().storageState({ path: envConfig.adminAuth });
6060
// })
6161
export default globalSetup;

src/config/global-tearDown.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import path from 'path';
22
import AdmZip from 'adm-zip';
3+
import envConfig from 'src/constants/envConfig';
34

45
async function globalTeardown() {
5-
const reportPath = path.join(__dirname, `./reports/playwright-report`);
6+
const reportPath = path.join(__dirname, envConfig.reportFolder);
67
const zip = new AdmZip();
7-
zip.addLocalFolder(reportPath, "./reports/playwright-report");
8+
zip.addLocalFolder(reportPath, envConfig.reportFolder);
89
zip.writeZip(`./playwright-report.zip`);
910
}
1011

tests/examples/element-actions/checkBox.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { test, expect } from '@playwright/test';
22
//https://playwright.dev/docs/input#checkboxes-and-radio-buttons
3-
test.describe('Example to demonstrate execution checkbox methods in Playwright', () => {
3+
test.describe('Example to demonstrate execution checkbox methods in Playwright', { tag: '@examples' }, () => {
44
test('Working with Checkboxes 1', async ({ page }) => {
55
await page.goto('https://the-internet.herokuapp.com/checkboxes');
66
//Assert that the checkboxes are visible on the webpage

tests/examples/element-actions/datepicker.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { test, expect } from '@playwright/test';
22

3-
test.describe('Example to demonstrate execution of datepicker in Playwright', () => {
3+
test.describe('Example to demonstrate execution of datepicker in Playwright',{ tag: '@examples' }, () => {
44
test('Date picker 1', async ({ page }) => {
55
const day = 10;
66
await page.goto('https://demo.automationtesting.in/Datepicker.html');

tests/examples/element-actions/downloadAndUploadFiles.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const downloadFiles = envConfig.downloadFiles;
88
const fs = require('fs');
99
const uploadFilePath = 'tests/data/upload/';
1010

11-
test.describe('Example to demonstrate execution Upload and Download single file methods in Playwright', () => {
11+
test.describe('Example to demonstrate execution Upload and Download single file methods in Playwright',{ tag: '@examples' }, () => {
1212
const fileName = 'Screenshot.png';
1313
test('Upload a Single file and assert', async ({ page }) => {
1414
await page.goto('https://the-internet.herokuapp.com/upload');
@@ -54,7 +54,7 @@ test.describe('Example to demonstrate execution Upload and Download multiple fil
5454
});
5555
});
5656

57-
test.describe('Example to demonstrate execution Upload and remove multipe file methods in Playwright', () => {
57+
test.describe('Example to demonstrate execution Upload and remove multipe file methods in Playwright',{ tag: '@examples' }, () => {
5858
const fileName1 = 'example.json';
5959
const fileName2 = 'Screenshot.png';
6060
const fileName3 = 'github.png';

tests/examples/element-actions/dropdown.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { test, expect } from '@playwright/test';
22
// https://playwright.dev/docs/input#select-options
3-
test.describe('Example to demonstrate execution dropdown methods in Playwright', () => {
3+
test.describe('Example to demonstrate execution dropdown methods in Playwright',{ tag: '@examples' }, () => {
44
test('Working with dropdown', async ({ page }) => {
55
await page.goto('https://the-internet.herokuapp.com/dropdown');
66
const dropdown = await page.$('#dropdown');

tests/examples/element-actions/elementState.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { test, expect } from "@playwright/test";
22
// https://playwright.dev/docs/actionability
33
// https://playwright.dev/docs/api/class-elementhandle#element-handle-wait-for-element-state
4-
test.describe("Example to demonstrate execution element state methods in Playwright", () => {
4+
test.describe("Example to demonstrate execution element state methods in Playwright",{ tag: '@examples' }, () => {
55
test("Working with element state", async ({ page }) => {
66
await page.goto("https://demoqa.com/automation-practice-form");
77
// element handles

tests/examples/element-actions/htmlDocumentMethod.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { test, expect } from '@playwright/test';
22
// https://playwright.dev/docs/evaluating
3-
test.describe('Example to demonstrate execution of HTML Document methods in Playwright', () => {
3+
test.describe('Example to demonstrate execution of HTML Document methods in Playwright',{ tag: '@examples' }, () => {
44
test('Extract innerText and assert', async ({ page }) => {
55
await page.goto('https://the-internet.herokuapp.com/');
66
var locator = await page.evaluate(() => document.querySelector('h1').innerText);

tests/examples/element-actions/ifram.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { test, expect } from "@playwright/test";
22
//https://playwright.dev/docs/frames
33

4-
test.describe("Example to demonstrate testing of simple and nested iframes in Playwright", () => {
4+
test.describe("Example to demonstrate testing of simple and nested iframes in Playwright",{ tag: '@examples' }, () => {
55
test("Simple iframe - Input text in the text editor which is inside an iframe", async ({ page }) => {
66
await page.goto("http://the-internet.herokuapp.com/iframe");
77
const frame = await page.frameLocator("#mce_0_ifr");

0 commit comments

Comments
 (0)