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

Fix/integration test workflow terminate #302

Merged
merged 29 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0db348b
added ROUTE_PARAMS_DOMAIN getter
just-at-uber Apr 29, 2021
67ebab8
moved update query into helper and added support for omitting empty q…
just-at-uber Apr 29, 2021
20dc8b2
Merge branch 'master' into feature/route-container-update
just-at-uber Apr 30, 2021
d2e5d4c
fix lint
just-at-uber Apr 30, 2021
e0733c2
increase test timeout to avoid failure
just-at-uber Apr 30, 2021
b5a1428
increasing delay before checking element exists
just-at-uber Apr 30, 2021
428287b
check that button is enabled before clicking it
just-at-uber Apr 30, 2021
f0bec9c
adding enabled check to similiar tests
just-at-uber Apr 30, 2021
bb43922
fix lint
just-at-uber Apr 30, 2021
2e0c236
moving delay before the button appears
just-at-uber Apr 30, 2021
04d222a
reducing delay. removing timeout
just-at-uber Apr 30, 2021
7354cb0
removing delay
just-at-uber Apr 30, 2021
620eef6
copying code from passing test
just-at-uber Apr 30, 2021
8fac775
adding assertion for element to not be disabled.
just-at-uber Apr 30, 2021
ddcf670
fix lint
just-at-uber Apr 30, 2021
a1a20d5
trying to allow test runner to retry multiple times before failing
just-at-uber Apr 30, 2021
7558555
adjusting selector
just-at-uber Apr 30, 2021
08cdcbf
trying to add check on element in a retry
just-at-uber Apr 30, 2021
c3d8b85
making similar tests more resiliant
just-at-uber Apr 30, 2021
e5a6749
forcing diff change
just-at-uber May 3, 2021
bce06b0
adding options to summaryTest and withFullHistory and withHistory hel…
just-at-uber May 3, 2021
8b4c2b9
Merge branch 'feature/route-container-update' into fix/integration-te…
just-at-uber May 3, 2021
cb4ce1e
fix lint
just-at-uber May 3, 2021
91bcc21
make options specific to history
just-at-uber May 3, 2021
16db2bd
fixed issue with handler option set to false explicitly.
just-at-uber May 3, 2021
2114eb3
adding API delay for termination tests
just-at-uber May 3, 2021
5c7d2df
fix lint
just-at-uber May 3, 2021
7d6ff3f
reverting README change
just-at-uber May 3, 2021
2ed9901
reverting files unrelated to integration test changes
just-at-uber May 3, 2021
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
16 changes: 10 additions & 6 deletions client/test/scenario.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,11 @@ Scenario.prototype.withWorkflow = function withWorkflow(
return this;
};

Scenario.prototype.withHistory = function withHistory(events, hasMorePages) {
Scenario.prototype.withHistory = function withHistory(
events,
hasMorePages,
options = {}
) {
if (!this.historyNpt) {
this.historyNpt = {};
}
Expand All @@ -338,20 +342,20 @@ Scenario.prototype.withHistory = function withHistory(events, hasMorePages) {
response.nextPageToken = makeToken();
}

this.api.getOnce(url, response, { delay: 100 });
this.api.getOnce(url, response, { delay: 100, ...options });

return this;
};

Scenario.prototype.withFullHistory = function withFullHistory(events) {
Scenario.prototype.withFullHistory = function withFullHistory(events, options) {
const parsedEvents = JSON.parse(
JSON.stringify(events || fixtures.history.emailRun1)
);
const third = Math.floor(parsedEvents.length / 3);

return this.withHistory(parsedEvents.slice(0, third), true)
.withHistory(parsedEvents.slice(third, third + third), true)
.withHistory(parsedEvents.slice(third + third));
return this.withHistory(parsedEvents.slice(0, third), true, options)
.withHistory(parsedEvents.slice(third, third + third), true, options)
.withHistory(parsedEvents.slice(third + third), false, options);
};

Scenario.prototype.withQuery = function withQuery(query) {
Expand Down
56 changes: 39 additions & 17 deletions client/test/workflow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ describe('Workflow', () => {
];
}

async function summaryTest(mochaTest, o) {
async function summaryTest(mochaTest, options = {}) {
const [scenario, opts] = workflowTest(mochaTest, {
view: 'summary',
...o,
...options,
});

scenario.withFullHistory(opts.events);
scenario.withFullHistory(opts.events, options.history);
const summaryEl = await scenario
.render(opts.attach)
.waitUntilExists('section.execution section.workflow-summary dl');
Expand Down Expand Up @@ -337,14 +337,17 @@ describe('Workflow', () => {

describe('Actions', () => {
it('should offer the user to terminate a running workflow, prompting the user for a termination reason', async function test() {
const [summaryEl] = await summaryTest(this.test);
const [summaryEl] = await summaryTest(this.test, {
history: { delay: 250 },
});

const terminateEl = await summaryEl.waitUntilExists(
'aside.actions button'
);

terminateEl.trigger('click');
await retry(() => terminateEl.should.not.have.attr('disabled'));

await Promise.delay(1000);
terminateEl.trigger('click');

const confirmTerminateEl = await summaryEl.waitUntilExists(
'[data-modal="confirm-termination"]'
Expand All @@ -360,12 +363,18 @@ describe('Workflow', () => {
});

it('should terminate the workflow with the provided reason', async function test() {
const [summaryEl, scenario] = await summaryTest(this.test);
const [summaryEl, scenario] = await summaryTest(this.test, {
history: { delay: 250 },
});

(await summaryEl.waitUntilExists('aside.actions button')).trigger(
'click'
const terminateEl = await summaryEl.waitUntilExists(
'aside.actions button'
);

await retry(() => terminateEl.should.not.have.attr('disabled'));

terminateEl.trigger('click');

const confirmTerminateEl = await summaryEl.waitUntilExists(
'[data-modal="confirm-termination"]'
);
Expand All @@ -385,31 +394,43 @@ describe('Workflow', () => {
});

it('should terminate the workflow without a reason', async function test() {
const [summaryEl, scenario] = await summaryTest(this.test);
const [summaryEl, scenario] = await summaryTest(this.test, {
history: { delay: 250 },
});

(await summaryEl.waitUntilExists('aside.actions button')).trigger(
'click'
const terminateEl = await summaryEl.waitUntilExists(
'aside.actions button'
);

const terminateEl = await summaryEl.waitUntilExists(
await retry(() => terminateEl.should.not.have.attr('disabled'));

terminateEl.trigger('click');

const terminateConfirmEl = await summaryEl.waitUntilExists(
'[data-modal="confirm-termination"] button[name="button-terminate"]'
);

scenario.withWorkflowTermination();
terminateEl.trigger('click');
terminateConfirmEl.trigger('click');

await retry(() =>
summaryEl.should.not.contain('[data-modal="confirm-termination"]')
);
});

it('should allow the user to cancel the termination prompt, doing nothing', async function test() {
const [summaryEl] = await summaryTest(this.test);
const [summaryEl] = await summaryTest(this.test, {
history: { delay: 250 },
});

(await summaryEl.waitUntilExists('aside.actions button')).trigger(
'click'
const terminateEl = await summaryEl.waitUntilExists(
'aside.actions button'
);

await retry(() => terminateEl.should.not.have.attr('disabled'));

terminateEl.trigger('click');

const cancelDialog = await summaryEl.waitUntilExists(
'[data-modal="confirm-termination"] button[name="button-cancel"]'
);
Expand All @@ -424,6 +445,7 @@ describe('Workflow', () => {
it('should not offer the user the ability to terminate completed workflows', async function test() {
const [summaryEl] = await summaryTest(this.test, {
execution: closedWorkflowExecution,
history: { delay: 250 },
});

await retry(() =>
Expand Down