Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

Migrate Tenant test from TP E2E to TP integration test#6244

Merged
ocket8888 merged 9 commits intoapache:masterfrom
dpham692:MigrateTenantTest
Oct 8, 2021
Merged

Migrate Tenant test from TP E2E to TP integration test#6244
ocket8888 merged 9 commits intoapache:masterfrom
dpham692:MigrateTenantTest

Conversation

@dpham692
Copy link
Copy Markdown
Contributor


Which Traffic Control components are affected by this PR?

  • Traffic Portal
  • CDN in a Box
  • Automation GitHub Actions

What is the best way to verify this PR?

Make sure all tests are migrate in integration/Data/tenant.ts directory.
https://github.com/apache/trafficcontrol/blob/master/traffic_portal/test/e2e_deprecated/tenants/tenants-spec.js
Go to traffic_portal/test/integration and run
npm test -- --params.baseUrl https://localhost --capabilities.shardTestFiles true and make sure test all pass.
Make sure CI tests pass also.

If this is a bugfix, which Traffic Control versions contained the bug?

PR submission checklist

@ocket8888 ocket8888 self-assigned this Oct 7, 2021
@ocket8888 ocket8888 added improvement The functionality exists but it could be improved in some way. tests related to tests and/or testing infrastructure Traffic Portal v1 related to Traffic Portal version 1 labels Oct 7, 2021

private btnCreateNewTenant = element(by.xpath("//button[@title='Create New Tenant']"));
private txtName = element(by.name('name'));
private txtActive = element(by.name('active'));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indentation should be consistent within a file; there are still places using 4-space indentation. If you're gonna change the indentation in so many places, you should change it everywhere in the file consistently (and you should use tabs because tabs >>>>> spaces)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed identation.

await this.txtParentTenant.sendKeys(tenant.ParentTenant + this.randomize);
}
await basePage.ClickCreate();
return await basePage.GetOutputMessage().then(value => tenant.validationMessage === value);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await is unnecessary in a return statement; a Promise that resolves to a Promise is not resolved until that nested Promise is resolved:

/** @param p {Promise<unknown>} */
async function printAwait(p) {
	console.log(await p);
}

/**
 * @template T
 * @param p {Promise<T>}
 * @returns {Promise<Promise<T>>}
 */
async function nestPromise(p) {
	return p;
}

/**
 * @template T
 * @param p {Promise<T>}
 * @returns {Promise<T>}
 */
 async function awaitPromise(p) {
	 return await p;
 }

const p1 = new Promise(r=>r(5));
const p2 = new Promise(r=>r(p1));

// These are all equivalent
printAwait(p1); // outputs: 5
printAwait(p2); // outputs: 5
printAwait(nestPromise(p1)); // outputs: 5
printAwait(awaitPromise(p1)); // outputs: 5
printAwait(nestPromise(p2)); // outputs: 5
printAwait(awaitPromise(p2)); // outputs: 5

const p1 = new Promise(r=>r(5));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed return.

@dpham692
Copy link
Copy Markdown
Contributor Author

dpham692 commented Oct 8, 2021

@ocket8888 Fixed. await. and identation.

@ocket8888 ocket8888 merged commit 6ccb373 into apache:master Oct 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

improvement The functionality exists but it could be improved in some way. tests related to tests and/or testing infrastructure Traffic Portal v1 related to Traffic Portal version 1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants