Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amandeepsingh333 committed Jan 17, 2025
1 parent 17e8ce9 commit 2355463
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
13 changes: 4 additions & 9 deletions packages/cli-exec/test/start.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,10 @@ describe('percy exec:start', () => {
expect(response).toHaveProperty('success', true);
});

describe('start', () => {
beforeAll(() => {
start(['--quiet', '--port=4567']);
});

it('can start on an alternate port', async () => {
let response = await request('http://localhost:4567/percy/healthcheck');
expect(response).toHaveProperty('success', true);
});
it('can start on an alternate port', async () => {
start(['--quiet', '--port=4567']);
let response = await request('http://localhost:4567/percy/healthcheck');
expect(response).toHaveProperty('success', true);
});

it('stops the process when terminated', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export function chromium({
});
}

// default chromium revisions corresponds to v123.0.6312.58
// default chromium revisions corresponds to v126.0.6478.184
chromium.revisions = {
linux: '1300309',
win64: '1300297',
Expand Down
7 changes: 3 additions & 4 deletions packages/core/test/discovery.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ describe('Discovery', () => {
await percy.idle();

expect(server.requests.map(r => r[0]))
.toEqual(['/', '/script.js', '/test.json', '/favicon.ico']);
.toEqual(['/', '/script.js', '/test.json']);

expect(captured[0]).not.toEqual(jasmine.arrayContaining([
jasmine.objectContaining({
Expand Down Expand Up @@ -1545,7 +1545,6 @@ describe('Discovery', () => {
let authDOM = testDOM.replace('img.gif', 'auth/img.gif');

beforeEach(() => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 40000;
server.reply('/auth/img.gif', ({ headers: { authorization } }) => {
if (authorization === 'Basic dGVzdDo=') {
return [200, 'image/gif', pixel];
Expand Down Expand Up @@ -1793,7 +1792,7 @@ describe('Discovery', () => {

// only one request for each resource should be made
let paths = server.requests.map(r => r[0]);
expect(paths.sort()).toEqual(['/favicon.ico', '/img.gif', '/style.css']);
expect(paths.sort()).toEqual(['/img.gif', '/style.css']);

// both snapshots' captured resources should match
// the first captured resource is the log file which is dynamic
Expand All @@ -1811,7 +1810,7 @@ describe('Discovery', () => {

// two requests for each resource should be made (opposite of prev test)
let paths = server.requests.map(r => r[0]);
expect(paths.sort()).toEqual(['/favicon.ico', '/img.gif', '/img.gif', '/style.css', '/style.css']);
expect(paths.sort()).toEqual(['/img.gif', '/img.gif', '/style.css', '/style.css']);

// bot snapshots' captured resources should match
// the first captured resource is the log file which is dynamic
Expand Down
10 changes: 5 additions & 5 deletions packages/core/test/snapshot.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1233,7 +1233,7 @@ describe('Snapshot', () => {
await percy.idle();

let dom = i => Buffer.from((
api.requests['/builds/123/resources'][i * 3]
api.requests['/builds/123/resources'][i * 2]
.body.data.attributes['base64-content']
), 'base64').toString();

Expand Down Expand Up @@ -1419,7 +1419,7 @@ describe('Snapshot', () => {
].join(''));

expect(Buffer.from((
api.requests['/builds/123/resources'][3]
api.requests['/builds/123/resources'][2]
.body.data.attributes['base64-content']
), 'base64').toString()).toMatch([
'<p>beforeResize - 400</p>',
Expand Down Expand Up @@ -1527,9 +1527,9 @@ describe('Snapshot', () => {
).toString()).filter(s => s.startsWith('<'));

expect(html[0]).toMatch('wait for timeout');
expect(html[2]).toMatch('wait for selector');
expect(html[4]).toMatch('wait for xpath');
expect(html[6]).toMatch('wait for callback');
expect(html[1]).toMatch('wait for selector');
expect(html[2]).toMatch('wait for xpath');
expect(html[3]).toMatch('wait for callback');
});

it('can execute scripts that scroll to the bottom of the page', async () => {
Expand Down

0 comments on commit 2355463

Please sign in to comment.