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

tests: remove most usages of afterPass #15057

Merged
merged 2 commits into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion core/test/gather/gatherers/accessibility-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('Accessibility gatherer', () => {

it('propagates error retrieving the results', () => {
const error = 'There was an error.';
return accessibilityGather.afterPass({
return accessibilityGather.getArtifact({
driver: {
executionContext: {
async evaluate() {
Expand Down
2 changes: 1 addition & 1 deletion core/test/gather/gatherers/cache-contents-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('Cache Contents gatherer', () => {
});

it('throws an error when cache getter returns nothing', () => {
return cacheContentGather.afterPass({
return cacheContentGather.getArtifact({
driver: {
evaluateAsync() {
return Promise.resolve();
Expand Down
35 changes: 21 additions & 14 deletions core/test/gather/gatherers/console-messages-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ describe('ConsoleMessages', () => {
const driver = new MockDriver();
const options = {driver};

await consoleGatherer.beforePass(options);
await consoleGatherer.startInstrumentation(options);
driver.defaultSession.fireForTest('Runtime.exceptionThrown', runtimeEx);

const artifact = await consoleGatherer.afterPass(options);
await consoleGatherer.stopInstrumentation(options);
const artifact = await consoleGatherer.getArtifact(options);

assert.equal(artifact.length, 1);
assert.equal(artifact[0].source, 'exception');
Expand Down Expand Up @@ -104,10 +105,11 @@ describe('ConsoleMessages', () => {
const driver = new MockDriver();
const options = {driver};

await consoleGatherer.beforePass(options);
await consoleGatherer.startInstrumentation(options);
driver.defaultSession.fireForTest('Runtime.consoleAPICalled', consoleWarnEvent);

const artifact = await consoleGatherer.afterPass(options);
await consoleGatherer.stopInstrumentation(options);
const artifact = await consoleGatherer.getArtifact(options);

assert.equal(artifact.length, 1);
assert.equal(artifact[0].source, 'console.warn');
Expand Down Expand Up @@ -136,10 +138,11 @@ describe('ConsoleMessages', () => {
const driver = new MockDriver();
const options = {driver};

await consoleGatherer.beforePass(options);
await consoleGatherer.startInstrumentation(options);
driver.defaultSession.fireForTest('Runtime.consoleAPICalled', consoleWarnEvent);

const artifact = await consoleGatherer.afterPass(options);
await consoleGatherer.stopInstrumentation(options);
const artifact = await consoleGatherer.getArtifact(options);

assert.equal(artifact.length, 1);
assert.equal(artifact[0].source, 'console.warn');
Expand Down Expand Up @@ -260,10 +263,11 @@ describe('ConsoleMessages', () => {
const driver = new MockDriver();
const options = {driver};

await consoleGatherer.beforePass(options);
await consoleGatherer.startInstrumentation(options);
driver.defaultSession.fireForTest('Runtime.consoleAPICalled', consoleWarnEvent);

const artifact = await consoleGatherer.afterPass(options);
await consoleGatherer.stopInstrumentation(options);
const artifact = await consoleGatherer.getArtifact(options);

assert.equal(artifact.length, 1);
assert.equal(artifact[0].source, 'console.warn');
Expand Down Expand Up @@ -318,10 +322,11 @@ describe('ConsoleMessages', () => {
const driver = new MockDriver();
const options = {driver};

await consoleGatherer.beforePass(options);
await consoleGatherer.startInstrumentation(options);
driver.defaultSession.fireForTest('Runtime.consoleAPICalled', consoleErrorEvent);

const artifact = await consoleGatherer.afterPass(options);
await consoleGatherer.stopInstrumentation(options);
const artifact = await consoleGatherer.getArtifact(options);

assert.equal(artifact.length, 1);
assert.equal(artifact[0].source, 'console.error');
Expand Down Expand Up @@ -358,10 +363,11 @@ describe('ConsoleMessages', () => {
const driver = new MockDriver();
const options = {driver};

await consoleGatherer.beforePass(options);
await consoleGatherer.startInstrumentation(options);
driver.defaultSession.fireForTest('Runtime.consoleAPICalled', consoleLog);

const artifact = await consoleGatherer.afterPass(options);
await consoleGatherer.stopInstrumentation(options);
const artifact = await consoleGatherer.getArtifact(options);

assert.equal(artifact.length, 0);
});
Expand Down Expand Up @@ -406,11 +412,12 @@ describe('ConsoleMessages', () => {
const driver = new MockDriver();
const options = {driver};

await consoleGatherer.beforePass(options);
await consoleGatherer.startInstrumentation(options);
driver.defaultSession.fireForTest('Log.entryAdded', logEntries[0]);
driver.defaultSession.fireForTest('Log.entryAdded', logEntries[1]);

const artifact = await consoleGatherer.afterPass(options);
await consoleGatherer.stopInstrumentation(options);
const artifact = await consoleGatherer.getArtifact(options);

assert.equal(artifact.length, 2);

Expand Down
Loading