Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bar position option, experimental Cypress test browser support #23

Merged
merged 2 commits into from
Apr 21, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix tests
  • Loading branch information
MikeShi42 committed Apr 21, 2022
commit e07bb50cfdf00cd3c3baeac8802e7c269f4031d4
28 changes: 14 additions & 14 deletions tests/builders.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,84 +26,84 @@ describe('Test builders', () => {

const output = builder
.pushComments('// hello-world')
.pushCodes('cy.visit()')
.pushCodes('cy.visit();')
.buildScript();
expect(output).toBe(
`it('Written with DeploySentinel Recorder', () => {\n // hello-world\n cy.visit()\n})`
`it('Written with DeploySentinel Recorder', () => {\n // hello-world\n cy.visit();\n});`
);
});

test('click', () => {
builder.click('selector', true);
expect(mockPushCodes).toHaveBeenNthCalledWith(
1,
"cy.get('selector').click()"
"cy.get('selector').click();"
);
});

test('hover', () => {
builder.hover('selector', true);
expect(mockPushCodes).toHaveBeenNthCalledWith(
1,
"cy.get('selector').trigger('mouseover')"
"cy.get('selector').trigger('mouseover');"
);
});

test('load', () => {
builder.load('url');
expect(mockPushCodes).toHaveBeenNthCalledWith(1, "cy.visit('url')");
expect(mockPushCodes).toHaveBeenNthCalledWith(1, "cy.visit('url');");
});

test('resize', () => {
builder.resize(1, 2);
expect(mockPushCodes).toHaveBeenNthCalledWith(1, 'cy.viewport(1, 2)');
expect(mockPushCodes).toHaveBeenNthCalledWith(1, 'cy.viewport(1, 2);');
});

test('fill', () => {
builder.fill('selector', 'value', true);
expect(mockPushCodes).toHaveBeenNthCalledWith(
1,
'cy.get(\'selector\').type("value")'
'cy.get(\'selector\').type("value");'
);
});

test('type', () => {
builder.type('selector', 'value', true);
expect(mockPushCodes).toHaveBeenNthCalledWith(
1,
'cy.get(\'selector\').type("value")'
'cy.get(\'selector\').type("value");'
);
});

test('select', () => {
builder.select('selector', 'option', true);
expect(mockPushCodes).toHaveBeenNthCalledWith(
1,
"cy.get('selector').select('option')"
"cy.get('selector').select('option');"
);
});

test('keydown', () => {
builder.keydown('selector', 'Enter', true);
expect(mockPushCodes).toHaveBeenNthCalledWith(
1,
"cy.get('selector').type('{Enter}')"
"cy.get('selector').type('{Enter}');"
);
});

test('wheel', () => {
builder.wheel(5, 6, 1, 2);
expect(mockPushCodes).toHaveBeenNthCalledWith(1, 'cy.scrollTo(1, 2)');
expect(mockPushCodes).toHaveBeenNthCalledWith(1, 'cy.scrollTo(1, 2);');
});

test('fullScreenshot', () => {
builder.fullScreenshot();
expect(mockPushCodes).toHaveBeenNthCalledWith(1, 'cy.screenshot()');
expect(mockPushCodes).toHaveBeenNthCalledWith(1, 'cy.screenshot();');
});

test('awaitText', () => {
builder.awaitText('text');
expect(mockPushCodes).toHaveBeenNthCalledWith(1, "cy.contains('text')");
expect(mockPushCodes).toHaveBeenNthCalledWith(1, "cy.contains('text');");
});
});

Expand Down Expand Up @@ -256,7 +256,7 @@ describe('Test builders', () => {
test('awaitText', () => {
builder.awaitText('foo');
expect(builder.getLatestCode()).toBe(
"\n await page.waitForSelector('text=foo')\n"
"\n await page.waitForSelector('text=foo');\n"
);
});
});
Expand Down