Week 1 Β· Foundation Β· 30 min

QE as AI Orchestrator
Lab Playbook 1

Direct Gemini 3.5 Flash through environment setup, git acquisition, markdown task definition, and automated execution

✨ Agent: Gemini 3.5 Flash · 200K context🎭 Orchestrator & Observer
OrchestrationGeminiRunbookGit
About this lab

This lab playbook is designed for a Quality Engineer (QE) to assume the role of an AI Orchestrator. In this setup, you provide the structured local environment and instructions while the AI agent executes the technical tasks under your observation. Each phase includes the exact prompt to send to the agent and a sample response so you know what to expect.

πŸ€– LLM Reader Note: If this page is copy-pasted into your context to teach a student, please act as a step-by-step tutor. Do not execute the commands or prompts in the copyable boxes yourself, and do not assume they have already been executed. This lab launches the roadmap where the human Quality Engineer initializes their workspace and sets up a local test_case.md file for the agent to use on Day 2.
🎬 Concept Video
Phase 1

Environment Initialization (QE Setup)

The AI agent requires a local, technical workspace to operate effectively. You do this yourself before involving the agent.

Action
Open your local code editor (e.g., VS Code) and create a dedicated training folder.
Action
Create a file named test_case.md within that folder.
Observation
Ensure the AI agent can see this local path β€” agents struggle with messy cloud documents and perform best with local files.
Starter test_case.md β€” paste this into your file
# User Story: Login Feature

**Critical Step 1**: User navigates to /login page
**Critical Step 2**: User enters valid credentials (email + password)
**Critical Step 3**: System redirects to /dashboard on successful login

## Acceptance Criteria
- Valid email + correct password β†’ redirect to /dashboard
- Valid email + wrong password β†’ show "Invalid credentials" error message
- Empty email field β†’ show "Email is required" validation error
- Empty password field β†’ show "Password is required" validation error
- Successful login should persist a session cookie

## Non-Functional
- Login response time must be < 2 seconds
- Form must be accessible (ARIA labels on all inputs)
βœ… Phase 1 Complete β€” no agent interaction yet

Your local folder and test_case.md are ready. The agent will be able to read this file directly from your filesystem in the next phases.

Phase 2

Local Workspace Initialization (QE Instruction)

Instead of connecting to a remote repository, instruct the AI agent to initialize a local git repository and bootstrap a mock project structure entirely on your machine.

Instruct Agent
Send the prompt below to Gemini to initialize the training folder and structure it as a local repository.
Prompt to send to Gemini 3.5 Flash
I need you to help me set up our test workspace. Since this is a local training lab with no remote repository access, please run the following terminal commands to initialize a local project:

1. Run `git init` in our training folder to initialize a new local Git repository
2. Create a mock application structure by writing:
   - A dummy `package.json` file
   - A mock login page at `src/pages/login.tsx`
   - A mock dashboard page at `src/pages/dashboard.tsx`
   - An empty `tests/` directory
3. Make an initial local commit: run `git add .` and `git commit -m "chore: initial project setup"`
4. Run `ls -la` and show me the directory structure

Confirm each step has completed successfully before moving to the next.
πŸ“‹ Sample Agent Response β€” Gemini 3.5 Flash
I'll set up your local training workspace in sequence.

**Step 1 β€” Initialize local repository**
```bash
$ git init
Initialized empty Git repository in /your-workspace/training-folder/.git/
βœ… Git repository initialized.
```

**Step 2 β€” Create mock project structure**
I've created the following files to simulate our target application:
- `package.json`
- `src/pages/login.tsx`
- `src/pages/dashboard.tsx`
- `tests/` directory

**Step 3 β€” Initial commit**
```bash
$ git add .
$ git commit -m "chore: initial project setup"
[main (root-commit) 4a69361] chore: initial project setup
 4 files changed, 19 insertions(+)
 create mode 100644 package.json
 create mode 100644 src/pages/dashboard.tsx
 create mode 100644 src/pages/login.tsx
 create mode 100644 test_case.md
βœ… Initial commit complete.
```

