This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from playwright.sync_api import sync_playwright | |
| # Runs before any scenarios | |
| def before_all(context): | |
| # Start Playwright and the browser - close it in after_all | |
| context.playwright = sync_playwright().start() | |
| context.browser_type = context.playwright.chromium | |
| context.browser = context.browser_type.launch(headless=True) | |
| # Runs at the start of each scenario |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Gör en Feature-fil för varje större feature i appen. | |
| # Varje feature testas med ett eller flera scenarion. | |
| # Varje scenario beskrivs med flera steg, som definieras i en separat step-fil. | |
| # | |
| # Även icke-tekniska personer ska kunna läsa och förstå vad dessa testscenarier går ut på. | |
| # | |
| Feature: Enkel kalkylator | |
| Scenario: Addera två tal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Exempel på validering av formulär | |
| Förbättringar: | |
| + Flytta valideringslogik till en separat hook för återanvändbarhet. | |
| + Lägg till fokus på första fel för bättre tillgänglighet: inputRef.current.focus() | |
| + Lägg till visuell feedback på input (t.ex. border-färg) för bättre UX. Återkoppla med mer än färg. | |
| */ | |
| import { useState } from "react"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // App.jsx | |
| import { Suspense } from 'react' | |
| import './App.css' | |
| import Loading from './Loading' | |
| import Consumer from './Consumer' | |
| const App = () => ( | |
| <div> | |
| <Suspense fallback={<Loading />}> | |
| <Consumer /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Python CI/CD | |
| # Talar om när jobben ska köras. Denna inställning bevakar när man gör push eller pull request mot branchen "main". | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SVG är ett bildformat, som man kan skriva med HTML-syntax. Eftersom den består av HTML-element kan man välja ut de ingående delarna med hjälp av JavaScript. | |
| Exempel | |
| Filen innehåller: | |
| <path id="scaffold" ...> | |
| Skriv i JS: | |
| const part1 = document.querySelector('#scaffold') | |
| part1.classList.add('css-klass som gör elementet osynligt') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { DynamoDBClient } from "@aws-sdk/client-dynamodb"; | |
| import { DynamoDBDocumentClient, GetCommand, PutCommand, ScanCommand } from "@aws-sdk/lib-dynamodb"; | |
| /* | |
| GetCommand används för att hämta en specifik Item i en Table. (AWS rekommenderar att man har allt i samma tabell.) | |
| ScanCommand kan hämta hela innehållet i en tabell. Opraktiskt om man har mycket data. | |
| PutCommand lägger till en ny Item. | |
| UpdateItemCommand ändrar en Item. | |
| DeleteCommand | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Exempel på användning: | |
| import { ask } from './ask.ts' | |
| let x: string = await ask('Vilken är din favoritfärg? ') | |
| console.log('Du svarade: ' + x) | |
| */ | |
| import readline from 'node:readline' | |
| async function ask(query: string): Promise<string> { | |
| const rl = readline.createInterface({ input: process.stdin, output: process.stdout, tabSize: 4 }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Feature: Musiksökning | |
| Som en användare av musiktjänsten | |
| Vill jag kunna söka efter musik | |
| För att hitta musik jag gillar | |
| Background: | |
| Given att jag är inloggad på musiktjänsten | |
| And att jag är på söksidan | |
| Scenario: Söka efter musik med giltigt sökord |
NewerOlder