Skip to content

Commit dced107

Browse files
author
imranwijaya
committed
update test, page object, & github workflows
1 parent f43582d commit dced107

File tree

4 files changed

+6
-24
lines changed

4 files changed

+6
-24
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
fail-fast: false
15-
max-parallel: 2
15+
max-parallel: 4
1616
matrix:
1717
node: [16]
1818
os: [ubuntu-latest, windows-latest]

pages/base.page.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ export class BasePage {
1414
return this.driver.wait(untilElementLocated, 30000);
1515
}
1616

17-
// private async openNewTab() {
18-
// return await this.driver.switchTo().newWindow('tab');
19-
// }
20-
2117
async browserName() {
2218
const capabilities = await this.driver.getCapabilities();
2319
return capabilities.getBrowserName();
@@ -31,7 +27,6 @@ export class BasePage {
3127
*/
3228
async visit(url: string) {
3329
if (!url.startsWith('/')) {
34-
await this.driver.manage().window().maximize();
3530
return this.driver.navigate().to(url);
3631
}
3732
const baseUrl = config.baseUrl;

tests/admin/customer/customer-list.test.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ describe('Customer List Functionality', function () {
1111
beforeEach(async function () {
1212
const browser = await new Browser('firefox').build();
1313
page = new Pages(browser);
14-
// await page.login.adminAuthenticate(config.username, config.password);
15-
await page.login.visit('/login');
16-
await page.login.authenticate(config.username, config.password);
14+
await page.login.adminAuthenticate(config.username, config.password);
1715
await page.customer.visit('/customer/');
1816
});
1917

@@ -43,9 +41,7 @@ describe('Customer List Functionality', function () {
4341
beforeEach(async function () {
4442
const browser = await new Browser('firefox').build();
4543
page = new Pages(browser);
46-
// await page.login.adminAuthenticate(config.username, config.password);
47-
await page.login.visit('/login');
48-
await page.login.authenticate(config.username, config.password);
44+
await page.login.adminAuthenticate(config.username, config.password);
4945
await page.customer.visit('/customer/');
5046
});
5147

@@ -74,9 +70,7 @@ describe('Customer List Functionality', function () {
7470
beforeEach(async function () {
7571
const browser = await new Browser('firefox').build();
7672
page = new Pages(browser);
77-
// await page.login.adminAuthenticate(config.username, config.password);
78-
await page.login.visit('/login');
79-
await page.login.authenticate(config.username, config.password);
73+
await page.login.adminAuthenticate(config.username, config.password);
8074
await page.customer.visit('/customer/');
8175
});
8276

@@ -95,9 +89,7 @@ describe('Customer List Functionality', function () {
9589
beforeEach(async function () {
9690
const browser = await new Browser('firefox').build();
9791
page = new Pages(browser);
98-
// await page.login.adminAuthenticate(config.username, config.password);
99-
await page.login.visit('/login');
100-
await page.login.authenticate(config.username, config.password);
92+
await page.login.adminAuthenticate(config.username, config.password);
10193
await page.customer.visit('/customer/');
10294
});
10395

@@ -116,9 +108,7 @@ describe('Customer List Functionality', function () {
116108
beforeEach(async function () {
117109
const browser = await new Browser('firefox').build();
118110
page = new Pages(browser);
119-
// await page.login.adminAuthenticate(config.username, config.password);
120-
await page.login.visit('/login');
121-
await page.login.authenticate(config.username, config.password);
111+
await page.login.adminAuthenticate(config.username, config.password);
122112
await page.customer.visit('/customer/');
123113
});
124114

tests/admin/logout.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { expect } from 'chai';
33
import { Browser } from '../../lib/browser';
44
import { Pages } from '../../pages/admin';
55
import { config } from '../../config/index';
6-
// import { writeFile } from 'fs/promises';
76

87
describe('Logout Functionality', function () {
98
let page: Pages;
@@ -21,8 +20,6 @@ describe('Logout Functionality', function () {
2120
it('redirects to the login page on successful logged out', async function () {
2221
await page.login.authenticate(config.username, config.password);
2322
const url = await page.home.unauthenticate();
24-
// const capture = await page.browser.takeScreenshot();
25-
// writeFile('reports/out.png', capture, 'base64');
2623
expect(url).equal(`${config.baseUrl}/login`);
2724
});
2825
});

0 commit comments

Comments
 (0)