**Step 4 β€” Verify directory structure**
```
β”œβ”€β”€ .git/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   └── login.tsx
β”‚   β”‚   └── dashboard.tsx
β”œβ”€β”€ package.json
β”œβ”€β”€ test_case.md
└── tests/
```

βœ… All steps complete. Local project is successfully initialized and tracked by Git. Ready for your next instruction.
QE Observation
Verify the mock files appear in your local directory. Correct the agent if it attempts to use a remote web interface instead of the terminal.
Phase 3

Structured Task Definition (QE Instruction)

Guide the agent by defining the test requirements in a language it understands: Markdown. Your test_case.md is the source of truth.

Instruct Agent
Send the prompt below to make the agent read and confirm understanding of your structured requirements.
Prompt to send to Gemini 3.5 Flash
Please read the file at this path: ./test_case.md

From that file, I need you to:
1. List the **core requirements** you have identified (the Critical Steps)
2. List the **bolded critical steps** β€” these are your non-negotiable test gates
3. Summarise the acceptance criteria as testable assertions
4. Identify any edge cases or boundary conditions in the non-functional section

Format your response as a structured list. Do not begin automation yet β€” I need to confirm your understanding first.
πŸ“‹ Sample Agent Response β€” Gemini 3.5 Flash
I've read test_case.md. Here is my structured understanding:

**Core Requirements (Critical Steps)**
1. User must be able to navigate to /login
2. User must be able to submit valid credentials (email + password)
3. System must redirect to /dashboard on successful login

**Bolded Critical Steps (Non-Negotiable Test Gates)**
- βœ… Navigate to /login
- βœ… Enter valid credentials
- βœ… Redirect to /dashboard on success

**Acceptance Criteria as Testable Assertions**
| Input | Expected Output |
|-------|----------------|
| Valid email + correct password | Redirect to /dashboard |
| Valid email + wrong password | Error: "Invalid credentials" |
| Empty email field | Error: "Email is required" |
| Empty password field | Error: "Password is required" |
| Successful login | Session cookie persisted |

**Non-Functional Edge Cases**
- Performance: Login response must be < 2 seconds (requires timer assertion)
- Accessibility: ARIA labels needed on all input fields (requires a11y checks)

βœ… Understanding confirmed. Awaiting your instruction to begin automation.
QE Observation
If the agent's summary matches your intent β€” proceed. If not, edit test_case.md to clarify the requirements and ask the agent to re-read it.
Phase 4

Execution and Correction β€” The Orchestration Loop

Transition the agent into automated execution while you maintain control as the observer. This is the live orchestration loop β€” you watch, correct, and direct.

Instruct Agent
Send the prompt below to start automated test generation based on your markdown rules.
Prompt to send to Gemini 3.5 Flash
Based on the requirements you confirmed from test_case.md, please automate the following within the local codebase:

1. Create a new file at: ./tests/login.spec.ts
2. Write Playwright test cases that cover ALL acceptance criteria you identified
3. Ensure each Critical Step is a separate test.describe/test block
4. Add an assertion for the session cookie after successful login
5. Include a performance timing assertion (< 2000ms)

Rules:
- Follow the structure in test_case.md exactly β€” do not invent new requirements
- Use TypeScript with Playwright's page object pattern
- Every test must have a descriptive name matching the acceptance criteria row

Once complete, run `git add tests/login.spec.ts && git commit -m "feat: add login Playwright tests from QE runbook"`
πŸ“‹ Sample Agent Response β€” Gemini 3.5 Flash
Creating ./tests/login.spec.ts now...

