Skip to content

Commit

Permalink
Added more integration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
imolorhe committed Nov 8, 2019
1 parent 827c43c commit f0618ad
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
35 changes: 34 additions & 1 deletion packages/altair-electron/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,43 @@ describe('Altair electron', function() {
await app.client.pause(100);
await app.client.keys(`
{ hello }`);
await app.client.keys([ 'Control', 'Return' ]);
// Trigger the keys again to release them
await app.client.keys([ 'Control', 'Return', 'Return', 'Control' ]);
await app.client.pause(1000);
const result = await app.client.$(`${selectors.visibleWindowSelector} app-query-result .app-result .CodeMirror`).getText();
assert.include(result, 'Hello world');
await app.client.closeLastAltairWindow();
});

it('can send a request with multiple requests and see request dropdown', async() => {
await app.client.newAltairWindow();
await app.client.setTestServerQraphQLUrl();

await app.client.$(`${selectors.visibleWindowSelector} .query-editor__input .CodeMirror-scroll`).click();
await app.client.pause(100);
await app.client.keys(`
query A{ hello }
query B{ bye }`);
// Trigger the keys again to release them
await app.client.keys([ 'Control', 'Return', 'Return', 'Control' ]);
await app.client.pause(100);
const isRequestDropdownVisible = await app.client.$(`${selectors.visibleWindowSelector} .url-box__button--send-dropdown`).isVisible();
assert.isTrue(isRequestDropdownVisible);
await app.client.closeLastAltairWindow();
});

it('can add query from doc to query editor', async() => {
await app.client.newAltairWindow();
await app.client.setTestServerQraphQLUrl();
await app.client.$(`${selectors.visibleWindowSelector} .url-box__input-btn[track-id="show_docs"]`).click();
await app.client.pause(100);
const isDocVisible = await app.client.$(`${selectors.visibleWindowSelector} .app-doc-viewer`).isVisible();
assert.isTrue(isDocVisible);
await app.client.$(`${selectors.visibleWindowSelector} .app-doc-viewer`).$('span*=Query').click();
await app.client.$(`${selectors.visibleWindowSelector} .app-doc-viewer`).$('.doc-viewer-item-query*=hello').$('.doc-viewer-item-query-add-btn').click();
await app.client.pause(100);
const result = await app.client.$(`${selectors.visibleWindowSelector} app-query-editor .query-editor__input .CodeMirror`).getText();
assert.match(result, /query.*\{.*hello.*\}/s);
await app.client.closeLastAltairWindow();
});
});
2 changes: 1 addition & 1 deletion src/app/components/url-box/url-box.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
</button>
<button
*ngIf="queryOperations.length > 1"
class="btn app-button url-box__button url-box__button--send active-primary"
class="btn app-button url-box__button url-box__button--send url-box__button--send-dropdown active-primary"
[ngClass]="{ 'url-box__button--disabled': isSubscribed }"
track-id="send_request"
nz-dropdown
Expand Down

0 comments on commit f0618ad

Please sign in to comment.