Skip to content

Commit

Permalink
fix: session acceptance test (#4040)
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent authored Nov 30, 2023
1 parent 3d9b894 commit 71485a5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions test/acceptance/codecept.Playwright.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports.config = {
require: '../support/ScreenshotSessionHelper.js',
outputPath: 'test/acceptance/output',
},
Expect: {},
},
include: {},
bootstrap: false,
Expand Down
1 change: 1 addition & 0 deletions test/acceptance/codecept.Puppeteer.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports.config = {
require: '../support/ScreenshotSessionHelper.js',
outputPath: './output',
},
Expect: {},
},
include: {},
bootstrap: false,
Expand Down
1 change: 1 addition & 0 deletions test/acceptance/codecept.Testcafe.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module.exports.config = {
url: TestHelper.siteUrl(),
show: true,
},
Expect: {},
},
include: {},
bootstrap: false,
Expand Down
1 change: 1 addition & 0 deletions test/acceptance/codecept.WebDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports.config = {
require: '../support/ScreenshotSessionHelper.js',
outputPath: './output',
},
Expect: {},
},
include: {},
bootstrap: async () => new Promise(done => {
Expand Down
20 changes: 10 additions & 10 deletions test/acceptance/session_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Feature('Session');
Scenario('simple session @WebDriverIO @Puppeteer @Playwright', ({ I }) => {
I.amOnPage('/info');
session('john', () => {
I.amOnPage('https://github.com');
I.amOnPage('https://codecept.io/');
I.dontSeeInCurrentUrl('/info');
I.see('GitHub');
I.see('CodeceptJS');
});
I.dontSee('GitHub');
I.seeInCurrentUrl('/info');
Expand Down Expand Up @@ -38,11 +38,11 @@ Scenario('screenshots reflect the current page of current session @Puppeteer @Pl
]);

// Assert that screenshots of same page in same session are equal
assert.equal(default1Digest, default2Digest);
assert.equal(john1Digest, john2Digest);
I.expectEqual(default1Digest, default2Digest);
I.expectEqual(john1Digest, john2Digest);

// Assert that screenshots of different pages in different sessions are not equal
assert.notEqual(default1Digest, john1Digest);
I.expectNotEqual(default1Digest, john1Digest);
});

Scenario('Different cookies for different sessions @WebDriverIO @Playwright @Puppeteer', async ({ I }) => {
Expand Down Expand Up @@ -72,9 +72,9 @@ Scenario('Different cookies for different sessions @WebDriverIO @Playwright @Pup
assert(cookies.default);
assert(cookies.john);
assert(cookies.mary);
assert.notEqual(cookies.default, cookies.john);
assert.notEqual(cookies.default, cookies.mary);
assert.notEqual(cookies.john, cookies.mary);
I.expectNotEqual(cookies.default, cookies.john);
I.expectNotEqual(cookies.default, cookies.mary);
I.expectNotEqual(cookies.john, cookies.mary);
});

Scenario('should save screenshot for active session @WebDriverIO @Puppeteer @Playwright', async function ({ I }) {
Expand All @@ -94,7 +94,7 @@ Scenario('should save screenshot for active session @WebDriverIO @Puppeteer @Pla
]);

// Assert that screenshots of same page in same session are equal
assert.equal(original, failed);
I.expectEqual(original, failed);
});

Scenario('should throw exception and close correctly @WebDriverIO @Puppeteer @Playwright', ({ I }) => {
Expand Down Expand Up @@ -160,7 +160,7 @@ Scenario('change page emulation @Playwright', async ({ I }) => {
}, async () => {
I.amOnPage('/');
const width = await I.executeScript('window.innerWidth');
assert.equal(width, 300);
I.expectEqual(width, 300);
});
});

Expand Down

0 comments on commit 71485a5

Please sign in to comment.