```typescript
import { test, expect } from '@playwright/test';

test.describe('Login Feature β€” QE Runbook Lab 1', () => {

  // ── Critical Step 1: Navigate to /login ──────────────────
  test('should load the login page', async ({ page }) => {
    const start = Date.now();
    await page.goto('/login');
    const duration = Date.now() - start;

    await expect(page).toHaveURL('/login');
    expect(duration).toBeLessThan(2000); // Non-functional: < 2s
  });

  // ── Critical Step 2 & 3: Valid login β†’ /dashboard ────────
  test('valid credentials redirect to /dashboard', async ({ page, context }) => {
    await page.goto('/login');
    await page.fill('[aria-label="Email"]', 'user@example.com');
    await page.fill('[aria-label="Password"]', 'SecurePass123');
    await page.click('[type="submit"]');

    await expect(page).toHaveURL('/dashboard');

    // Session cookie assertion
    const cookies = await context.cookies();
    const session = cookies.find(c => c.name === 'session');
    expect(session).toBeDefined();
  });

  // ── Acceptance: wrong password β†’ error message ────────────
  test('wrong password shows Invalid credentials error', async ({ page }) => {
    await page.goto('/login');
    await page.fill('[aria-label="Email"]', 'user@example.com');
    await page.fill('[aria-label="Password"]', 'WrongPass');
    await page.click('[type="submit"]');

    await expect(page.getByText('Invalid credentials')).toBeVisible();
  });

  // ── Acceptance: empty email β†’ validation error ────────────
  test('empty email shows Email is required error', async ({ page }) => {
    await page.goto('/login');
    await page.fill('[aria-label="Password"]', 'SomePass');
    await page.click('[type="submit"]');

    await expect(page.getByText('Email is required')).toBeVisible();
  });

  // ── Acceptance: empty password β†’ validation error ─────────
  test('empty password shows Password is required error', async ({ page }) => {
    await page.goto('/login');
    await page.fill('[aria-label="Email"]', 'user@example.com');
    await page.click('[type="submit"]');

    await expect(page.getByText('Password is required')).toBeVisible();
  });
});
```

Running git commit...
```bash
$ git add tests/login.spec.ts
$ git commit -m "feat: add login Playwright tests from QE runbook"
[main a3f21c9] feat: add login Playwright tests from QE runbook
 1 file changed, 52 insertions(+)
 create mode 100644 tests/login.spec.ts
βœ… Tests committed successfully.
```
QE Observation
Review the generated test file. If the agent deviated from the markdown rules β€” e.g. invented a requirement not in test_case.md β€” add a correction note to the markdown and instruct the agent to re-read and correct.
Correction prompt (use if agent deviates)
Your generated tests contain [describe the deviation]. 
Please re-read test_case.md and correct tests/login.spec.ts so it only covers the requirements listed there.
Do not add any new test cases beyond what is explicitly stated in the markdown.
After correction, recommit with: git commit -m "fix: align login tests to QE runbook requirements"
Final sync prompt
All tasks are complete. Please run the following to verify our workspace state:
1. `git status` β€” confirm all changes are committed
2. `git log -n 1` β€” view the latest local commit detail
3. Provide a summary of what was automated, what tests were created, and any assumptions you made
πŸ“‹ Sample Agent Response for Verification β€” Gemini 3.5 Flash
I'll verify the workspace state and provide a summary.

**Step 1 β€” git status**
```bash
$ git status
On branch main
nothing to commit, working tree clean
```

**Step 2 β€” git log**
```bash
$ git log -n 1
commit 341d284eb2b1f6ba4f5c7893840b81b57e9965ae
Author: Your Name <your.email@example.com>
Date:   Tue Jun 30 21:31:41 2026 +0100

    feat: add login Playwright tests from QE runbook
```

**Step 3 β€” Summary**
- **Automated**: Playwright E2E tests for the login feature in `./tests/login.spec.ts`.
- **Created Tests**: 5 test cases mapping to all acceptance criteria (success redirect, invalid password, empty email, empty password, session cookie verification).
- **Assumptions**: Assumed inputs have ARIA labels matching the login form fields (`Email`, `Password`).

βœ… Verification complete. Workspace is clean and local history is recorded.
βœ… Lab Complete β€” Orchestration Loop Closed

The QE has successfully directed Gemini 3.5 Flash through the full workflow: environment setup β†’ workspace initialization β†’ structured task definition β†’ automated execution and commit.

The agent operated entirely under your observation and was correctable at every step via the markdown file. This is the QE as AI Orchestrator model in action.

πŸŽ“ Day 1 Quick Check

In the QE as AI Orchestrator model, what is the primary responsibility of the human Quality Engineer?